mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-04-10 16:56:34 +08:00
optionally compare test result against the serialization fields from an
existing test output from an earlier release
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 [path/to/test/output/dir] [OPTIONAL: path/to/tests/to/skip.txt]"
|
||||
echo "Usage: $0 [path/to/test/output/dir] [OPTIONAL: path/to/tests/to/skip.txt] [OPTIONAL: path/to/existing/test/logdir/]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ if [ $# -lt 1 ]; then
|
||||
fi
|
||||
|
||||
RUN_SCENARIO="blockstack-test-scenario"
|
||||
CHECK_SERIALIZATION="blockstack-test-check-serialization"
|
||||
SCENARIOS_PYTHON="blockstack_integration_tests.scenarios"
|
||||
SCENARIOS="$(BLOCKSTACK_TESTNET=1 python -c "import blockstack_integration_tests; import blockstack_integration_tests.scenarios; print blockstack_integration_tests.scenarios.__path__[0]")"
|
||||
if [ $? -ne 0 ]; then
|
||||
@@ -19,6 +20,7 @@ fi
|
||||
|
||||
OUTPUTS="$1"
|
||||
TESTS_SKIP="$2"
|
||||
EXISTING_LOGS="$3"
|
||||
|
||||
test -d "$OUTPUTS" || mkdir -p "$OUTPUTS"
|
||||
|
||||
@@ -50,16 +52,43 @@ while IFS= read SCENARIO_FILE; do
|
||||
|
||||
RC=$?
|
||||
|
||||
if [ $RC -eq 0 ]; then
|
||||
echo " SUCCESS"
|
||||
rm -rf "$TESTDIR"
|
||||
|
||||
else
|
||||
if [ $RC -ne 0 ]; then
|
||||
# failed
|
||||
echo " FAILURE"
|
||||
mv "$TESTDIR" "$OUTPUTS/$SCENARIO_MODULE_BASE.d"
|
||||
|
||||
# TODO: only exit with option
|
||||
exit 1
|
||||
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
# compare serialized consensus fields with older release
|
||||
EXISTING_LOG="$EXISTING_LOGS/$SCENARIO_MODULE_BASE.log"
|
||||
if [ -f "$EXISTING_LOG" ]; then
|
||||
|
||||
"$CHECK_SERIALIZATION" "$OUTPUTS/$SCENARIO_MODULE_BASE.log" "$EXISTING_LOGS/$SCENARIO_MODULE_BASE.log"
|
||||
RC=$?
|
||||
|
||||
if [ $RC -ne 0 ]; then
|
||||
|
||||
# generated incorrect serialization output
|
||||
echo " (ERROR: mismatched serialization) FAILURE"
|
||||
mv "$TESTDIR" "$OUTPUTS/$SCENARIO_MODULE_BASE.d"
|
||||
|
||||
# TODO: only exit with option
|
||||
exit 1
|
||||
|
||||
continue
|
||||
fi
|
||||
else
|
||||
|
||||
echo -n " (WARN: no existing log) "
|
||||
fi
|
||||
|
||||
echo " SUCCESS"
|
||||
rm -rf "$TESTDIR"
|
||||
fi
|
||||
|
||||
done <<EOF
|
||||
$(ls "$SCENARIOS")
|
||||
|
||||
Reference in New Issue
Block a user