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>
This commit is contained in:
Adrian Villin 2024-12-11 09:56:29 +01:00 committed by Florin Coras
parent 8ae4454bba
commit f901f13b2c

View File

@ -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()