aboutsummaryrefslogtreecommitdiffstats
path: root/extras/hs-test/hst_suite.go
diff options
context:
space:
mode:
authorMaros Ondrejicka <mondreji@cisco.com>2023-02-24 11:26:39 +0100
committerMaros Ondrejicka <mondreji@cisco.com>2023-02-24 18:56:56 +0100
commita2d5262afb0a6a7a0d0d4ce3a78fee94ce05be0c (patch)
tree8197f9e523c89a270ec01683abd53c29006ee94d /extras/hs-test/hst_suite.go
parentad406077afa1138e1a666a120782ebf66b340b30 (diff)
hs-test: store logs
Type: test Signed-off-by: Maros Ondrejicka <mondreji@cisco.com> Change-Id: I50ad5d8c2e5066d8d24f7959aeb534a2f0a6fae0
Diffstat (limited to 'extras/hs-test/hst_suite.go')
-rw-r--r--extras/hs-test/hst_suite.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/extras/hs-test/hst_suite.go b/extras/hs-test/hst_suite.go
index 1180f07036b..01be2efbf3d 100644
--- a/extras/hs-test/hst_suite.go
+++ b/extras/hs-test/hst_suite.go
@@ -5,6 +5,7 @@ import (
"fmt"
"io/ioutil"
"os"
+ "time"
"github.com/edwarnicke/exechelper"
"github.com/stretchr/testify/assert"
@@ -26,6 +27,7 @@ type HstSuite struct {
netConfigs []NetConfig
netInterfaces map[string]NetInterface
addresser *Addresser
+ testIds map[string]string
}
func (s *HstSuite) TearDownSuite() {
@@ -109,6 +111,7 @@ func (s *HstSuite) assertNotEmpty(object interface{}, msgAndArgs ...interface{})
func (s *HstSuite) log(args ...any) {
if *IsVerbose {
+ s.T().Helper()
s.T().Log(args...)
}
}
@@ -245,6 +248,20 @@ func (s *HstSuite) unconfigureNetworkTopology() {
}
}
+func (s *HstSuite) getTestId() string {
+ testName := s.T().Name()
+
+ if s.testIds == nil {
+ s.testIds = map[string]string{}
+ }
+
+ if _, ok := s.testIds[testName]; !ok {
+ s.testIds[testName] = time.Now().Format(time.RFC3339)
+ }
+
+ return s.testIds[testName]
+}
+
type NetworkAddresses struct {
network int
numberOfAddresses int