summaryrefslogtreecommitdiffstats
path: root/extras/hs-test/container.go
diff options
context:
space:
mode:
Diffstat (limited to 'extras/hs-test/container.go')
-rw-r--r--extras/hs-test/container.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/extras/hs-test/container.go b/extras/hs-test/container.go
new file mode 100644
index 00000000000..3128a8ecdd5
--- /dev/null
+++ b/extras/hs-test/container.go
@@ -0,0 +1,31 @@
+package main
+
+import (
+ "fmt"
+
+ "github.com/edwarnicke/exechelper"
+)
+
+type Container struct {
+ name string
+}
+
+func (c *Container) run() error {
+ if c.name == "" {
+ return fmt.Errorf("create volume failed: container name is blank")
+ }
+
+ exechelper.Run(fmt.Sprintf("mkdir -p /tmp/%s/sync", c.name))
+ syncPath := fmt.Sprintf("-v /tmp/%s/sync:/tmp/sync", c.name)
+ cmd := "docker run --cap-add=all -d --privileged --network host --rm "
+ cmd += syncPath
+ cmd += " --name " + c.name + " hs-test/vpp"
+ fmt.Println(cmd)
+ err := exechelper.Run(cmd)
+ if err != nil {
+ return fmt.Errorf("create volume failed: %s", err)
+ }
+
+ return nil
+}
+