-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP install: new test to check against reference files
Tests for generation of the reference files, and for checking against them. FIXME: needs reference files for releases
- Loading branch information
Showing
5 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# extract reference dumps from install | ||
|
||
# needs at least --hosts=$NEST | ||
# needs runtest-install output cache | ||
|
||
VERSION="83nightly" | ||
|
||
. $(dirname $0)/lib.sh | ||
|
||
GITREV=$(git rev-parse HEAD) | ||
|
||
declare -A FSDIFFCONFS=() | ||
for conf in "${TESTCONFS[@]}"; do | ||
IFS=- read fw sr < <(echo "$conf") | ||
[ "$media" = "iso" -a "$sr" = "ext" ] || continue | ||
FSDIFFCONFS[$fw-$VERSION]=$conf | ||
done | ||
|
||
for fsdiffconf in "${!FSDIFFCONFS[@]}"; do # "in FSDIFFCONFS.keys" | ||
IFS=- read fw version < <(echo "$conf") | ||
# get ref data for install | ||
run_pytest \ | ||
--hosts="cache://install.test::Nested::boot_inst[$fw-$version-host1-iso-ext]-vm1-$GITREV" \ | ||
--log-file=test-fsdiffref-$conf.log \ | ||
tests/fs-diff/test_fsdiff_ref.py::test_fsdiff_mkref | ||
done | ||
|
||
report_failures |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import logging | ||
import os | ||
import pytest | ||
import subprocess | ||
|
||
from lib.commands import local_cmd | ||
|
||
# Requirements: | ||
# - 1 XCP-ng host | ||
|
||
MYDIR = os.path.dirname(__file__) | ||
REF_DIR = os.path.join(MYDIR, "data") | ||
FSDIFF = os.path.realpath(f"{MYDIR}/../../scripts/xcpng-fs-diff.py") | ||
|
||
def _ref_name(host): | ||
return f"{host.inventory['PRODUCT_VERSION']}-{host.firmware_type()}" | ||
|
||
# FIXME: not a test, rather a task done on a given (cached) host | ||
def test_fsdiff_mkref(hosts): | ||
host, = hosts | ||
|
||
logging.info("Extracting reference data from %s", host.hostname_or_ip) | ||
process = local_cmd([FSDIFF, | ||
"--reference-host", host.hostname_or_ip, | ||
"--save-reference", os.path.join(REF_DIR, _ref_name(host)), | ||
]) | ||
|
||
def test_fsdiff_against_ref(hosts): | ||
host, = hosts | ||
|
||
ref_file = os.path.join(REF_DIR, _ref_name(host)) | ||
logging.info("Comparing %s with reference data", host.hostname_or_ip) | ||
process = local_cmd([FSDIFF, | ||
"--load-reference", ref_dir, | ||
"--test-host", host.hostname_or_ip, | ||
]) |