- name: Test collection lookup bypass host list
  hosts: all
  connection: local
  gather_facts: false
  collections:
    - testns.testcoll
  tasks:
    - bypass_host_loop:
      register: bypass

    - run_once: true
      vars:
        bypass_hosts: '{{ hostvars|dictsort|map(attribute="1.bypass.bypass_inventory_hostname")|select("defined")|unique }}'
      block:
        - debug:
            var: bypass_hosts

        - assert:
            that: bypass_hosts|length == 1
