Browse code

integration: use gotestsum to generate junit.xml and go-test-report.json

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2019/08/12 03:32:49
Showing 2 changed files
... ...
@@ -319,6 +319,11 @@ pipeline {
319 319
                                 exit $c
320 320
                                 '''
321 321
                             }
322
+                            post {
323
+                                always {
324
+                                    junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
325
+                                }
326
+                            }
322 327
                         }
323 328
                     }
324 329
 
... ...
@@ -339,7 +344,7 @@ pipeline {
339 339
                                 bundleName=amd64
340 340
                                 echo "Creating ${bundleName}-bundles.tar.gz"
341 341
                                 # exclude overlay2 directories
342
-                                find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*.log' -o -name '*.prof' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
342
+                                find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*-report.json' -o -name '*.log' -o -name '*.prof' -o -name '*-report.xml' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
343 343
                                 '''
344 344
 
345 345
                                 archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
... ...
@@ -416,6 +421,11 @@ pipeline {
416 416
                                     test-integration
417 417
                                 '''
418 418
                             }
419
+                            post {
420
+                                always {
421
+                                    junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
422
+                                }
423
+                            }
419 424
                         }
420 425
                     }
421 426
 
... ...
@@ -436,7 +446,7 @@ pipeline {
436 436
                                 bundleName=s390x-integration
437 437
                                 echo "Creating ${bundleName}-bundles.tar.gz"
438 438
                                 # exclude overlay2 directories
439
-                                find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*.log' -o -name '*.prof' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
439
+                                find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*-report.json' -o -name '*.log' -o -name '*.prof' -o -name '*-report.xml' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
440 440
                                 '''
441 441
 
442 442
                                 archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
... ...
@@ -494,6 +504,11 @@ pipeline {
494 494
                                     test-integration
495 495
                                 '''
496 496
                             }
497
+                            post {
498
+                                always {
499
+                                    junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
500
+                                }
501
+                            }
497 502
                         }
498 503
                     }
499 504
 
... ...
@@ -514,7 +529,7 @@ pipeline {
514 514
                                 bundleName=s390x-integration-cli
515 515
                                 echo "Creating ${bundleName}-bundles.tar.gz"
516 516
                                 # exclude overlay2 directories
517
-                                find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*.log' -o -name '*.prof' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
517
+                                find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*-report.json' -o -name '*.log' -o -name '*.prof' -o -name '*-report.xml' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
518 518
                                 '''
519 519
 
520 520
                                 archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
... ...
@@ -589,6 +604,11 @@ pipeline {
589 589
                                     test-integration
590 590
                                 '''
591 591
                             }
592
+                            post {
593
+                                always {
594
+                                    junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
595
+                                }
596
+                            }
592 597
                         }
593 598
                     }
594 599
 
... ...
@@ -609,7 +629,7 @@ pipeline {
609 609
                                 bundleName=ppc64le-integration
610 610
                                 echo "Creating ${bundleName}-bundles.tar.gz"
611 611
                                 # exclude overlay2 directories
612
-                                find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*.log' -o -name '*.prof' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
612
+                                find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*-report.json' -o -name '*.log' -o -name '*.prof' -o -name '*-report.xml' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
613 613
                                 '''
614 614
 
615 615
                                 archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
... ...
@@ -665,6 +685,11 @@ pipeline {
665 665
                                     test-integration
666 666
                                 '''
667 667
                             }
668
+                            post {
669
+                                always {
670
+                                    junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
671
+                                }
672
+                            }
668 673
                         }
669 674
                     }
670 675
 
... ...
@@ -685,7 +710,7 @@ pipeline {
685 685
                                 bundleName=ppc64le-integration-cli
686 686
                                 echo "Creating ${bundleName}-bundles.tar.gz"
687 687
                                 # exclude overlay2 directories
688
-                                find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*.log' -o -name '*.prof' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
688
+                                find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*-report.json' -o -name '*.log' -o -name '*.prof' -o -name '*-report.xml' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
689 689
                                 '''
690 690
 
691 691
                                 archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
... ...
@@ -60,8 +60,14 @@ run_test_integration_suites() {
60 60
 		if ! (
61 61
 			cd "$dir"
62 62
 			echo "Running $PWD flags=${flags}"
63
+			[ -n "$TESTDEBUG" ] && set -x
63 64
 			# shellcheck disable=SC2086
64
-			test_env ./test.main ${flags}
65
+			test_env gotestsum \
66
+				--format=standard-verbose \
67
+				--jsonfile="${ABS_DEST}/$(basename "$dir")-go-test-report.json" \
68
+				--junitfile="${ABS_DEST}/$(basename "$dir")-junit-report.xml" \
69
+				--raw-command \
70
+				-- go tool test2json ./test.main ${flags}
65 71
 		); then exit 1; fi
66 72
 	done
67 73
 }