hs-test: refactor test cases from no-topo suite
This converts remaining tests to configation of VPP from test context.
Type: test
Change-Id: I386714f6b290e03d1757c2a033a25fae0340f5d6
Signed-off-by: Maros Ondrejicka <mondreji@cisco.com>
diff --git a/extras/hs-test/container.go b/extras/hs-test/container.go
index cc2d441..8ece8a8 100644
--- a/extras/hs-test/container.go
+++ b/extras/hs-test/container.go
@@ -9,6 +9,10 @@
"github.com/edwarnicke/exechelper"
)
+var (
+ workDir, _ = os.Getwd()
+)
+
type Volume struct {
hostDir string
containerDir string
@@ -114,9 +118,7 @@
}
func (c *Container) getRunCommand() string {
- syncPath := fmt.Sprintf(" -v %s:/tmp/sync", c.getSyncPath())
cmd := "docker run --cap-add=all -d --privileged --network host --rm"
- cmd += syncPath
cmd += c.getVolumesAsCliOption()
cmd += c.getEnvVarsAsCliOption()
cmd += " --name " + c.name + " " + c.image + " " + c.extraRunningArgs
@@ -185,10 +187,6 @@
return cliOption
}
-func (c *Container) getSyncPath() string {
- return fmt.Sprintf("/tmp/%s/sync", c.name)
-}
-
func (c *Container) newVppInstance(additionalConfig ...Stanza) (*VppInstance, error) {
vppConfig := new(VppConfig)
vppConfig.CliSocketFilePath = defaultCliSocketFilePath
@@ -249,30 +247,6 @@
return string(byteOutput)
}
-func (c *Container) execAction(args string) (string, error) {
- syncFile := c.getSyncPath() + "/rc"
- os.Remove(syncFile)
-
- workDir := c.getWorkDirAsCliOption()
- cmd := fmt.Sprintf("docker exec -d %s %s hs-test %s",
- workDir,
- c.name,
- args)
- err := exechelper.Run(cmd)
- if err != nil {
- return "", err
- }
- res, err := waitForSyncFile(syncFile)
- if err != nil {
- return "", fmt.Errorf("failed to read sync file while executing 'hs-test %s': %v", args, err)
- }
- o := res.StdOutput + res.ErrOutput
- if res.Code != 0 {
- return o, fmt.Errorf("cmd resulted in non-zero value %d: %s", res.Code, res.Desc)
- }
- return o, err
-}
-
func (c *Container) stop() error {
if c.vppInstance != nil && c.vppInstance.apiChannel != nil {
c.vppInstance.disconnect()