Skip to content

Commit

Permalink
Fix TestParallelStdout: Wait for process to terminate
Browse files Browse the repository at this point in the history
  • Loading branch information
tdmanv committed Oct 25, 2024
1 parent 227a815 commit a6bfb90
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/kanx/kanx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"testing"
"time"

"github.com/kanisterio/kanister/pkg/poll"
"google.golang.org/grpc"
. "gopkg.in/check.v1"
)
Expand Down Expand Up @@ -257,9 +258,13 @@ func (s *KanXSuite) TestParallelStdout(c *C) {
err = sp.cmd.Process.Kill()
c.Assert(err, IsNil)

ps, err = ListProcesses(ctx, addr)
c.Assert(err, IsNil)
c.Assert(ps, HasLen, 1)
_ = poll.Wait(ctx, func(context.Context) (bool, error) {
ps, err = ListProcesses(ctx, addr)
c.Assert(err, IsNil)
c.Assert(ps, HasLen, 1)
return ps[0].GetState() != ProcessState_PROCESS_STATE_RUNNING, nil
})

c.Assert(ps[0].GetPid(), Equals, p.GetPid())
c.Assert(ps[0].GetState(), Equals, ProcessState_PROCESS_STATE_FAILED)
c.Assert(ps[0].GetExitErr(), Equals, "signal: killed")
Expand Down

0 comments on commit a6bfb90

Please sign in to comment.