Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
virtcontainers: Add context when creating tests sandboxes
Browse files Browse the repository at this point in the history
We can use the background context when creating test sandboxes from the
sanbox unit tests. This shuts the "trace called before context set"
erros down.

Fixes: #1048

Signed-off-by: Samuel Ortiz <[email protected]>
  • Loading branch information
Samuel Ortiz committed Dec 18, 2018
1 parent 5d91edd commit f63a18d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions virtcontainers/sandbox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,7 @@ func TestSandboxAttachDevicesVFIO(t *testing.T) {
storage: &filesystem{},
hypervisor: &mockHypervisor{},
devManager: dm,
ctx: context.Background(),
}

containers[c.id].sandbox = &sandbox
Expand Down Expand Up @@ -1565,6 +1566,7 @@ func TestAttachBlockDevice(t *testing.T) {
storage: fs,
hypervisor: hypervisor,
config: sconfig,
ctx: context.Background(),
}

contID := "100"
Expand Down Expand Up @@ -1653,6 +1655,7 @@ func TestPreAddDevice(t *testing.T) {
hypervisor: hypervisor,
config: sconfig,
devManager: dm,
ctx: context.Background(),
}

contID := "100"
Expand Down Expand Up @@ -1743,6 +1746,7 @@ func TestStartNetworkMonitor(t *testing.T) {
networkNS: NetworkNamespace{
NetNsPath: fmt.Sprintf("/proc/%d/task/%d/ns/net", os.Getpid(), unix.Gettid()),
},
ctx: context.Background(),
}

err = s.startNetworkMonitor()
Expand Down

0 comments on commit f63a18d

Please sign in to comment.