From 560902c8f119a9ae79669acac606b8a333bfe900 Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Tue, 5 Feb 2019 11:59:50 +0100 Subject: [PATCH] virtcontainers: Reduce kata_agent test noise We only need to set the agent context before calling into its API. Fixes: #1211 Signed-off-by: Samuel Ortiz --- virtcontainers/kata_agent_test.go | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/virtcontainers/kata_agent_test.go b/virtcontainers/kata_agent_test.go index 5ea995a3a..85c849361 100644 --- a/virtcontainers/kata_agent_test.go +++ b/virtcontainers/kata_agent_test.go @@ -73,6 +73,7 @@ func TestKataAgentConnect(t *testing.T) { defer proxy.Stop() k := &kataAgent{ + ctx: context.Background(), state: KataAgentState{ URL: testKataProxyURL, }, @@ -105,6 +106,7 @@ func TestKataAgentDisconnect(t *testing.T) { defer proxy.Stop() k := &kataAgent{ + ctx: context.Background(), state: KataAgentState{ URL: testKataProxyURL, }, @@ -294,6 +296,7 @@ func TestKataAgentSendReq(t *testing.T) { defer proxy.Stop() k := &kataAgent{ + ctx: context.Background(), state: KataAgentState{ URL: testKataProxyURL, }, @@ -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, @@ -736,6 +740,7 @@ func TestAgentCreateContainer(t *testing.T) { } container := &Container{ + ctx: sandbox.ctx, id: "barfoo", sandboxID: "foobar", sandbox: sandbox, @@ -768,6 +773,7 @@ func TestAgentCreateContainer(t *testing.T) { defer proxy.Stop() k := &kataAgent{ + ctx: context.Background(), state: KataAgentState{ URL: testKataProxyURL, }, @@ -807,6 +813,7 @@ func TestAgentNetworkOperation(t *testing.T) { defer proxy.Stop() k := &kataAgent{ + ctx: context.Background(), state: KataAgentState{ URL: testKataProxyURL, }, @@ -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) @@ -877,6 +889,7 @@ func TestKataCopyFile(t *testing.T) { defer proxy.Stop() k := &kataAgent{ + ctx: context.Background(), state: KataAgentState{ URL: testKataProxyURL, },