aboutsummaryrefslogtreecommitdiffstats
path: root/extras/hs-test/framework_test.go
diff options
context:
space:
mode:
authorMaros Ondrejicka <maros.ondrejicka@pantheon.tech>2022-12-06 19:46:24 +0100
committerFlorin Coras <florin.coras@gmail.com>2022-12-06 20:06:35 +0000
commit0e79abbe2e4183fe32400bdfcbe0465a8f536ea1 (patch)
tree3ee302f5c4d645e9473a2d537f89ca3882aedc51 /extras/hs-test/framework_test.go
parent5b746319d84854f942a48f0fb48a0f02af57f420 (diff)
hs-test: manage containers and volumes within test suite
Type: test Signed-off-by: Maros Ondrejicka <maros.ondrejicka@pantheon.tech> Change-Id: I614111814af5a99dcaa22c8581ea2d339572ae1c
Diffstat (limited to 'extras/hs-test/framework_test.go')
-rwxr-xr-xextras/hs-test/framework_test.go21
1 files changed, 16 insertions, 5 deletions
diff --git a/extras/hs-test/framework_test.go b/extras/hs-test/framework_test.go
index fc186f35180..cfc38011ed5 100755
--- a/extras/hs-test/framework_test.go
+++ b/extras/hs-test/framework_test.go
@@ -13,7 +13,7 @@ import (
type HstSuite struct {
suite.Suite
teardownSuite func()
- containers []string
+ containers []*Container
volumes []string
}
@@ -56,17 +56,28 @@ func (s *HstSuite) NewContainer(name string) (*Container, error) {
return nil, fmt.Errorf("creating container failed: name must not be blank")
}
- s.containers = append(s.containers, name)
-
container := new(Container)
container.name = name
+
+ s.containers = append(s.containers, container)
+
return container, nil
}
func (s *HstSuite) StopContainers() {
- for _, containerName := range s.containers {
- exechelper.Run("docker stop " + containerName)
+ for _, container := range s.containers {
+ container.stop()
+ }
+}
+
+func (s *HstSuite) NewVolume(name string) error {
+ err := exechelper.Run(fmt.Sprintf("docker volume create --name=%s", name))
+ if err != nil {
+ return err
}
+
+ s.volumes = append(s.volumes, name)
+ return nil
}
func (s *HstSuite) RemoveVolumes() {