cloudapi/test: properly end depsolving goroutine when cancel is called
Previously, the goroutine was never stopped because it was all the time calling RequestJob that returned a TimeoutError. Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
parent
00ea3eb285
commit
fb87759aa7
1 changed files with 6 additions and 1 deletions
|
|
@ -45,7 +45,12 @@ func newV2Server(t *testing.T, dir string, depsolveChannels []string, enableJWT
|
|||
depsolveContext, cancel := context.WithCancel(context.Background())
|
||||
go func() {
|
||||
for {
|
||||
_, token, _, _, _, err := workerServer.RequestJob(context.Background(), test_distro.TestDistroName, []string{"depsolve"}, depsolveChannels)
|
||||
_, token, _, _, _, err := workerServer.RequestJob(depsolveContext, test_distro.TestDistroName, []string{"depsolve"}, depsolveChannels)
|
||||
select {
|
||||
case <-depsolveContext.Done():
|
||||
return
|
||||
default:
|
||||
}
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue