descartes-technical-test/scripts/tests.sh

29 lines
783 B
Bash

#!/bin/sh
run_test() {
echo "Running backup on branch main; repo $1 dest $2; num: $3..."
/bin/bash scripts/backup.sh -b main -r $1 -d $2 -n $3
echo
diff -r $2 tests/tests_cases/$3
if test $? -ne 0
then
echo "Test fail"
exit 1
fi
echo "... done"
echo
}
ROOTDIR=$(git rev-parse --show-toplevel)
TMPDIR=$(mktemp -d)
cd ${ROOTDIR}
run_test https://github.com/descartes-underwriting/devops-technical-test-data.git ${TMPDIR}/1 1
run_test https://github.com/descartes-underwriting/devops-technical-test-data.git ${TMPDIR}/2 2
run_test https://github.com/descartes-underwriting/devops-technical-test-data.git ${TMPDIR}/10 10
run_test https://github.com/mycroft/sample-repository.git ${TMPDIR}/test_sample 99
echo "All tests were OK"