Skip to content

Commit

Permalink
Fix TestParallelStdout: Wait for process to terminate (#3200)
Browse files Browse the repository at this point in the history
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
tdmanv and mergify[bot] authored Oct 28, 2024
1 parent 8058758 commit c1a82aa
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pkg/kanx/kanx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (

"google.golang.org/grpc"
. "gopkg.in/check.v1"

"github.com/kanisterio/kanister/pkg/poll"
)

// Hook up gocheck into the "go test" runner.
Expand Down Expand Up @@ -257,9 +259,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 c1a82aa

Please sign in to comment.