---
- hosts: pfservers
  name: Run example tests
  become: True

  vars:
    # put your test suites to try here
    test_suites:
      - configurator_inline
      - inline/l3
      - inline/l3/teardown
      - inline/l2
      - inline/l2/teardown
      - security_event_suricata
      - security_event_suricata/teardown
      - security_event_random_mac
      - security_event_random_mac/teardown

  tasks:
    - name: Run Venom testsuites
      command: '{{ venom_dir }}/venom-wrapper.sh {{ venom_dir }}/test_suites/{{ item }}'
      args:
        chdir: '{{ venom_dir }}'
      loop: '{{ test_suites }}'
      vars:
        venom_wrapper_args:
          # temp, overcome two Venom issues:
          # - tap: https://github.com/ovh/venom/issues/428
          # - when running test suite one by one, previous logs and results are overriden
          # Venom will create one directory per test suite to store results
          VENOM_COMMON_FLAGS: '--format=tap --output-dir={{ venom_dir }}/results/{{ item }}'

      # add inventory__group_environment to Ansible environment
      # useful to make env vars available for Venom
      environment: '{{ inventory__group_environment | d({})
                       | combine(venom_wrapper_args | d({})) }}'


