---
- hosts: pfservers
  name: Run Fingerbank Invalid DB tests
  become: True

  vars:
    # put your test suites to try here
    test_suites:
      - configurator
      - global_config

      # Run the captive_portal suite independently from the other ones since it it requires to keep the IP in the registration VLAN and the other test suites perform VLAN changes
      - fingerbank_invalid_db/corrupt
      - fingerbank_invalid_db/clear_cache
      - captive_portal
      - captive_portal/locales
      - captive_portal/teardown
      - fingerbank_invalid_db/corrupt/teardown

      - fingerbank_invalid_db/missing_table
      - fingerbank_invalid_db/clear_cache
      - captive_portal
      - captive_portal/locales
      - captive_portal/teardown
      - fingerbank_invalid_db/missing_table/teardown

      - fingerbank_invalid_db/corrupt
      - fingerbank_invalid_db/clear_cache
      - wired_mac_auth
      - wired_mac_auth/teardown
      - fingerbank_invalid_db/clear_cache
      - wireless_mac_auth
      - wireless_mac_auth/teardown
      - fingerbank_invalid_db/clear_cache
      - wired_dot1x_eap_peap
      - wired_dot1x_eap_peap/teardown
      - fingerbank_invalid_db/clear_cache
      - wireless_dot1x_eap_peap
      - wireless_dot1x_eap_peap/teardown
      - fingerbank_invalid_db/clear_cache
      - fingerbank_invalid_db/corrupt/teardown

      - fingerbank_invalid_db/missing_table
      - fingerbank_invalid_db/clear_cache
      - wired_mac_auth
      - wired_mac_auth/teardown
      - fingerbank_invalid_db/clear_cache
      - wireless_mac_auth
      - wireless_mac_auth/teardown
      - fingerbank_invalid_db/clear_cache
      - wired_dot1x_eap_peap
      - wired_dot1x_eap_peap/teardown
      - fingerbank_invalid_db/clear_cache
      - wireless_dot1x_eap_peap
      - wireless_dot1x_eap_peap/teardown
      - fingerbank_invalid_db/clear_cache
      - fingerbank_invalid_db/missing_table/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({})) }}'


