network/tests/tests_unit.yml
Till Maas 791d271d0b Use "is succeeded" instead of | succeeded
This removes this deprecation warning:
[DEPRECATION WARNING]: Using tests as filters is deprecated. Instead of
using `result|succeeded` instead use `result is succeeded`. This feature
will be removed in version 2.9. Deprecation warnings can be disabled by
setting deprecation_warnings=False in ansible.cfg.
2018-05-23 18:29:31 +02:00

72 lines
1.7 KiB
YAML

# SPDX-License-Identifier: BSD-3-Clause
---
- hosts: all
name: Setup for test running
tasks:
# FIXME: change with_items to loop when test-harness is updated
- package:
name: "{{ item }}"
state: present
ignore_errors: true
with_items:
- NetworkManager-libnm
- python2-gobject-base
- python3-gobject-base
- python-gobject-base
- hosts: all
name: execute python unit tests
tasks:
- copy:
src: ../library/network_connections.py
dest: /tmp/test-unit-1/
- copy:
src: test_network_connections.py
dest: /tmp/test-unit-1/
- file:
state: directory
dest: /tmp/test-unit-1/helpers
- copy:
src: "{{ item }}"
dest: /tmp/test-unit-1/helpers
mode: 0755
with_fileglob:
- helpers/*
- package:
name: python2
state: present
ignore_errors: true
register: python2_available
- command: python2 /tmp/test-unit-1/test_network_connections.py --verbose
when: python2_available is succeeded
register: python2_result
- package:
name: python3
state: present
ignore_errors: true
register: python3_available
- command: python3 /tmp/test-unit-1/test_network_connections.py --verbose
when: python3_available is succeeded
register: python3_result
- command: python /tmp/test-unit-1/test_network_connections.py --verbose
register: python_result
- debug:
var: python2_result.stderr_lines
when: python2_result is succeeded
- debug:
var: python3_result.stderr_lines
when: python3_result is succeeded
- debug:
var: python_result.stderr_lines
when: python_result is succeeded