Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ginkgo/v2 CLI --junit-report flag #395

Merged
merged 1 commit into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions hack/run-e2e-conformance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ if [ $? -ne 0 ]; then
GINKGO_TMP_DIR=$(mktemp -d)
cd $GINKGO_TMP_DIR
go mod init tmp
go install -mod=readonly github.com/onsi/ginkgo/ginkgo@v1.16.5
go install -mod=readonly github.com/onsi/ginkgo/v2/ginkgo@v2.5.0
rm -rf $GINKGO_TMP_DIR
echo "Downloading ginkgo tool"
cd -
fi

GOPATH="${GOPATH:-~/go}"
JUNIT_OUTPUT="${JUNIT_OUTPUT:-/tmp/artifacts/unit_report.xml}"
JUNIT_OUTPUT="${JUNIT_OUTPUT:-/tmp/artifacts}"
export PATH=$PATH:$GOPATH/bin

GOFLAGS=-mod=vendor ginkgo "$SUITE" -- -junit $JUNIT_OUTPUT
GOFLAGS=-mod=vendor ginkgo -output-dir=$JUNIT_OUTPUT --junit-report "unit_report.xml" "$SUITE"
9 changes: 1 addition & 8 deletions test/conformance/test_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,18 @@ import (
)

var (
junitPath *string
dumpOutput *bool
reporterFile string
customReporter *k8sreporter.KubernetesReporter
)

func init() {
junitPath = flag.String("junit", "junit.xml", "the path for the junit format report")
dumpOutput = flag.Bool("dump", false, "dump informations for failed tests")
}

func TestTest(t *testing.T) {
RegisterFailHandler(Fail)

_, reporterConfig := GinkgoConfiguration()
if junitPath != nil {
reporterConfig.JUnitReport = *junitPath
}

reporterFile = os.Getenv("REPORTER_OUTPUT")

clients := testclient.New("")
Expand All @@ -56,7 +49,7 @@ func TestTest(t *testing.T) {
customReporter = k8sreporter.New(clients, os.Stdout)
}

RunSpecs(t, "SRIOV Operator conformance tests", reporterConfig)
RunSpecs(t, "SRIOV Operator conformance tests")
}

var _ = ReportAfterEach(func(sr types.SpecReport) {
Expand Down
9 changes: 1 addition & 8 deletions test/validation/test_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,18 @@ import (
)

var (
junitPath *string
dumpOutput *bool
reporterFile string
customReporter *k8sreporter.KubernetesReporter
)

func init() {
junitPath = flag.String("junit", "junit.xml", "the path for the junit format report")
dumpOutput = flag.Bool("dump", false, "dump informations for failed tests")
}

func TestTest(t *testing.T) {
RegisterFailHandler(Fail)

_, reporterConfig := GinkgoConfiguration()
if junitPath != nil {
reporterConfig.JUnitReport = *junitPath
}

reporterFile = os.Getenv("REPORTER_OUTPUT")

clients := testclient.New("")
Expand All @@ -54,7 +47,7 @@ func TestTest(t *testing.T) {
customReporter = k8sreporter.New(clients, os.Stdout)
}

RunSpecs(t, "SRIOV Operator validation tests", reporterConfig)
RunSpecs(t, "SRIOV Operator validation tests")
}

var _ = ReportAfterEach(func(sr types.SpecReport) {
Expand Down