@@ -388,6 +388,29 @@ func getRealJUnitFailure() []byte {
388388</testsuite>` )
389389}
390390
391+ func getRealJUnitFailureWithTestSuitesTag () []byte {
392+ return []byte (`<?xml version="1.0" encoding="UTF-8"?>
393+ <testsuites>
394+ <testsuite tests="52" failures="2" time="374.434" name="k8s.io/kubernetes/test/integration">
395+ <properties>
396+ <property name="go.version" value="go1.6.2"></property>
397+ </properties>
398+ <testcase classname="integration" name="TestMasterProcessMetrics" time="0.070"></testcase>
399+ <testcase classname="integration" name="TestApiserverMetrics" time="0.070"></testcase>
400+ <testcase classname="integration" name="TestMasterExportsSymbols" time="0.000"></testcase>
401+ <testcase classname="integration" name="TestPersistentVolumeRecycler" time="20.460"></testcase>
402+ <testcase classname="integration" name="TestPersistentVolumeMultiPVs" time="10.240">
403+ <failure message="Failed" type="">persistent_volumes_test.go:254: volumes created
persistent_volumes_test.go:260: claim created
persistent_volumes_test.go:264: volume bound
persistent_volumes_test.go:266: claim bound
persistent_volumes_test.go:284: Bind mismatch! Expected pvc-2 capacity 50000000000 but got fake-pvc-72 capacity 5000000000</failure>
404+ </testcase>
405+ <testcase classname="integration" name="TestPersistentVolumeMultiPVsPVCs" time="3.370">
406+ <failure message="Failed" type="">persistent_volumes_test.go:379: PVC "pvc-0" is not bound</failure>
407+ </testcase>
408+ <testcase classname="integration" name="TestPersistentVolumeMultiPVsDiffAccessModes" time="10.110"></testcase>
409+ </testsuite>
410+ </testsuites>
411+ ` )
412+ }
413+
391414func TestCheckGCSWeakBuilds (t * testing.T ) {
392415 latestBuildNumberFoo := 42
393416 latestBuildNumberBar := 44
@@ -585,6 +608,7 @@ func TestCheckGCSWeakBuilds(t *testing.T) {
585608}
586609
587610func TestJUnitFailureParse (t * testing.T ) {
611+ //parse junit xml result with <testsuite> as top tag
588612 junitFailReader := bytes .NewReader (getRealJUnitFailure ())
589613 got , err := getJUnitFailures (junitFailReader )
590614 if err != nil {
@@ -597,4 +621,17 @@ func TestJUnitFailureParse(t *testing.T) {
597621 }, got ; ! reflect .DeepEqual (e , a ) {
598622 t .Errorf ("Expected %v, got %v" , e , a )
599623 }
624+
625+ //parse junit xml result with <testsuites> as top tag
626+ junitFailReader = bytes .NewReader (getRealJUnitFailureWithTestSuitesTag ())
627+ got , err = getJUnitFailures (junitFailReader )
628+ if err != nil {
629+ t .Fatalf ("Parse error? %v" , err )
630+ }
631+ if e , a := map [string ]string {
632+ "TestPersistentVolumeMultiPVs {integration}" : "persistent_volumes_test.go:254: volumes created
persistent_volumes_test.go:260: claim created
persistent_volumes_test.go:264: volume bound
persistent_volumes_test.go:266: claim bound
persistent_volumes_test.go:284: Bind mismatch! Expected pvc-2 capacity 50000000000 but got fake-pvc-72 capacity 5000000000" ,
633+ "TestPersistentVolumeMultiPVsPVCs {integration}" : "persistent_volumes_test.go:379: PVC "pvc-0" is not bound" ,
634+ }, got ; reflect .DeepEqual (e , a ) {
635+ t .Errorf ("Expected %v, got %v" , e , a )
636+ }
600637}
0 commit comments