aboutsummaryrefslogtreecommitdiffstats
path: root/extras/hs-test/container.go
diff options
context:
space:
mode:
authoradrianvillin <avillin@cisco.com>2024-02-13 06:00:02 -0500
committerFlorin Coras <florin.coras@gmail.com>2024-03-12 16:48:46 +0000
commit28bd8f07d33bdd70c2cac03b70911a9069e4bd50 (patch)
tree102bab11aa225339995a4dd07ea8332d1fce2212 /extras/hs-test/container.go
parent7a2961523ef6d58d718a9efb7809a212bb0b58b1 (diff)
hs-test: experimental support for multiple test instances
- appending PID to interface and container names - added a check for used IP addresses - TestEnvoyProxyHttpTcp and TestTcpWithLoss are broken when running multiple instances Type: test Change-Id: Ib917079ec7cf851dee59ff9c67e74f48c7c5e3c6 Signed-off-by: adrianvillin <avillin@cisco.com>
Diffstat (limited to 'extras/hs-test/container.go')
-rw-r--r--extras/hs-test/container.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/extras/hs-test/container.go b/extras/hs-test/container.go
index 10b5933b17f..87e8aa38e98 100644
--- a/extras/hs-test/container.go
+++ b/extras/hs-test/container.go
@@ -38,7 +38,7 @@ type Container struct {
vppInstance *VppInstance
}
-func newContainer(suite *HstSuite, yamlInput ContainerConfig) (*Container, error) {
+func newContainer(suite *HstSuite, yamlInput ContainerConfig, pid string) (*Container, error) {
containerName := yamlInput["name"].(string)
if len(containerName) == 0 {
err := fmt.Errorf("container name must not be blank")
@@ -48,7 +48,7 @@ func newContainer(suite *HstSuite, yamlInput ContainerConfig) (*Container, error
var container = new(Container)
container.volumes = make(map[string]Volume)
container.envVars = make(map[string]string)
- container.name = containerName
+ container.name = containerName + pid
container.suite = suite
if image, ok := yamlInput["image"]; ok {
@@ -76,7 +76,7 @@ func newContainer(suite *HstSuite, yamlInput ContainerConfig) (*Container, error
}
if _, ok := yamlInput["volumes"]; ok {
- workingVolumeDir := logDir + container.suite.T().Name() + volumeDir
+ workingVolumeDir := logDir + container.suite.T().Name() + pid + volumeDir
workDirReplacer := strings.NewReplacer("$HST_DIR", workDir)
volDirReplacer := strings.NewReplacer("$HST_VOLUME_DIR", workingVolumeDir)
for _, volu := range yamlInput["volumes"].([]interface{}) {
@@ -249,7 +249,7 @@ func (c *Container) copy(sourceFileName string, targetFileName string) error {
}
func (c *Container) createFile(destFileName string, content string) error {
- f, err := os.CreateTemp("/tmp", "hst-config")
+ f, err := os.CreateTemp("/tmp", "hst-config" + c.suite.pid)
if err != nil {
return err
}