daemon/libnetwork/ipams: use t.Context
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
2 files changed
+3
-5
No files matched your search
@@ -1,7 +1,6 @@
|
||||
package defaultipam
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
@@ -1238,7 +1237,7 @@ func TestRequestReleaseAddressDuplicate(t *testing.T) {
|
||||
t.Logf("Random seed: %v", seed)
|
||||
rng := rand.New(rand.NewSource(seed))
|
||||
|
||||
group, ctx := errgroup.WithContext(context.Background())
|
||||
group, ctx := errgroup.WithContext(t.Context())
|
||||
outer:
|
||||
for range 10000 {
|
||||
var c *net.IPNet
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package defaultipam
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/netip"
|
||||
@@ -161,7 +160,7 @@ func allocate(t *testing.T, tctx *testContext, parallel int64) {
|
||||
for {
|
||||
wg.Add(1)
|
||||
go func(id int) {
|
||||
parallelExec.Acquire(context.Background(), 1)
|
||||
parallelExec.Acquire(t.Context(), 1)
|
||||
ip, _, _ := tctx.a.RequestAddress(tctx.pid, nil, tctx.opts)
|
||||
ch <- ip
|
||||
parallelExec.Release(1)
|
||||
@@ -229,7 +228,7 @@ func release(t *testing.T, tctx *testContext, mode releaseMode, parallel int64)
|
||||
group := new(errgroup.Group)
|
||||
for i := range ipIndex {
|
||||
group.Go(func() error {
|
||||
parallelExec.Acquire(context.Background(), 1)
|
||||
parallelExec.Acquire(t.Context(), 1)
|
||||
err := tctx.a.ReleaseAddress(tctx.pid, tctx.ipList[i].IP)
|
||||
if err != nil {
|
||||
return fmt.Errorf("routine %d got %v", id, err)
|
||||
|
||||
Reference in new issue
Block a user