@@ -366,6 +366,29 @@ func getRealJUnitFailure() []byte {
366366</testsuite>` )
367367}
368368
369+ func getRealJUnitFailureWithTestSuitesTag () []byte {
370+ return []byte (`<?xml version="1.0" encoding="UTF-8"?>
371+ <testsuites>
372+ <testsuite tests="52" failures="2" time="374.434" name="k8s.io/kubernetes/test/integration">
373+ <properties>
374+ <property name="go.version" value="go1.6.2"></property>
375+ </properties>
376+ <testcase classname="integration" name="TestMasterProcessMetrics" time="0.070"></testcase>
377+ <testcase classname="integration" name="TestApiserverMetrics" time="0.070"></testcase>
378+ <testcase classname="integration" name="TestMasterExportsSymbols" time="0.000"></testcase>
379+ <testcase classname="integration" name="TestPersistentVolumeRecycler" time="20.460"></testcase>
380+ <testcase classname="integration" name="TestPersistentVolumeMultiPVs" time="10.240">
381+ <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>
382+ </testcase>
383+ <testcase classname="integration" name="TestPersistentVolumeMultiPVsPVCs" time="3.370">
384+ <failure message="Failed" type="">persistent_volumes_test.go:379: PVC "pvc-0" is not bound</failure>
385+ </testcase>
386+ <testcase classname="integration" name="TestPersistentVolumeMultiPVsDiffAccessModes" time="10.110"></testcase>
387+ </testsuite>
388+ </testsuites>
389+ ` )
390+ }
391+
369392func TestCheckGCSWeakBuilds (t * testing.T ) {
370393 latestBuildNumberFoo := 42
371394 latestBuildNumberBar := 44
@@ -563,6 +586,7 @@ func TestCheckGCSWeakBuilds(t *testing.T) {
563586}
564587
565588func TestJUnitFailureParse (t * testing.T ) {
589+ //parse junit xml result with <testsuite> as top tag
566590 junitFailReader := bytes .NewReader (getRealJUnitFailure ())
567591 got , err := getJUnitFailures (junitFailReader )
568592 if err != nil {
@@ -575,4 +599,17 @@ func TestJUnitFailureParse(t *testing.T) {
575599 }, got ; ! reflect .DeepEqual (e , a ) {
576600 t .Errorf ("Expected %v, got %v" , e , a )
577601 }
602+
603+ //parse junit xml result with <testsuites> as top tag
604+ junitFailReader = bytes .NewReader (getRealJUnitFailureWithTestSuitesTag ())
605+ got , err = getJUnitFailures (junitFailReader )
606+ if err != nil {
607+ t .Fatalf ("Parse error? %v" , err )
608+ }
609+ if e , a := map [string ]string {
610+ "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" ,
611+ "TestPersistentVolumeMultiPVsPVCs {integration}" : "persistent_volumes_test.go:379: PVC "pvc-0" is not bound" ,
612+ }, got ; reflect .DeepEqual (e , a ) {
613+ t .Errorf ("Expected %v, got %v" , e , a )
614+ }
578615}
0 commit comments