From 94a530b05f1e3c131ba9441a4fa48406248d8f98 Mon Sep 17 00:00:00 2001 From: Djordje Lukic Date: Tue, 30 Jun 2020 18:26:38 +0200 Subject: [PATCH] Make log stream test more readable --- tests/aci-e2e/e2e-aci_test.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/aci-e2e/e2e-aci_test.go b/tests/aci-e2e/e2e-aci_test.go index ba7d4a3c2..d10085d40 100644 --- a/tests/aci-e2e/e2e-aci_test.go +++ b/tests/aci-e2e/e2e-aci_test.go @@ -151,7 +151,9 @@ func (s *E2eACISuite) TestACIBackend() { }) s.T().Run("follow logs from nginx", func(t *testing.T) { - ctx := s.NewDockerCommand("logs", "--follow", testContainerName).WithTimeout(time.NewTimer(5 * time.Second).C) + timeChan := make(chan time.Time) + + ctx := s.NewDockerCommand("logs", "--follow", testContainerName).WithTimeout(timeChan) outChan := make(chan string) go func() { @@ -159,10 +161,11 @@ func (s *E2eACISuite) TestACIBackend() { outChan <- output }() - // Give the `logs --follow` a little time to get the first burst of logs - time.Sleep(1 * time.Second) - s.NewCommand("curl", nginxExposedURL+"/test").ExecOrDie() + // Give the `logs --follow` a little time to get logs of the curl call + time.Sleep(10 * time.Second) + // Trigger a timeout to make ctx.Exec exit + timeChan <- time.Now() output := <-outChan