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

Commit

Permalink
virtcontainers: Reduce kata_agent test noise
Browse files Browse the repository at this point in the history
We only need to set the agent context before calling into its API.

Fixes: #1211

Signed-off-by: Samuel Ortiz <[email protected]>
  • Loading branch information
Samuel Ortiz committed Feb 5, 2019
1 parent 2093fe6 commit 560902c
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions virtcontainers/kata_agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func TestKataAgentConnect(t *testing.T) {
defer proxy.Stop()

k := &kataAgent{
ctx: context.Background(),
state: KataAgentState{
URL: testKataProxyURL,
},
Expand Down Expand Up @@ -105,6 +106,7 @@ func TestKataAgentDisconnect(t *testing.T) {
defer proxy.Stop()

k := &kataAgent{
ctx: context.Background(),
state: KataAgentState{
URL: testKataProxyURL,
},
Expand Down Expand Up @@ -294,6 +296,7 @@ func TestKataAgentSendReq(t *testing.T) {
defer proxy.Stop()

k := &kataAgent{
ctx: context.Background(),
state: KataAgentState{
URL: testKataProxyURL,
},
Expand Down Expand Up @@ -722,7 +725,8 @@ func TestAgentCreateContainer(t *testing.T) {
assert := assert.New(t)

sandbox := &Sandbox{
id: "foobar",
ctx: context.Background(),
id: "foobar",
config: &SandboxConfig{
ID: "foobar",
HypervisorType: MockHypervisor,
Expand All @@ -736,6 +740,7 @@ func TestAgentCreateContainer(t *testing.T) {
}

container := &Container{
ctx: sandbox.ctx,
id: "barfoo",
sandboxID: "foobar",
sandbox: sandbox,
Expand Down Expand Up @@ -768,6 +773,7 @@ func TestAgentCreateContainer(t *testing.T) {
defer proxy.Stop()

k := &kataAgent{
ctx: context.Background(),
state: KataAgentState{
URL: testKataProxyURL,
},
Expand Down Expand Up @@ -807,6 +813,7 @@ func TestAgentNetworkOperation(t *testing.T) {
defer proxy.Stop()

k := &kataAgent{
ctx: context.Background(),
state: KataAgentState{
URL: testKataProxyURL,
},
Expand All @@ -828,9 +835,14 @@ func TestAgentNetworkOperation(t *testing.T) {
func TestKataAgentSetProxy(t *testing.T) {
assert := assert.New(t)

k := &kataAgent{}
k := &kataAgent{ctx: context.Background()}
p := &kataBuiltInProxy{}
s := &Sandbox{storage: &filesystem{}}
s := &Sandbox{
ctx: context.Background(),
storage: &filesystem{
ctx: context.Background(),
},
}

err := k.setProxy(s, p, 0, "")
assert.Error(err)
Expand Down Expand Up @@ -877,6 +889,7 @@ func TestKataCopyFile(t *testing.T) {
defer proxy.Stop()

k := &kataAgent{
ctx: context.Background(),
state: KataAgentState{
URL: testKataProxyURL,
},
Expand Down

0 comments on commit 560902c

Please sign in to comment.