diff options
Diffstat (limited to 'extras/hs-test/utils.go')
-rw-r--r-- | extras/hs-test/utils.go | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/extras/hs-test/utils.go b/extras/hs-test/utils.go index 4261f4dc2d1..304dd4c241b 100644 --- a/extras/hs-test/utils.go +++ b/extras/hs-test/utils.go @@ -1,25 +1,12 @@ package main import ( - "errors" "fmt" "io" "os" - "os/exec" "strings" - "time" ) -const vclTemplate = `vcl { - app-socket-api %[1]s/var/run/app_ns_sockets/%[2]s - app-scope-global - app-scope-local - namespace-id %[2]s - namespace-secret %[2]s - use-mq-eventfd -} -` - const networkTopologyDir string = "topo-network/" const containerTopologyDir string = "topo-containers/" @@ -42,50 +29,6 @@ type JsonResult struct { StdOutput string } -func startServerApp(running chan error, done chan struct{}, env []string) { - cmd := exec.Command("iperf3", "-4", "-s") - if env != nil { - cmd.Env = env - } - err := cmd.Start() - if err != nil { - msg := fmt.Errorf("failed to start iperf server: %v", err) - running <- msg - return - } - running <- nil - <-done - cmd.Process.Kill() -} - -func startClientApp(ipAddress string, env []string, clnCh chan error, clnRes chan string) { - defer func() { - clnCh <- nil - }() - - nTries := 0 - - for { - cmd := exec.Command("iperf3", "-c", ipAddress, "-u", "-l", "1460", "-b", "10g") - if env != nil { - cmd.Env = env - } - o, err := cmd.CombinedOutput() - if err != nil { - if nTries > 5 { - clnCh <- fmt.Errorf("failed to start client app '%s'.\n%s", err, o) - return - } - time.Sleep(1 * time.Second) - nTries++ - continue - } else { - clnRes <- fmt.Sprintf("Client output: %s", o) - } - break - } -} - func assertFileSize(f1, f2 string) error { fi1, err := os.Stat(f1) if err != nil { @@ -103,36 +46,6 @@ func assertFileSize(f1, f2 string) error { return nil } -func startHttpServer(running chan struct{}, done chan struct{}, addressPort, netNs string) { - cmd := newCommand([]string{"./http_server", addressPort}, netNs) - err := cmd.Start() - if err != nil { - fmt.Println("Failed to start http server") - return - } - running <- struct{}{} - <-done - cmd.Process.Kill() -} - -func startWget(finished chan error, server_ip, port, query, netNs string) { - defer func() { - finished <- errors.New("wget error") - }() - - cmd := newCommand([]string{"wget", "--timeout=10", "--no-proxy", "--tries=5", "-O", "/dev/null", server_ip + ":" + port + "/" + query}, - netNs) - o, err := cmd.CombinedOutput() - if err != nil { - finished <- fmt.Errorf("wget error: '%v\n\n%s'", err, o) - return - } else if !strings.Contains(string(o), "200 OK") { - finished <- fmt.Errorf("wget error: response not 200 OK") - return - } - finished <- nil -} - func (c *Stanza) newStanza(name string) *Stanza { c.append("\n" + name + " {") c.pad += 2 |