fix acceptance test compare script & persist

This commit is contained in:
Alex Goodman
2020-07-24 17:41:22 -04:00
parent 578952986f
commit 14ec30aee1
6 changed files with 33 additions and 18 deletions
+5 -4
View File
@@ -28,7 +28,8 @@ class syft:
packages.add(package)
metadata[package.type][package] = Metadata(
metadata=repr(entry["metadata"]), sources=repr(entry["sources"])
# note: the metadata entry is optional
metadata=repr(entry.get("metadata")), sources=repr(entry["sources"])
)
return packages, metadata
@@ -50,7 +51,7 @@ def main(baseline_report, new_report):
) * 100.0
extra_packages = report2_packages - report1_packages
missing_pacakges = report1_packages - report2_packages
missing_packages = report1_packages - report2_packages
report1_metadata_set = set()
for package in report1_packages:
@@ -75,9 +76,9 @@ def main(baseline_report, new_report):
print(" " + repr(package))
print()
if len(missing_pacakges) > 0:
if len(missing_packages) > 0:
print("Missing packages:")
for package in sorted(list(missing_pacakges)):
for package in sorted(list(missing_packages)):
print(" " + repr(package))
print()
+5 -1
View File
@@ -4,6 +4,7 @@ set -eux
DISTDIR=$1
ACC_DIR=$2
TEST_IMAGE=$3
RESULTSDIR=$4
TEST_TYPE=deb
WORK_DIR=`mktemp -d -t "syft-acceptance-test-${TEST_TYPE}-XXXXXX"`
@@ -40,7 +41,10 @@ docker run --rm \
cat ${REPORT} \
"
# keep the generated report around
cp ${REPORT} ${RESULTSDIR}
# compare the results to a known good output
${ACC_DIR}/compare.py \
${GOLDEN_REPORT} \
${REPORT}
${REPORT} | tee ${RESULTSDIR}/acceptance-${TEST_TYPE}.txt
+5 -1
View File
@@ -4,6 +4,7 @@ set -eux
DISTDIR=$1
ACC_DIR=$2
TEST_IMAGE=$3
RESULTSDIR=$4
TEST_IMAGE_TAR=/tmp/image.tar
TEST_TYPE=mac
@@ -37,7 +38,10 @@ ${DISTDIR}/syft_darwin_amd64/syft version -v
${DISTDIR}/syft_darwin_amd64/syft docker-archive://${TEST_IMAGE_TAR} -vv -o json > ${REPORT}
cat ${REPORT}
# keep the generated report around
cp ${REPORT} ${RESULTSDIR}
# compare the results to a known good output
${ACC_DIR}/compare.py \
${GOLDEN_REPORT} \
${REPORT}
${REPORT} | tee ${RESULTSDIR}/acceptance-${TEST_TYPE}.txt
+5 -1
View File
@@ -4,6 +4,7 @@ set -eux
DISTDIR=$1
ACC_DIR=$2
TEST_IMAGE=$3
RESULTSDIR=$4
TEST_TYPE=rpm
WORK_DIR=`mktemp -d -t "syft-acceptance-test-${TEST_TYPE}-XXXXXX"`
@@ -40,7 +41,10 @@ docker run --rm \
cat ${REPORT} \
"
# keep the generated report around
cp ${REPORT} ${RESULTSDIR}
# compare the results to a known good output
${ACC_DIR}/compare.py \
${GOLDEN_REPORT} \
${REPORT}
${REPORT} | tee ${RESULTSDIR}/acceptance-${TEST_TYPE}.txt
File diff suppressed because one or more lines are too long