---
- hosts: pfservers
  name: Run captive portal tests
  become: True

  vars:
    test_suites:
      - configurator
      - global_config
      - captive_portal
      - captive_portal/locales
      - captive_portal/teardown
      - global_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 Venom issue:
          # - 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: '--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({})) }}'


