mirror of
https://github.com/projectatomic/atomic.git
synced 2026-02-05 18:45:01 +01:00
The previous algorithm for comparing files used python's dircmp and is considered to be a shallow comparision. This allowed distinctly small possibilities that two files being compared could be different but not caught. We now use go-mtree to do the comparison. This can emulate the shallow comparison we had before but we can also adding a sha256digest as part of the comparison using the new --keywords option. Also, made slight tweaks to gomtree functions in Atomic.util so we debug and influence the return of JSON data. This solves https://github.com/projectatomic/atomic/issues/761 Closes: #777 Approved by: rhatdan
51 lines
1.4 KiB
Bash
Executable File
51 lines
1.4 KiB
Bash
Executable File
#!/bin/bash -x
|
|
set -euo pipefail
|
|
IFS=$'\n\t'
|
|
GOMTREE='/usr/bin/gomtree'
|
|
|
|
# Test scripts run with PWD=tests/..
|
|
|
|
# The test harness exports some variables into the environment during
|
|
# testing: PYTHONPATH (python module import path
|
|
# WORK_DIR (a directory that is safe to modify)
|
|
# DOCKER (the docker executable location)
|
|
# ATOMIC (an invocation of 'atomic' which measures code coverage)
|
|
# SECRET (a generated sha256 hash inserted into test containers)
|
|
|
|
# In addition, the test harness creates some images for use in testing.
|
|
# See tests/test-images/
|
|
|
|
setup () {
|
|
# Perform setup routines here.
|
|
IMAGE="atomic-test-1"
|
|
id1=`${DOCKER} create ${IMAGE} /bin/true`
|
|
id2=`${DOCKER} create ${IMAGE} rpm -e vim-minimal`
|
|
${DOCKER} start ${id2}
|
|
|
|
}
|
|
|
|
teardown () {
|
|
# Cleanup your test data.
|
|
set +e
|
|
${DOCKER} rm ${id1}
|
|
${DOCKER} rm ${id2}
|
|
set -e
|
|
}
|
|
# Utilize exit traps for cleanup wherever possible. Additional cleanup
|
|
# logic can be added to a "cleanup stack", by cascading function calls
|
|
# within traps. See tests/integration/test_mount.sh for an example.
|
|
trap teardown EXIT
|
|
if [ ! -e ${GOMTREE} ]; then
|
|
exit 77
|
|
fi
|
|
|
|
setup
|
|
|
|
OUTPUT=$(/bin/true)
|
|
|
|
# Test atomic diff for files and RPMs
|
|
${ATOMIC} diff -r -v ${id1} ${id2} 1>/dev/null
|
|
|
|
# Test atomic diff with RPMs and output to json
|
|
${ATOMIC} diff -r --json ${id1} ${id2} 1>/dev/null
|