aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2024-05-13 17:46:02 +0100
committerMichal Prívozník <michal@privoznik.com>2024-05-20 07:23:12 +0000
commitf3e270bb321f24e1bc32c5911c156053565cb2ca (patch)
tree58b262eb3d584690a58c5a10d163f3db342fbce9
parent1045f947f0a19b0c48e2b83f6e2b25b6467239e6 (diff)
downloadlibvirt-ci-f3e270bb321f24e1bc32c5911c156053565cb2ca.zip
libvirt-ci-f3e270bb321f24e1bc32c5911c156053565cb2ca.tar.gz
libvirt-ci-f3e270bb321f24e1bc32c5911c156053565cb2ca.tar.bz2
tests: make independent of main project list
The tests currently rely on the global list of projects. We're about to delete those, so we must import projects needed for tests to a private directory. A couple of tests are changed to use different projects to reduce the number we keep. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
-rw-r--r--tests/conftest.py3
-rw-r--r--tests/data/projects/libvirt-go-module.yml6
-rw-r--r--tests/data/projects/libvirt-go-xml-module.yml2
-rw-r--r--tests/data/projects/libvirt.yml82
-rw-r--r--tests/test_commands.py6
-rw-r--r--tests/test_inventory.py2
6 files changed, 96 insertions, 5 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index 0ae8a31..7c6a7dc 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -6,6 +6,7 @@ from pathlib import Path
from lcitool.packages import Packages
from lcitool.projects import Projects
from lcitool.targets import Targets
+from lcitool.util import DataDir
from test_utils.mocks import libvirt, gi
import test_utils.utils as test_utils
@@ -27,7 +28,7 @@ def pytest_configure(config):
# These needs to be a global in order to compute ALL_PROJECTS and ALL_TARGETS
# at collection time. Tests do not access it and use the fixtures below.
-_PROJECTS = Projects()
+_PROJECTS = Projects(DataDir(Path(test_utils.base_data_dir())))
_TARGETS = Targets()
ALL_PROJECTS = sorted(_PROJECTS.names + list(_PROJECTS.internal.keys()))
diff --git a/tests/data/projects/libvirt-go-module.yml b/tests/data/projects/libvirt-go-module.yml
new file mode 100644
index 0000000..5e6304f
--- /dev/null
+++ b/tests/data/projects/libvirt-go-module.yml
@@ -0,0 +1,6 @@
+packages:
+ - ccache
+ - gcc
+ - go
+ - libc
+ - pkg-config
diff --git a/tests/data/projects/libvirt-go-xml-module.yml b/tests/data/projects/libvirt-go-xml-module.yml
new file mode 100644
index 0000000..790a543
--- /dev/null
+++ b/tests/data/projects/libvirt-go-xml-module.yml
@@ -0,0 +1,2 @@
+packages:
+ - go
diff --git a/tests/data/projects/libvirt.yml b/tests/data/projects/libvirt.yml
new file mode 100644
index 0000000..66c1fb6
--- /dev/null
+++ b/tests/data/projects/libvirt.yml
@@ -0,0 +1,82 @@
+---
+packages:
+ - apparmor
+ - augeas
+ - augeas-lenses
+ - bash-completion
+ - black
+ - ccache
+ - clang
+ - codespell
+ - cpp
+ - cppi
+ - cyrus-sasl
+ - device-mapper
+ - diffutils
+ - dlfcn
+ - dtrace
+ - dwarves
+ - ebtables
+ - firewalld-filesystem
+ - flake8
+ - fuse
+ - gcc
+ - gettext
+ - gettext-native
+ - glib2
+ - glusterfs
+ - gnutls
+ - grep
+ - ip
+ - iptables
+ - iscsiadm
+ - libacl
+ - libattr
+ - libaudit
+ - libblkid
+ - libc
+ - libcap-ng
+ - libcurl
+ - libiscsi
+ - libnbd
+ - libnl3
+ - libnlroute3
+ - libnuma
+ - libparted
+ - libpcap
+ - libpciaccess
+ - librbd
+ - libselinux
+ - libssh
+ - libssh2
+ - libtirpc
+ - libudev
+ - libxml2
+ - lvm2
+ - make
+ - meson
+ - modprobe
+ - netcf
+ - ninja
+ - numad
+ - openwsman
+ - perl
+ - pkg-config
+ - polkit
+ - portablexdr
+ - python3
+ - python3-docutils
+ - python3-pytest
+ - qemu-img
+ - readline
+ - rpmbuild
+ - sanlock
+ - sed
+ - showmount
+ - systemd-rpm-macros
+ - tc
+ - wireshark
+ - xen
+ - xmllint
+ - xsltproc
+ - yajl
diff --git a/tests/test_commands.py b/tests/test_commands.py
index f289de7..d59fe06 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -14,8 +14,8 @@ cli_args = [
["--help"],
["targets"],
["projects"],
- ["variables", "almalinux-8", "osinfo-db-tools"],
- ["dockerfile", "almalinux-8", "osinfo-db-tools"],
+ ["variables", "almalinux-8", "libvirt-go-module"],
+ ["dockerfile", "almalinux-8", "libvirt-go-module"],
["manifest", "-n", Path(__file__).parent.parent.joinpath("examples", "manifest.yml")],
["container", "engines"]
]
@@ -30,5 +30,5 @@ def test_commands(test_cli_args):
# we're running the tests in a virtual env
lcitool_path = Path(sys.prefix, "bin/lcitool")
- subprocess.check_call([lcitool_path] + test_cli_args,
+ subprocess.check_call([lcitool_path, '-d', Path(__file__).parent.joinpath("data")] + test_cli_args,
stdout=subprocess.DEVNULL)
diff --git a/tests/test_inventory.py b/tests/test_inventory.py
index 73c667f..7020882 100644
--- a/tests/test_inventory.py
+++ b/tests/test_inventory.py
@@ -55,7 +55,7 @@ def test_host_target_name(inventory):
def test_group_vars(inventory, targets, packages, projects):
target = BuildTarget(targets, packages, "fedora-39")
- group_vars = inventory.get_group_vars(target, projects, ["nbdkit"])
+ group_vars = inventory.get_group_vars(target, projects, ["libvirt"])
assert "nano" in group_vars["unwanted_packages"]
assert "python3-libselinux" in group_vars["early_install_packages"]