Browse code

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

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit f3be6b346f5300150dfa1de927880ea84440bb5b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2019/08/12 03:32:49
Showing 2 changed files
... ...
@@ -308,6 +308,11 @@ pipeline {
308 308
                                 exit $c
309 309
                                 '''
310 310
                             }
311
+                            post {
312
+                                always {
313
+                                    junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
314
+                                }
315
+                            }
311 316
                         }
312 317
                     }
313 318
 
... ...
@@ -328,7 +333,7 @@ pipeline {
328 328
                                 bundleName=amd64
329 329
                                 echo "Creating ${bundleName}-bundles.tar.gz"
330 330
                                 # exclude overlay2 directories
331
-                                find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*.log' -o -name '*.prof' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
331
+                                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
332 332
                                 '''
333 333
 
334 334
                                 archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
... ...
@@ -405,6 +410,11 @@ pipeline {
405 405
                                     test-integration
406 406
                                 '''
407 407
                             }
408
+                            post {
409
+                                always {
410
+                                    junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
411
+                                }
412
+                            }
408 413
                         }
409 414
                     }
410 415
 
... ...
@@ -425,7 +435,7 @@ pipeline {
425 425
                                 bundleName=s390x-integration
426 426
                                 echo "Creating ${bundleName}-bundles.tar.gz"
427 427
                                 # exclude overlay2 directories
428
-                                find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*.log' -o -name '*.prof' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
428
+                                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
429 429
                                 '''
430 430
 
431 431
                                 archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
... ...
@@ -483,6 +493,11 @@ pipeline {
483 483
                                     test-integration
484 484
                                 '''
485 485
                             }
486
+                            post {
487
+                                always {
488
+                                    junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
489
+                                }
490
+                            }
486 491
                         }
487 492
                     }
488 493
 
... ...
@@ -503,7 +518,7 @@ pipeline {
503 503
                                 bundleName=s390x-integration-cli
504 504
                                 echo "Creating ${bundleName}-bundles.tar.gz"
505 505
                                 # exclude overlay2 directories
506
-                                find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*.log' -o -name '*.prof' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
506
+                                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
507 507
                                 '''
508 508
 
509 509
                                 archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
... ...
@@ -578,6 +593,11 @@ pipeline {
578 578
                                     test-integration
579 579
                                 '''
580 580
                             }
581
+                            post {
582
+                                always {
583
+                                    junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
584
+                                }
585
+                            }
581 586
                         }
582 587
                     }
583 588
 
... ...
@@ -598,7 +618,7 @@ pipeline {
598 598
                                 bundleName=ppc64le-integration
599 599
                                 echo "Creating ${bundleName}-bundles.tar.gz"
600 600
                                 # exclude overlay2 directories
601
-                                find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*.log' -o -name '*.prof' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
601
+                                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
602 602
                                 '''
603 603
 
604 604
                                 archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
... ...
@@ -654,6 +674,11 @@ pipeline {
654 654
                                     test-integration
655 655
                                 '''
656 656
                             }
657
+                            post {
658
+                                always {
659
+                                    junit testResults: 'bundles/**/*-report.xml', allowEmptyResults: true
660
+                                }
661
+                            }
657 662
                         }
658 663
                     }
659 664
 
... ...
@@ -676,7 +701,7 @@ pipeline {
676 676
                                 bundleName=ppc64le-integration-cli
677 677
                                 echo "Creating ${bundleName}-bundles.tar.gz"
678 678
                                 # exclude overlay2 directories
679
-                                find bundles -path '*/root/*overlay2' -prune -o -type f \\( -name '*.log' -o -name '*.prof' \\) -print | xargs tar -czf ${bundleName}-bundles.tar.gz
679
+                                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
680 680
                                 '''
681 681
 
682 682
                                 archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
... ...
@@ -73,8 +73,14 @@ run_test_integration_suites() {
73 73
 		if ! (
74 74
 			cd "$dir"
75 75
 			echo "Running $PWD flags=${flags}"
76
+			[ -n "$TESTDEBUG" ] && set -x
76 77
 			# shellcheck disable=SC2086
77
-			test_env ./test.main ${flags}
78
+			test_env gotestsum \
79
+				--format=standard-verbose \
80
+				--jsonfile="${ABS_DEST}/$(basename "$dir")-go-test-report.json" \
81
+				--junitfile="${ABS_DEST}/$(basename "$dir")-junit-report.xml" \
82
+				--raw-command \
83
+				-- go tool test2json ./test.main ${flags}
78 84
 		); then exit 1; fi
79 85
 	done
80 86
 }