From 1dfd30884367506ff4f017e4183e6bf875ef8509 Mon Sep 17 00:00:00 2001 From: Erik Skultety Date: Tue, 5 Oct 2021 11:02:24 +0200 Subject: [PATCH] gitlab-ci: Introduce new 'integration_tests' pipeline stage This stage will download build artifacts from both the libvirt and libvirt-perl (multi-project CI) builds, install all them on the custom runners and configures libvirt debug logging on the runners prior to executing the actual test suite. In case of a failure, libvirt and Avocado logs will be saved and published as pipeline artifacts. Signed-off-by: Erik Skultety Reviewed-by: Michal Privoznik --- .gitlab-ci.yml | 5 ++- ci/integration.yml | 99 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 ci/integration.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d84ac31601..6b4c843055 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,6 +4,7 @@ variables: stages: - containers - builds + - integration_tests - sanity_checks .script_variables: &script_variables | @@ -14,7 +15,9 @@ stages: export VIR_TEST_VERBOSE="1" export VIR_TEST_DEBUG="1" -include: '/ci/gitlab.yml' +include: + - '/ci/gitlab.yml' + - '/ci/integration.yml' .native_build_job: extends: .gitlab_native_build_job diff --git a/ci/integration.yml b/ci/integration.yml new file mode 100644 index 0000000000..9a36ccc05e --- /dev/null +++ b/ci/integration.yml @@ -0,0 +1,99 @@ +.tests: + stage: integration_tests + before_script: + - mkdir "$SCRATCH_DIR" + - sudo dnf install -y libvirt-rpms/* libvirt-perl-rpms/* + - sudo pip3 install --prefix=/usr avocado-framework + - source /etc/os-release # in order to query the vendor-provided variables + - if test "$ID" = "centos" && test "$VERSION_ID" -lt 9 || + test "$ID" = "fedora" && test "$VERSION_ID" -lt 35; + then + DAEMONS="libvirtd virtlogd virtlockd"; + else + DAEMONS="virtproxyd virtqemud virtinterfaced virtsecretd virtstoraged virtnwfilterd virtnodedevd virtlogd virtlockd"; + fi + - for daemon in $DAEMONS; + do + LOG_OUTPUTS="1:file:/var/log/libvirt/${daemon}.log"; + LOG_FILTERS="3:remote 4:event 3:util.json 3:util.object 3:util.dbus 3:util.netlink 3:node_device 3:rpc 3:access 1:*"; + sudo augtool set /files/etc/libvirt/${daemon}.conf/log_filters "$LOG_FILTERS" &>/dev/null; + sudo augtool set /files/etc/libvirt/${daemon}.conf/log_outputs "$LOG_OUTPUTS" &>/dev/null; + sudo systemctl --quiet stop ${daemon}.service; + sudo systemctl restart ${daemon}.socket; + done + - sudo virsh net-start default &>/dev/null || true; + script: + - mkdir logs + - cd "$SCRATCH_DIR" + - git clone --depth 1 https://gitlab.com/libvirt/libvirt-tck.git + - cd libvirt-tck + - sudo avocado --config avocado.config run --job-results-dir "$SCRATCH_DIR"/avocado + after_script: + - test "$CI_JOB_STATUS" = "success" && exit 0; + - test -e "$SCRATCH_DIR"/avocado && sudo mv "$SCRATCH_DIR"/avocado/latest/test-results logs/avocado; + - sudo mv /var/log/libvirt logs/libvirt + - sudo chown -R $(whoami):$(whoami) logs + variables: + SCRATCH_DIR: "/tmp/scratch" + artifacts: + name: logs + paths: + - logs + when: on_failure + + +centos-stream-8-tests: + extends: .tests + needs: + - x86_64-centos-stream-8 + - project: libvirt/libvirt-perl + job: x86_64-centos-stream-8 + ref: master + artifacts: true + variables: + # needed by libvirt-gitlab-executor + DISTRO: centos-stream-8 + tags: + - redhat-vm-host + +centos-stream-9-tests: + extends: .tests + needs: + - x86_64-centos-stream-9 + - project: libvirt/libvirt-perl + job: x86_64-centos-stream-9 + ref: master + artifacts: true + variables: + # needed by libvirt-gitlab-executor + DISTRO: centos-stream-9 + tags: + - redhat-vm-host + +fedora-34-tests: + extends: .tests + needs: + - x86_64-fedora-34 + - project: libvirt/libvirt-perl + job: x86_64-fedora-34 + ref: master + artifacts: true + variables: + # needed by libvirt-gitlab-executor + DISTRO: fedora-34 + tags: + - redhat-vm-host + +fedora-35-tests: + extends: .tests + needs: + - x86_64-fedora-35 + - project: libvirt/libvirt-perl + job: x86_64-fedora-35 + ref: master + artifacts: true + variables: + # needed by libvirt-gitlab-executor + DISTRO: fedora-35 + tags: + - redhat-vm-host