hs-test: remove client app retries 02/41902/4
authorAdrian Villin <[email protected]>
Fri, 6 Dec 2024 09:26:48 +0000 (10:26 +0100)
committerFlorin Coras <[email protected]>
Tue, 10 Dec 2024 05:03:54 +0000 (05:03 +0000)
- simple fix to avoid apps trying to start after a test
  timeout/interrupt

Type: test

Change-Id: I4e6fcbb2bb00c07e35cda1ebf6fcb76a913f7a32
Signed-off-by: Adrian Villin <[email protected]>
extras/hs-test/infra/utils.go

index 761fc17..16a6a8c 100644 (file)
@@ -293,28 +293,18 @@ func (s *HstSuite) StartClientApp(c *Container, cmd string,
        }()
 
        s.Log("starting client app, please wait")
+       cmd2 := exec.Command("/bin/sh", "-c", "docker exec "+c.getEnvVarsAsCliOption()+" "+
+               c.Name+" "+cmd)
+       s.Log(cmd2)
+       o, err := cmd2.CombinedOutput()
 
-       nTries := 0
-       for {
-               // exec.Cmd can only be used once, which is why it's in the loop
-               cmd2 := exec.Command("/bin/sh", "-c", "docker exec "+c.getEnvVarsAsCliOption()+" "+
-                       c.Name+" "+cmd)
-               s.Log(cmd2)
-               o, err := cmd2.CombinedOutput()
-               if err != nil {
-                       s.Log(err)
-                       s.Log(string(o))
-                       if nTries > 5 {
-                               clnRes <- ""
-                               clnCh <- fmt.Errorf("failed to start client app '%s'", err)
-                               s.AssertNil(err, fmt.Sprint(err))
-                               break
-                       }
-                       time.Sleep(1 * time.Second)
-                       nTries++
-               } else {
-                       clnRes <- fmt.Sprintf("Client output: %s", o)
-                       break
-               }
+       if err != nil {
+               s.Log(err)
+               s.Log(string(o))
+               clnRes <- ""
+               clnCh <- fmt.Errorf("failed to start client app '%s'", err)
+               s.AssertNil(err, fmt.Sprint(err))
+       } else {
+               clnRes <- fmt.Sprintf("Client output: %s", o)
        }
 }