Commit graph

45 commits

Author SHA1 Message Date
Till Maas
058eb4d1cd tests: Add missing roles symlink 2019-06-06 09:06:12 +02:00
Till Maas
8ec0196781 tests: Test setting the MTU of VLAN interfaces
Test setting the MTU interfaces. This needs autoconnect:false for now,
possibly because of a bug in NetworkManager.
2019-06-03 11:28:07 +02:00
Till Maas
1d342ef037 tests: Test volatile state changes 2019-05-26 21:19:23 +02:00
Till Maas
0c59fe1c6a Cleanup yaml files for molecule lint 2019-04-25 14:19:15 +02:00
Till Maas
344305fd8f tests: Cleanup unit tests playbook 2019-04-16 18:27:45 +02:00
Till Maas
eef5ea350f tests: Do not follow local symlinks
A symlink like

ansible -> ../..

in module_utils/network_lsr breaks the copy task with a strange error
message:

An exception occurred during task execution. To see the full traceback,
use -vvv. The error was: FileNotFoundError: [Errno 2] No such file or
directory: ''

Avoiding following symlinks helps here. The symlink makes it easier to
import the files since the import paths include ansible as a component:

from ansible.module_utils.network_lsr.utils import Util
2019-04-16 18:27:45 +02:00
Till Maas
00a81165e8 tests: Install iproute to manage test interfaces 2019-04-16 18:27:45 +02:00
Till Maas
f8d325f9fa tests: Adjust profile path if necessary
If /etc/network-scripts does no exist, NeworkManger uses
/etc/NetworkManager/system-connections to store profiles. Use this
directory if necessary.
2019-04-16 18:27:45 +02:00
Till Maas
5273f55166 tests: Do not use ansible_interfaces
ansible_interfaces requires iproute to be present which might not be the
case for container images. Check /sys/class/net to avoid the dependency.
2019-04-16 18:27:45 +02:00
Till Maas
16f06b18a8 Tests: Only show missing test files when checking 2019-01-09 22:59:27 +01:00
Till Maas
9314a2b251
Merge pull request #93 from tyll/asserts
test asserts: Clarify name
2019-01-08 20:52:28 +01:00
Till Maas
9b3712cbdf test asserts: Clarify name 2019-01-08 17:11:38 +01:00
Till Maas
4d9f475ce7 Tests: Add names for other provider tasks/playbooks 2019-01-08 17:10:31 +01:00
Till Maas
49c7c6a0f4 tests: Properly set the name of assert tasks
Otherwise it breaks with Ansible 2.7 or does not show the name with
previous Ansible versions.
2018-10-16 11:31:22 +02:00
Till Maas
207d31b4d0 tests: Use vars: with include_tasks
Specifying vars as foo=bar does not work anymore with Ansible 2.7.
Specify the vars using a dictionary instead.

This fixes #89
2018-10-16 11:31:22 +02:00
Till Maas
712ff3fa88 Fix typo 2018-08-15 10:04:47 +02:00
Till Maas
09258d84e3 Support compatibility values for 'state' setting 2018-08-15 10:04:47 +02:00
Till Maas
e1bb399311 Use loop to install packages 2018-08-15 10:04:47 +02:00
Till Maas
23605615da Separate 'persistent_state' from 'state'
- persistent_state represents whether a profile is stored on disk
- persistent_state defaults to 'present'
- When there is no type specified for the profile, it is enough for a
profile with the same name to be stored on the target's systems file
system. Otherwise the role will fail
- state now represents the runtime state and can be up, down or
unspecified
- translate the state definitions into actions that will be performed.
The actions correspond to the previous states.
- add the possibility to write unit tests to only verify parts of the
resulting connection dictionary to only check for the expected changes
instead of the full connection that can also contain unrelated defaults
2018-08-15 10:04:47 +02:00
Till Maas
382c34197b Modularize role
Splitting the role in smaller parts helps to keep the overview and to
develop separate tests.
2018-08-15 10:04:47 +02:00
Till Maas
c279f0afc5 Run integration tests with other provider, too
- Amend and add files to run integration tests against the provider that
was not autodetected, too.
- Add check to ensure that all integration tests run against both
providers
- Run black check for all python scripts
2018-08-01 23:13:30 +02:00
Till Maas
6bf70bcf60 Use profile name for interface name by default
* by default ```name``` is used as ```interface_name```
* if ```interface_name``` is set to the empty string, it will not be set
* if ```mac``` is specified, ```interface_name``` defaults to not being set

This fixes #41
2018-07-25 21:56:43 +02:00
Till Maas
64879e74d9
Merge pull request #73 from tyll/black-squash
Use black as formatter and enable flake8/pylint
2018-07-20 13:16:20 +02:00
Till Maas
e32033f995 Use black as formatter and enable flake8/pylint 2018-07-18 17:23:18 +02:00
Till Maas
9b3d2d3ad8 Add simple test for bridges 2018-07-16 08:26:50 +02:00
Till Maas
d370966ee2 Add test to take interface down 2018-07-09 14:39:40 +02:00
Till Maas
5f30c5b5e3 Use set_facts to set default provider
This avoids symlinks that do not work on Windows:
https://github.com/linux-system-roles/network/pull/64#issuecomment-401740870
2018-07-09 11:56:01 +02:00
Till Maas
053dd62720 tests_ethernet: run with initscripts provider, too 2018-06-29 16:06:43 +02:00
Till Maas
488c59a5f5 Rename/symlink accidentally checked-in files 2018-06-28 16:55:37 +02:00
Till Maas
fce335d79e tests_ethernet: Use correct test IP range 2018-06-28 16:31:35 +02:00
Shannon Mascarenhas
70e69226c1 Add test for disabling autoconnect 2018-05-30 08:25:25 -05:00
Till Maas
0fc1b5bbb5 Add test to remove Ethernet profile 2018-05-25 19:52:10 +02:00
Till Maas
598e487971 Only run tests with python2 or python3 binary
Also fail, when the tests did not run with at least one of them.
2018-05-25 19:51:09 +02:00
Till Maas
47c7b638f0 Test whether python commands can be executed
This changes the test to rely on whether the binaries are available
regardless of how they were installed or from which package.
2018-05-25 19:50:07 +02:00
Till Maas
b01ab7fd50 Add integration test for Ethernet device 2018-05-24 15:14:04 +02:00
Till Maas
910f399665 Add helper scripts to get coverage data 2018-05-24 15:14:04 +02:00
Till Maas
ff2f35cb8a Add helper tasks for integration tests 2018-05-23 18:55:21 +02:00
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
Till Maas
0bb66af883 Add basic test for Utils.check_output() 2018-05-23 18:29:31 +02:00
Till Maas
83f2521d5e Fix python3 missing "cmp" keyword for list.sort()
This fixes this exception on Python3:
TypeError: 'cmp' is an invalid keyword argument for this function
2018-05-23 18:29:31 +02:00
Till Maas
8157a89456 Install pygobject and NetworkManager-libnm if possible
This avoids skipping tests that require pygobject/libnm
2018-05-23 18:29:31 +02:00
Till Maas
fa13ea2388 Fix exception on Python3 in _link_read_permaddress
Bytestrings need to be decoded. Just use UTF-8 here, since everyone
should be using it. Also add a test case to catch this. The exception
was:
TypeError: cannot use a string pattern on a bytes-like object
2018-05-23 18:29:31 +02:00
Till Maas
8e6f1bf96b Move unit tests to tests dir 2018-05-16 20:18:05 +02:00
Till Maas
3e6e536248 Avoid symlink loop and nonstandard top level roles directory - move to tests 2018-05-16 20:03:05 +02:00
Till Maas
4ead3cfea8 Move tests to /tests directory and rename to new naming scheme
Ansible Galaxy and
https://fedoraproject.org/wiki/CI/Standard_Test_Interface suggest to use
a /tests directory and a names matching test*.yml.
2018-05-16 19:48:23 +02:00