aboutsummaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorAdrian Villin <avillin@cisco.com>2024-12-11 09:56:29 +0100
committerFlorin Coras <florin.coras@gmail.com>2024-12-12 19:54:53 +0000
commitf901f13b2cfa7d77dcf610586e19f3ad9e2e945b (patch)
treed4081bb88d7a22ce83905013c7fba9f4f515224c /extras
parent8ae4454bbaf1a2b76536d54d8222bf00ac153241 (diff)
hs-test: added a test counter and time elapsed
- only works when not running in parallel Type: test Change-Id: Iab9881f8a2a93c6ef5129742e3c0ad950f9e5328 Signed-off-by: Adrian Villin <avillin@cisco.com>
Diffstat (limited to 'extras')
-rw-r--r--extras/hs-test/infra/hst_suite.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/extras/hs-test/infra/hst_suite.go b/extras/hs-test/infra/hst_suite.go
index 1e189b62b8f..78cabb3eae9 100644
--- a/extras/hs-test/infra/hst_suite.go
+++ b/extras/hs-test/infra/hst_suite.go
@@ -104,6 +104,19 @@ type StringerStruct struct {
Label string
}
+var testCounter uint16
+var startTime time.Time = time.Now()
+
+func testCounterFunc() {
+ if ParallelTotal.Value.String() != "1" {
+ return
+ }
+ testCounter++
+ fmt.Printf("Test counter: %d\n"+
+ "Time elapsed: %.2fs\n",
+ testCounter, time.Since(startTime).Seconds())
+}
+
// ColorableString for ReportEntry to use
func (s StringerStruct) ColorableString() string {
return fmt.Sprintf("{{red}}%s{{/}}", s.Label)
@@ -233,6 +246,7 @@ func (s *HstSuite) SkipIfUnconfiguring() {
}
func (s *HstSuite) SetupTest() {
+ testCounterFunc()
s.Log("[* TEST SETUP]")
s.StartedContainers = s.StartedContainers[:0]
s.SkipIfUnconfiguring()