Skip to content

Commit 8aaf739

Browse files
authored
Merge pull request #553 from karlkfi/karl-example-summary
chore: Add example test summary
2 parents 89be53d + 2a111be commit 8aaf739

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,23 @@ prow-presubmit-check: \
1818

1919
.PHONY: prow-presubmit-check-e2e
2020
prow-presubmit-check-e2e: \
21-
test-e2e verify-kapply-e2e
21+
install-column-apt test-e2e verify-kapply-e2e
2222

2323
fix:
2424
go fix ./...
2525

2626
fmt:
2727
go fmt ./...
2828

29+
# Install column (required by verify-kapply-e2e)
30+
# Update is included because the kubekins-e2e container build strips out the package cache.
31+
# In newer versions of debian, column is in the bsdextrautils package,
32+
# but in buster (used by kubekins-e2e) it's in bsdmainutils.
33+
.PHONY: install-column-apt
34+
install-column-apt:
35+
apt-get update
36+
apt-get install -y bsdmainutils
37+
2938
install-stringer:
3039
(which $(GOPATH)/bin/stringer || go install golang.org/x/tools/cmd/[email protected])
3140

hack/testExamplesE2EAgainstKapply.sh

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ GREEN='\033[0;32m'
1111
RED='\033[0;31m'
1212
NC='\033[0m' # No Color
1313

14-
succeeded=0
14+
results=()
1515
failed=0
1616

1717
function run_test() {
@@ -27,19 +27,29 @@ for path in examples/alphaTestExamples/*.md; do
2727
if run_test "${path}"; then
2828
echo
2929
echo -e "${GREEN}Example Test Succeeded: ${test_name}${NC}"
30-
let "succeeded+=1"
30+
results+=("${test_name}\t${GREEN}Succeeded${NC}")
3131
else
3232
echo
3333
echo -e "${RED}Example Test Failed: ${test_name}${NC}"
3434
let "failed+=1"
35+
results+=("${test_name}\t${RED}Failed${NC}")
3536
fi
3637
echo
3738
done
3839

40+
(
41+
echo -e "TEST\tRESULT"
42+
for result in "${results[@]}"; do
43+
echo -e "${result}"
44+
done
45+
) | column -t
46+
47+
echo
48+
3949
if [[ ${failed} -gt 0 ]]; then
40-
echo -e "${RED}Example Tests Complete (succeeded: ${succeeded}, failed: ${failed})${NC}"
50+
echo -e "${RED}Example Tests Failed${NC}"
4151
exit 1
4252
else
43-
echo -e "${GREEN}Example Tests Complete (succeeded: ${succeeded}, failed: ${failed})${NC}"
53+
echo -e "${GREEN}Example Tests Succeeded${NC}"
4454
exit 0
4555
fi

0 commit comments

Comments
 (0)