IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
It is not possible to run integration tests if NetworkManager-libreswan
rpm is not installed. Pytest fails during the collection stage,
preventing from running even tests not related to Libreswan.
Fix it.
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
Instead of checking micro version, we should convert version to a
integer to compare using this formula:
10000 * major_version + 100 * minor_version + micro_version
Introduced `nm_libreswan_version_int()` and `version_str_to_int()` for
this and fixed all version check in ipsec test.
Signed-off-by: Gris Ge <fge@redhat.com>
Introducing `description` as top level key of YAML/JSON API holding a
String. For example:
```yml
description: Abc
```
Currently, this property will be ignored when applying or querying, no
backend will persist this property. It is designed for user to store
description for the whole YAML only for now.
By using `testlib.apply.apply_with_description()`, we could store:
`test_description: <string>` into `.descriptions`. The
`pytest ----dump-ai-train-yaml` will store the YAML file into `.states`
folder for training AI.
The `--dump-ai-train-yaml` will only store YAML files with top level
description and the output will only contains the difference between
desired state and current state.
Signed-off-by: Gris Ge <fge@redhat.com>
This change dumps the network configuration involved at integration test
so other projects can check their implementations with them.
Signed-off-by: Enrique Llorente <ellorent@redhat.com>
Previously we were using run-tests.sh to setup the eth1 and eth2,
after moving this into pytest fixture, the `pytest` could works out of
box.
Signed-off-by: Gris Ge <fge@redhat.com>
When testing with SR-IOV cards, it is time consuming to restored the
full old state and also might lead to ethtool failures.
Hence change the `conftest.py` to only restored the IP address, IP route
and DNS config for interface with IPv4 or IPv6 gateway.
Signed-off-by: Gris Ge <fge@redhat.com>
Due to `ip netns` issue in https://github.com/containers/podman/issues/11887 ,
`ip netns exec` will fail in podman container.
To workaround it, mount another sysfs to random folder workaround this
problem.
Signed-off-by: Gris Ge <fge@redhat.com>
In Github CI, the container environment is changed to use tap interface
to hold the default gateway. Nmstate does not support tap interface
which cause failure during verification on pre-test clean up.
Workaround it by ignoring failure on removing routes/rules/dns during
the pre-test setup.
Signed-off-by: Gris Ge <fge@redhat.com>
The integration tests should ignore interfaces related to the CNI used
by the k8s cluster calico. This change introduces an env var to pass
inteface substring to ignore.
Signed-off-by: Quique Llorente <ellorent@redhat.com>
Use permanent MAC address when possible for `Interface.COPY_MAC_FROM`.
Integration test case added by require real NIC to test using. Example:
sudo env TEST_REAL_NIC="enp7s0" pytest -k \
test_create_linux_bridge_with_copy_mac_from_permanent_mac
Tested on e100e in RHEL 8.4 VM.
Signed-off-by: Gris Ge <fge@redhat.com>
Since nmstate support changing DNS/route/route_rule without interface
defined, there is no need to include full state of all interface to
clean up the test environment.
Updated the integration test case because container will have eth1
unmanaged by NetworkManager which will still hold route and DNS config.
Signed-off-by: Gris Ge <fge@redhat.com>
In Fedora 34, the pytest(6.2.2) will complain about
`PytestUnknownMarkWarning`.
Fixed the manual marker register code.
Signed-off-by: Gris Ge <fge@redhat.com>
The pytest-4.6.9 will complain unregister markers:
/usr/lib/python3.7/site-packages/_pytest/mark/structures.py:335:
PytestUnknownMarkWarning: Unknown pytest.mark.tier1 - is this a typo?
You can register custom marks to avoid this warning - for details, see
https://docs.pytest.org/en/latest/mark.html
To suppress that warning message, use `pytest_configure()` to register
the markers.
Signed-off-by: Gris Ge <fge@redhat.com>
In some platforms it is not possible to lose the connectivity during a
long time. In order to fix this, we are only cleaning auto_dns and
auto_routes in the tests when necessary.
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
In order to run the tests out of the containers when cleaning the state
nmstate needs to make sure that all the interfaces are using static DNS
and routes.
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
This patch is introducing integ_tier1 and integ_tier2 tests and using it
in travis CI. This will allow us to run integration test quickly as
both jobs, integ_tier1 and integ_tier2 are going to run at the same
time.
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
Some test case like DNS/DHCP/Route tests might got impacted by host's
original network state(for example, the initial removal of eth1/eth2
configure will fail when host is configured as static DNS with dynamic
IP as libnmstate.apply() will try to preserve the DNS information).
To fix that, create a empty network state before test starts using
session level autouse fixture `test_env_setup` to:
* Setup log level
* Remove all static route
* Remove all DNS configuration
* Remove all route rule configuration
* Restore host's network states after test ended.
* Show left over network interfaces created by test cases.
Signed-off-by: Gris Ge <fge@redhat.com>
This patch is going to avoid connectivity issues during the package
installation when running tests.
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
This is a team interface state example:
interfaces:
- name: team0
type: team
state: up
ipv4:
enabled: false
ipv6:
enabled: false
mtu: 1500
team:
ports:
- name: eth1
- name: eth2
runner:
mode: loadbalance
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
Ideally, the tests clean up after themselves. Try to catch differences
by comparing the host state from before and after the test run and warn
if there are differences.
Signed-off-by: Till Maas <opensource@till.name>
Mention NetworkManager RPM and Operating System in pytest header.
Example:
```
================= test session starts ==================
[...]
RPMs: NetworkManager-1.20.5-1.cab2e4fc96.el8.x86_64
OS: CentOS Linux 8 (Core)
```
This makes it easier to identify the test environment from the pytest
log. For example when the tests are running on bare-metal or in a VM
instead of the container that is setup with run-tests.sh.
Signed-off-by: Till Maas <opensource@till.name>
The existing eth{1,2}_up fixtures serve the integration tests with the
majority of tests. There are however serveral tests which use unique
interfaces (e.g. dhcp tests) which need similar fixtures.
In order to share the functionality, the fixtures implementation have
been extracted to a shared location (testlib) and are aimed to be used
in the following patches by other more focused scoped fixtures.
Signed-off-by: Edward Haas <edwardh@redhat.com>
IPv6 has been enabled on the test setup interfaces due to the limitation
of disabling IPv6 using NM.
The mentioned limitation has been mitigated by disabling IPv6 through
sysfs. Therefore, always enabling IPv6 in the fixtures is no longer
needed.
Signed-off-by: Edward Haas <edwardh@redhat.com>
Bridge tests use `portX` as their name format, abstracting the actual
interface used.
Providing portX alias naming to such tests makes them easier to read and
write.
Signed-off-by: Edward Haas <edwardh@redhat.com>
The eth*_up fixtures are used to setup most of the integration tests.
In some scenarios, it is useful to have these interfaces states just
before the test begins.
The fixtures resturn the current interface state.
Signed-off-by: Edward Haas <edwardh@redhat.com>
Example has been included as `examples/dns_edit_eth1.yml` and
`examples/dns_remove.yml`.
If DNS section not defined in desire state, old DNS configuration will be
perceived, otherwise, old DNS configuration will be fully override with
desired state. Partial editing of DNS entries is not supported.
To remove static DNS configuration, Please use this state:
```python
{
DNS.KEY: {
DNS.CONFIG: {}
}
}
```
Limitation:
* Only support saving DNS configuration to state default gateway
interfaces. If not found, NmstateValueError exception will be raised.
When DNS config not changed, no DNS changes will be made to profiles.
Unit and integration test cases has been included.
Signed-off-by: Gris Ge <fge@redhat.com>
Promoting these public classes and functions to libnmstate module top level:
* The 'show()' function of 'netinfo.py'.
* The 'apply()', 'commit', 'rollback' functions of 'netapplier.py'.
* The exception classes defined in 'error.py' as exposed as
'libnmstate.error'
* The 'PrettyState' class defined in 'prettystate.py' which is used by
nmstatectl.
* The schema classes are exposed as 'libnmstate.schema'.
The integration test cases and nmstatctl have been updated to use this
new public interface.
Signed-off-by: Gris Ge <fge@redhat.com>
The ethX fixtures prepare the base interfaces per test by initializing
their configuration (performing a down-up action).
The existing flow has been initializing the interfaces before a test is
executed with no action taken when it ends. This causes leftovers when
testing bonds/bridges with slaves/ports, affecting the following tests.
In order to resolve the post test leftovers, adjust the test fixtures
to setup the interface at the test setup and to remove them
(set them `down`) at the test teardown.
In order to treat the initial state of the tests session execution,
where the interfaces may have an unknown state/configuration, use a
session-scoped fixture to initialize them (by setting them `down`).
Signed-off-by: Edward Haas <edwardh@redhat.com>
The global fixture is used to prepare the setup interfaces (eth1, eth2)
for the tests by cleaning their configuration.
As a pre-step to prepare interfaces per need, the existing fixture is
split into 4: eth1_up, eth1_down, eth2_up, eth2_down.
The overall functionality has not changed.
The following patches will require the tests to explicitly specify
which interface they want to consume.
Signed-off-by: Edward Haas <edwardh@redhat.com>
The initial state of an integration test is set to 'up'.
Existing tests are adjusted and reflect that IPv6 is now enabled.
Signed-off-by: Edward Haas <edwardh@redhat.com>
In order to start each test from a clean state and assure there is no
dependency between the tests, the tested interfaces (eth1, eth2) are
taken down using a dedicated fixture.
Signed-off-by: Edward Haas <edwardh@redhat.com>