mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-17 15:38:00 +00:00
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:
parent
2093fe6bfd
commit
560902c8f1
@ -73,6 +73,7 @@ func TestKataAgentConnect(t *testing.T) {
|
|||||||
defer proxy.Stop()
|
defer proxy.Stop()
|
||||||
|
|
||||||
k := &kataAgent{
|
k := &kataAgent{
|
||||||
|
ctx: context.Background(),
|
||||||
state: KataAgentState{
|
state: KataAgentState{
|
||||||
URL: testKataProxyURL,
|
URL: testKataProxyURL,
|
||||||
},
|
},
|
||||||
@ -105,6 +106,7 @@ func TestKataAgentDisconnect(t *testing.T) {
|
|||||||
defer proxy.Stop()
|
defer proxy.Stop()
|
||||||
|
|
||||||
k := &kataAgent{
|
k := &kataAgent{
|
||||||
|
ctx: context.Background(),
|
||||||
state: KataAgentState{
|
state: KataAgentState{
|
||||||
URL: testKataProxyURL,
|
URL: testKataProxyURL,
|
||||||
},
|
},
|
||||||
@ -294,6 +296,7 @@ func TestKataAgentSendReq(t *testing.T) {
|
|||||||
defer proxy.Stop()
|
defer proxy.Stop()
|
||||||
|
|
||||||
k := &kataAgent{
|
k := &kataAgent{
|
||||||
|
ctx: context.Background(),
|
||||||
state: KataAgentState{
|
state: KataAgentState{
|
||||||
URL: testKataProxyURL,
|
URL: testKataProxyURL,
|
||||||
},
|
},
|
||||||
@ -722,7 +725,8 @@ func TestAgentCreateContainer(t *testing.T) {
|
|||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
sandbox := &Sandbox{
|
sandbox := &Sandbox{
|
||||||
id: "foobar",
|
ctx: context.Background(),
|
||||||
|
id: "foobar",
|
||||||
config: &SandboxConfig{
|
config: &SandboxConfig{
|
||||||
ID: "foobar",
|
ID: "foobar",
|
||||||
HypervisorType: MockHypervisor,
|
HypervisorType: MockHypervisor,
|
||||||
@ -736,6 +740,7 @@ func TestAgentCreateContainer(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
container := &Container{
|
container := &Container{
|
||||||
|
ctx: sandbox.ctx,
|
||||||
id: "barfoo",
|
id: "barfoo",
|
||||||
sandboxID: "foobar",
|
sandboxID: "foobar",
|
||||||
sandbox: sandbox,
|
sandbox: sandbox,
|
||||||
@ -768,6 +773,7 @@ func TestAgentCreateContainer(t *testing.T) {
|
|||||||
defer proxy.Stop()
|
defer proxy.Stop()
|
||||||
|
|
||||||
k := &kataAgent{
|
k := &kataAgent{
|
||||||
|
ctx: context.Background(),
|
||||||
state: KataAgentState{
|
state: KataAgentState{
|
||||||
URL: testKataProxyURL,
|
URL: testKataProxyURL,
|
||||||
},
|
},
|
||||||
@ -807,6 +813,7 @@ func TestAgentNetworkOperation(t *testing.T) {
|
|||||||
defer proxy.Stop()
|
defer proxy.Stop()
|
||||||
|
|
||||||
k := &kataAgent{
|
k := &kataAgent{
|
||||||
|
ctx: context.Background(),
|
||||||
state: KataAgentState{
|
state: KataAgentState{
|
||||||
URL: testKataProxyURL,
|
URL: testKataProxyURL,
|
||||||
},
|
},
|
||||||
@ -828,9 +835,14 @@ func TestAgentNetworkOperation(t *testing.T) {
|
|||||||
func TestKataAgentSetProxy(t *testing.T) {
|
func TestKataAgentSetProxy(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
k := &kataAgent{}
|
k := &kataAgent{ctx: context.Background()}
|
||||||
p := &kataBuiltInProxy{}
|
p := &kataBuiltInProxy{}
|
||||||
s := &Sandbox{storage: &filesystem{}}
|
s := &Sandbox{
|
||||||
|
ctx: context.Background(),
|
||||||
|
storage: &filesystem{
|
||||||
|
ctx: context.Background(),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
err := k.setProxy(s, p, 0, "")
|
err := k.setProxy(s, p, 0, "")
|
||||||
assert.Error(err)
|
assert.Error(err)
|
||||||
@ -877,6 +889,7 @@ func TestKataCopyFile(t *testing.T) {
|
|||||||
defer proxy.Stop()
|
defer proxy.Stop()
|
||||||
|
|
||||||
k := &kataAgent{
|
k := &kataAgent{
|
||||||
|
ctx: context.Background(),
|
||||||
state: KataAgentState{
|
state: KataAgentState{
|
||||||
URL: testKataProxyURL,
|
URL: testKataProxyURL,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user