Commit graph

56 commits

Author SHA1 Message Date
Rich Megginson
dec163940e support testing/linting module_utils code
This does not directly affect network because network has its own
solution for dealing with testing/linting module_utils code, but
it gets network to feature/code parity with the template and
other repos.

Defines a shell function in utils.sh - lsr_setup_module_utils -
that allows configuring a tox venv installed ansible to have
the repo module_utils code in the default pythonpath for the
venv, which allows testing and linting the module_utils code
without having to otherwise munge or mock the pythonpath.

Projects needing this functionality can set in `.travis/config.sh`
the variable `RUN_PYTEST_SETUP_MODULE_UTILS` to setup
module_utils/ for pytest, and `RUN_PYLINT_SETUP_MODULE_UTILS`
to setup module_utils/ for pylint.
2020-04-06 19:14:42 +02:00
Jack Adolph
4af8f23955 Add support for 802.1x wired connections (EAP-TLS only)
Only EAP-TLS method is supported. Must use NetworkManager as the network_provider.
Also fixed bug in do_connections_validate_nm() function.
2020-03-25 10:49:10 +01:00
Till Maas
8cd37ac873 tests: Fix yamllint issues
Fix as many issues as feasible. Ignore the errors in generated
"other_provider" tests since they are going to be removed, soon.
2020-03-24 13:55:27 +01:00
a-mere-peasant
1a81c3d2da Update tests_default to have explicit providers
The network providers for tests_default are to be selected explicitly
Add tests_default_nm.yml
Add tests_default_initscripts.yml

Since the providers are listed explicitly ,there is no need for a other_provider playbook
Remove tests_default_other_provider.yml

Add tests_default and tests_default(nm/initscripts).yml to ingnore list for ensure_other_provider script
2020-03-23 14:42:31 +01:00
Till Maas
70aa9875aa Add support for ethtool features 2019-06-14 15:18:11 +02:00
Till Maas
4215ef93cb tests_vlan_mtu: Properly set the network provider
Set the network_provider as fact to ensure that it is also set in the
imported playbook.
2019-06-11 11:12:15 +02:00
Till Maas
5d2eec9478 tests_vlan_mtu: Use debug task to show TEST/CLEANUP
The name for import_roles is not logged, therefore use an extra debug
task to indicate the test steps.
2019-06-11 11:12:15 +02:00
Till Maas
ab60a47475 connections unit tests: Introduce ETHERNET_DEFAULTS 2019-06-06 22:24:34 +02:00
Till Maas
d2e7af451e connections unit tests: Fix sys.path manipulation
After moving the unit tests into a subdirectory, the path inserts need
to go to one more parent directory.
2019-06-06 21:44:36 +02:00
Till Maas
9e5150b88d tests_unit.yml: Fix ansible-lint warnings 2019-06-06 09:06:16 +02:00
Till Maas
0cbf94af61 unitests: Move unit tests in separate directory 2019-06-06 09:06:16 +02:00
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