Skip to content

Commit

Permalink
Output junit to ARTIFACTS for testgrid
Browse files Browse the repository at this point in the history
  • Loading branch information
wongma7 committed Aug 13, 2019
1 parent 48f72c9 commit 4298299
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hack/run-e2e-test
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ helm install --name aws-ebs-csi-driver \
# Run the test
go get -u github.com/onsi/ginkgo/ginkgo
export KUBECONFIG=$HOME/.kube/config
ginkgo -p -nodes=$NODES -v --focus="$FOCUS" tests/e2e
ginkgo -p -nodes=$NODES -v --focus="$FOCUS" tests/e2e -- -report-dir=$ARTIFACTS
TEST_PASS=$?

echo "Removing driver"
Expand Down
21 changes: 20 additions & 1 deletion tests/e2e/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,19 @@ limitations under the License.
package e2e

import (
"fmt"
"github.com/onsi/ginkgo/config"
"github.com/onsi/ginkgo/reporters"
"log"
"os"
"path"
"path/filepath"
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"k8s.io/apimachinery/pkg/util/uuid"
"k8s.io/kubernetes/test/e2e/framework"
)

Expand All @@ -39,5 +46,17 @@ func init() {

func TestE2E(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "AWS EBS CSI Driver End-to-End Tests")

// Run tests through the Ginkgo runner with output to console + JUnit for Jenkins
var r []Reporter
if framework.TestContext.ReportDir != "" {
if err := os.MkdirAll(framework.TestContext.ReportDir, 0755); err != nil {
log.Fatalf("Failed creating report directory: %v", err)
} else {
r = append(r, reporters.NewJUnitReporter(path.Join(framework.TestContext.ReportDir, fmt.Sprintf("junit_%v%02d.xml", framework.TestContext.ReportPrefix, config.GinkgoConfig.ParallelNode))))
}
}
log.Printf("Starting e2e run %q on Ginkgo node %d", uuid.NewUUID(), config.GinkgoConfig.ParallelNode) // TODO use framework.RunID like upstream

RunSpecsWithDefaultAndCustomReporters(t, "AWS EBS CSI Driver End-to-End Tests", r)
}

0 comments on commit 4298299

Please sign in to comment.