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 <sameo@linux.intel.com>
This commit is contained in:
Samuel Ortiz 2019-02-05 11:59:50 +01:00
parent 2093fe6bfd
commit 560902c8f1

View File

@ -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,
},