Skip to content

Commit

Permalink
e2e_regression: Fix diffing of symlinks, fix terminal display
Browse files Browse the repository at this point in the history
  • Loading branch information
mitjat committed Jun 16, 2023
1 parent dca1d02 commit 497951e
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions tests/e2e_regression/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ hostname="http://localhost:8008"
# The directory to store the actual responses in
outDir="$SCRIPT_DIR/actual"
mkdir -p "$outDir"
rm "$outDir"/* || true

testCases=(
'status /v1/'
Expand Down Expand Up @@ -121,21 +122,26 @@ done
diff --recursive "$SCRIPT_DIR/expected" "$outDir" >/dev/null || {
echo
echo "NOTE: $SCRIPT_DIR/expected and $outDir differ."
if [[ $- == *i* ]]; then
if [[ -t 1 ]]; then # Running in a terminal
echo "Press enter see the diff, or Ctrl-C to abort."
read -r
git diff --no-index "$SCRIPT_DIR"/{expected,actual} || true
{
# The expected files contain a symlink, which 'git diff' cannot follow (but regular 'diff' can).
# Create a copy of the `expected` dir with the symlink contents materialized; we'll diff against that.
rm -rf /tmp/indexer-e2e-expected; cp -r --dereference "$SCRIPT_DIR/expected" /tmp/indexer-e2e-expected;
}
git diff --no-index /tmp/indexer-e2e-expected "$SCRIPT_DIR/actual" || true
echo
echo "To re-view the diff, run:"
echo " git diff --no-index $SCRIPT_DIR/{expected,actual}"
echo
echo "If the new results are expected, re-run this script after copying the new results into .../expected:"
echo " make accept-e2e-regression"
echo " git diff --no-index /tmp/indexer-e2e-expected $SCRIPT_DIR/actual"
else
# Running in script mode (likely in CI)
# Running outside a terminal (likely in CI)
echo "CI diff:"
git diff --no-index "$SCRIPT_DIR"/{expected,actual} || true
fi
echo
echo "If the new results are expected, copy the new results into .../expected:"
echo " make accept-e2e-regression"
exit 1
}

Expand Down

0 comments on commit 497951e

Please sign in to comment.