Skip to content

Commit

Permalink
Merge pull request #340 from wongma7/e2e-artifacts
Browse files Browse the repository at this point in the history
Output junit to ARTIFACTS for testgrid
  • Loading branch information
Cheng Pan authored Aug 13, 2019
2 parents 48f72c9 + 4298299 commit 8d8dc6a
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 8d8dc6a

Please sign in to comment.