Skip to content

Commit d2b4d8e

Browse files
committed
Interactively prompt to update expected test outputs
1 parent c095954 commit d2b4d8e

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

scripts/test.sh

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# This won't protect us if a user has ~/.kube
55
# Also call helm template with a non existing --kubeconfig while we're at it
66
unset KUBECONFIG
7-
87
target=$1
98
name=$(echo $1 | sed -e s@/@-@g -e s@charts-@@)
109

@@ -34,7 +33,18 @@ function doTest() {
3433
if [ $rc = 0 ]; then
3534
rm -f ${TESTDIR}/.${name}.*
3635
echo "PASS" >&2
37-
else
36+
elif [ -z $GITHUB_ACTIONS ]; then
37+
read -p "Are these changes expected? [y/N] " EXPECTED
38+
case $EXPECTED in
39+
y*|Y*)
40+
echo "Updating ${REFERENCE}"
41+
cp ${OUTPUT} ${REFERENCE}
42+
rc=0
43+
;;
44+
*) ;;
45+
esac
46+
fi
47+
if [ $rc != 0 ]; then
3848
echo "FAIL" >&2
3949
exit $rc
4050
fi
@@ -73,7 +83,18 @@ function doTestCompare() {
7383
if [ $rc = 0 ]; then
7484
rm -f ${TESTDIR}/.${name}.*
7585
echo "PASS" >&2
76-
else
86+
elif [ -z $GITHUB_ACTIONS ]; then
87+
read -p "Are these changes expected? [y/N] " EXPECTED
88+
case $EXPECTED in
89+
y*|Y*)
90+
echo "Updating ${REFERENCE}"
91+
cp ${OUTPUT} ${REFERENCE}
92+
rc=0
93+
;;
94+
*) ;;
95+
esac
96+
fi
97+
if [ $rc != 0 ]; then
7798
echo "FAIL" >&2
7899
exit $rc
79100
fi

0 commit comments

Comments
 (0)