mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-22 08:44:25 +01:00
Currently we sometimes pass it as a pointer and other times not. As a result, the view of sandbox across virtcontainers may not be the same and it costs extra memory copy each time we pass it by value. Fix it by ensuring sandbox is always passed by pointers. Fixes: #262 Signed-off-by: Peng Tao <bergwolf@gmail.com>
41 lines
658 B
Go
41 lines
658 B
Go
// Copyright (c) 2017 Intel Corporation
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
package virtcontainers
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestNoProxyStart(t *testing.T) {
|
|
sandbox := &Sandbox{
|
|
agent: newAgent(NoopAgentType),
|
|
}
|
|
|
|
p := &noProxy{}
|
|
|
|
agentURL := "agentURL"
|
|
pid, vmURL, err := p.start(sandbox, proxyParams{agentURL: agentURL})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if vmURL != agentURL {
|
|
t.Fatalf("Got URL %q, expecting %q", vmURL, agentURL)
|
|
}
|
|
|
|
if pid != 0 {
|
|
t.Fatal("Failure since returned PID should be 0")
|
|
}
|
|
}
|
|
|
|
func TestNoProxyStop(t *testing.T) {
|
|
p := &noProxy{}
|
|
|
|
if err := p.stop(&Sandbox{}, 0); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|