832ae42
- name: Run the tests
71004bf
  vars:
71004bf
    req_services: []  # don't name this required_services, it would be endless loop
1acadc7
    req_pkgs:
1acadc7
    - python-docker-tests
1acadc7
    - python3-mock
1acadc7
    - python3-pytest
1acadc7
    - python3-docker
6ef87c1
  hosts: all
6ef87c1
  tasks:
6ef87c1
  - name: check if we are running in a container
8196204
    command: systemctl
8196204
    register: in_host
8196204
    ignore_errors: true
1acadc7
  - name: add docker to req_services if we are not in a container
6ef87c1
    set_fact:
71004bf
      req_services: ["docker"]
8196204
    when: in_host.rc == 0
1acadc7
  - name: add docker to req_pkgs if we are not in a container
1acadc7
    set_fact:
1acadc7
      req_pkgs: '{{ req_pkgs }} + [ "docker" ]'
1acadc7
    when: in_host.rc == 0
6ef87c1
  - name: run them tests
8196204
    include_role:
6ef87c1
      name: standard-test-basic
6ef87c1
    tags:
6ef87c1
    - classic
6ef87c1
    vars:
6ef87c1
      tests:
6ef87c1
      - unit:
6ef87c1
          run: pytest-3 -v /usr/libexec/installed-tests/python-docker/tests/unit/
6ef87c1
      - integration:
6ef87c1
          run: pytest-3 -v /usr/libexec/installed-tests/python-docker/tests/integration/
1acadc7
      required_packages: '{{ req_pkgs }}'
71004bf
      required_services: '{{ req_services }}'