From de2975aa238c304197104ddbef3689965f502080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlio=20C=C3=A9sar=20Batista?= Date: Fri, 4 Nov 2022 17:01:35 -0300 Subject: [PATCH 1/2] Add e2ereport script --- ci/e2ereport.sh | 15 +++++++++++++++ e2etests/report/main.go | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100755 ci/e2ereport.sh diff --git a/ci/e2ereport.sh b/ci/e2ereport.sh new file mode 100755 index 000000000..691ad8e46 --- /dev/null +++ b/ci/e2ereport.sh @@ -0,0 +1,15 @@ +#!/bin/sh +set -eu + +export REPORT_OUTPUT="out/e2e_report.html" +rm -f $REPORT_OUTPUT + +FORCE_COLOR=1 DEBUG=1 go run ./e2etests/report/main.go "$@"; + +if [ -z "${NO_OPEN:-}" ]; then + if [ -s "$REPORT_OUTPUT" ]; then + open "$REPORT_OUTPUT" + else + echo "The report is empty" + fi +fi diff --git a/e2etests/report/main.go b/e2etests/report/main.go index ee703125d..ee2890b4c 100644 --- a/e2etests/report/main.go +++ b/e2etests/report/main.go @@ -140,10 +140,10 @@ func main() { Tests: tests, } - path := "e2e_report.html" + path := os.Getenv("REPORT_OUTPUT") f, err := os.Create(path) if err != nil { - panic(err) + panic(fmt.Errorf("Error creating file `%s`. %v", path, err)) } if err := tmpl.Execute(f, tmplData); err != nil { panic(err) From fc98a0560c11ae54415162a70d4a34a8087f7b0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlio=20C=C3=A9sar=20Batista?= Date: Fri, 4 Nov 2022 17:04:26 -0300 Subject: [PATCH 2/2] Fix lint --- e2etests/report/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2etests/report/main.go b/e2etests/report/main.go index ee2890b4c..81ae168d3 100644 --- a/e2etests/report/main.go +++ b/e2etests/report/main.go @@ -143,7 +143,7 @@ func main() { path := os.Getenv("REPORT_OUTPUT") f, err := os.Create(path) if err != nil { - panic(fmt.Errorf("Error creating file `%s`. %v", path, err)) + panic(fmt.Errorf("error creating file `%s`. %v", path, err)) } if err := tmpl.Execute(f, tmplData); err != nil { panic(err)