mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-15 14:43:51 +00:00
Merge pull request #1212 from sameo/topic/ut-noise
Reduce virtcontainers unit test noise
This commit is contained in:
commit
d3c63e66e3
@ -16,7 +16,7 @@ func (p *ccProxy) start(params proxyParams) (int, string, error) {
|
|||||||
return -1, "", err
|
return -1, "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
params.logger.Info("Starting cc proxy")
|
params.logger.Debug("Starting cc proxy")
|
||||||
|
|
||||||
// construct the socket path the proxy instance will use
|
// construct the socket path the proxy instance will use
|
||||||
proxyURL, err := defaultProxyURL(params.id, SocketTypeUNIX)
|
proxyURL, err := defaultProxyURL(params.id, SocketTypeUNIX)
|
||||||
|
@ -32,6 +32,7 @@ func TestFilesystemCreateAllResourcesSuccessful(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sandbox := &Sandbox{
|
sandbox := &Sandbox{
|
||||||
|
ctx: context.Background(),
|
||||||
id: testSandboxID,
|
id: testSandboxID,
|
||||||
storage: fs,
|
storage: fs,
|
||||||
config: sandboxConfig,
|
config: sandboxConfig,
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
package virtcontainers
|
package virtcontainers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net"
|
"net"
|
||||||
@ -245,7 +246,9 @@ func TestHyperSetProxy(t *testing.T) {
|
|||||||
|
|
||||||
h := &hyper{}
|
h := &hyper{}
|
||||||
p := &ccProxy{}
|
p := &ccProxy{}
|
||||||
s := &Sandbox{storage: &filesystem{}}
|
s := &Sandbox{
|
||||||
|
storage: &filesystem{ctx: context.Background()},
|
||||||
|
}
|
||||||
|
|
||||||
err := h.setProxy(s, p, 0, "")
|
err := h.setProxy(s, p, 0, "")
|
||||||
assert.Error(err)
|
assert.Error(err)
|
||||||
|
@ -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,
|
||||||
},
|
},
|
||||||
|
@ -52,7 +52,7 @@ func (p *kataBuiltInProxy) start(params proxyParams) (int, string, error) {
|
|||||||
return -1, "", fmt.Errorf("kata builtin proxy running for sandbox %s", params.id)
|
return -1, "", fmt.Errorf("kata builtin proxy running for sandbox %s", params.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
params.logger.Info("Starting builtin kata proxy")
|
params.logger.Debug("Starting builtin kata proxy")
|
||||||
|
|
||||||
p.sandboxID = params.id
|
p.sandboxID = params.id
|
||||||
err := p.watchConsole(buildinProxyConsoleProto, params.consoleURL, params.logger)
|
err := p.watchConsole(buildinProxyConsoleProto, params.consoleURL, params.logger)
|
||||||
|
@ -27,7 +27,7 @@ func (p *kataProxy) start(params proxyParams) (int, string, error) {
|
|||||||
return -1, "", err
|
return -1, "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
params.logger.Info("Starting regular Kata proxy rather than built-in")
|
params.logger.Debug("Starting regular Kata proxy rather than built-in")
|
||||||
|
|
||||||
// construct the socket path the proxy instance will use
|
// construct the socket path the proxy instance will use
|
||||||
proxyURL, err := defaultProxyURL(params.id, SocketTypeUNIX)
|
proxyURL, err := defaultProxyURL(params.id, SocketTypeUNIX)
|
||||||
|
@ -28,7 +28,7 @@ func (p *noProxy) start(params proxyParams) (int, string, error) {
|
|||||||
return -1, "", fmt.Errorf("proxy logger is not set")
|
return -1, "", fmt.Errorf("proxy logger is not set")
|
||||||
}
|
}
|
||||||
|
|
||||||
params.logger.Info("No proxy started because of no-proxy implementation")
|
params.logger.Debug("No proxy started because of no-proxy implementation")
|
||||||
|
|
||||||
if params.agentURL == "" {
|
if params.agentURL == "" {
|
||||||
return -1, "", fmt.Errorf("AgentURL cannot be empty")
|
return -1, "", fmt.Errorf("AgentURL cannot be empty")
|
||||||
|
@ -42,27 +42,6 @@ const (
|
|||||||
SetupRoute = "setuproute"
|
SetupRoute = "setuproute"
|
||||||
)
|
)
|
||||||
|
|
||||||
var codeList = map[int]string{
|
|
||||||
hyper.VersionCode: Version,
|
|
||||||
hyper.StartSandboxCode: StartSandbox,
|
|
||||||
hyper.DestroySandboxCode: DestroySandbox,
|
|
||||||
hyper.ExecCmdCode: ExecCmd,
|
|
||||||
hyper.ReadyCode: Ready,
|
|
||||||
hyper.AckCode: Ack,
|
|
||||||
hyper.ErrorCode: Error,
|
|
||||||
hyper.WinsizeCode: WinSize,
|
|
||||||
hyper.PingCode: Ping,
|
|
||||||
hyper.NextCode: Next,
|
|
||||||
hyper.WriteFileCode: WriteFile,
|
|
||||||
hyper.ReadFileCode: ReadFile,
|
|
||||||
hyper.NewContainerCode: NewContainer,
|
|
||||||
hyper.KillContainerCode: KillContainer,
|
|
||||||
hyper.OnlineCPUMemCode: OnlineCPUMem,
|
|
||||||
hyper.SetupInterfaceCode: SetupInterface,
|
|
||||||
hyper.SetupRouteCode: SetupRoute,
|
|
||||||
hyper.RemoveContainerCode: RemoveContainer,
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hyperstart is an object mocking the hyperstart agent.
|
// Hyperstart is an object mocking the hyperstart agent.
|
||||||
type Hyperstart struct {
|
type Hyperstart struct {
|
||||||
t *testing.T
|
t *testing.T
|
||||||
@ -119,10 +98,6 @@ func (h *Hyperstart) GetLastMessages() []hyper.DecodedMessage {
|
|||||||
return msgs
|
return msgs
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Hyperstart) log(s string) {
|
|
||||||
h.logf("%s\n", s)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *Hyperstart) logf(format string, args ...interface{}) {
|
func (h *Hyperstart) logf(format string, args ...interface{}) {
|
||||||
h.t.Logf("[hyperstart] "+format, args...)
|
h.t.Logf("[hyperstart] "+format, args...)
|
||||||
}
|
}
|
||||||
@ -214,24 +189,13 @@ func (h *Hyperstart) readMessage() (int, []byte, error) {
|
|||||||
return cmd, data, nil
|
return cmd, data, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func cmdToString(cmd int) (string, error) {
|
|
||||||
_, ok := codeList[cmd]
|
|
||||||
if ok == false {
|
|
||||||
return "", fmt.Errorf("unknown command '%d'", cmd)
|
|
||||||
}
|
|
||||||
|
|
||||||
return codeList[cmd], nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *Hyperstart) handleCtl() {
|
func (h *Hyperstart) handleCtl() {
|
||||||
for {
|
for {
|
||||||
cmd, data, err := h.readMessage()
|
cmd, data, err := h.readMessage()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
cmdName, err := cmdToString(cmd)
|
|
||||||
assert.Nil(h.t, err)
|
|
||||||
h.logf("ctl: --> command %s, payload_len=%d\n", cmdName, len(data))
|
|
||||||
if len(data) != 0 {
|
if len(data) != 0 {
|
||||||
h.logData(data)
|
h.logData(data)
|
||||||
}
|
}
|
||||||
@ -244,8 +208,6 @@ func (h *Hyperstart) handleCtl() {
|
|||||||
// answer back with the message exit status
|
// answer back with the message exit status
|
||||||
// XXX: may be interesting to be able to configure the mock
|
// XXX: may be interesting to be able to configure the mock
|
||||||
// hyperstart to fail and test the reaction of proxy/clients
|
// hyperstart to fail and test the reaction of proxy/clients
|
||||||
h.logf("ctl: <-- command %s executed successfully\n", cmdName)
|
|
||||||
|
|
||||||
h.SendMessage(hyper.AckCode, nil)
|
h.SendMessage(hyper.AckCode, nil)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -274,8 +236,6 @@ func (h *Hyperstart) SendIo(seq uint64, data []byte) {
|
|||||||
length := ioHeaderSize + len(data)
|
length := ioHeaderSize + len(data)
|
||||||
header := make([]byte, ioHeaderSize)
|
header := make([]byte, ioHeaderSize)
|
||||||
|
|
||||||
h.logf("io: <-- writing %d bytes for seq %d\n", len(data), seq)
|
|
||||||
|
|
||||||
binary.BigEndian.PutUint64(header[:], seq)
|
binary.BigEndian.PutUint64(header[:], seq)
|
||||||
binary.BigEndian.PutUint32(header[8:], uint32(length))
|
binary.BigEndian.PutUint32(header[8:], uint32(length))
|
||||||
h.writeIo(header)
|
h.writeIo(header)
|
||||||
@ -329,15 +289,14 @@ func (h *Hyperstart) startListening(path string, cb acceptCb) *net.UnixListener
|
|||||||
assert.Nil(h.t, err)
|
assert.Nil(h.t, err)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
h.logf("%s: waiting for connection\n", path)
|
|
||||||
c, err := l.Accept()
|
c, err := l.Accept()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
h.logf("%s: Connection failed %s\n", path, err)
|
||||||
cb(nil)
|
cb(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
cb(c)
|
cb(c)
|
||||||
h.logf("%s: accepted connection\n", path)
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
return l
|
return l
|
||||||
@ -346,7 +305,6 @@ func (h *Hyperstart) startListening(path string, cb acceptCb) *net.UnixListener
|
|||||||
// Start will
|
// Start will
|
||||||
// Once finished with the Hyperstart object, Close must be called.
|
// Once finished with the Hyperstart object, Close must be called.
|
||||||
func (h *Hyperstart) Start() {
|
func (h *Hyperstart) Start() {
|
||||||
h.log("start")
|
|
||||||
h.wgConnected.Add(1)
|
h.wgConnected.Add(1)
|
||||||
h.wgConnected.Add(1)
|
h.wgConnected.Add(1)
|
||||||
h.ctlListener = h.startListening(h.ctlSocketPath, func(s net.Conn) {
|
h.ctlListener = h.startListening(h.ctlSocketPath, func(s net.Conn) {
|
||||||
@ -394,6 +352,4 @@ func (h *Hyperstart) Stop() {
|
|||||||
|
|
||||||
os.Remove(h.ctlSocketPath)
|
os.Remove(h.ctlSocketPath)
|
||||||
os.Remove(h.ioSocketPath)
|
os.Remove(h.ioSocketPath)
|
||||||
|
|
||||||
h.log("stopped")
|
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
@ -109,10 +110,9 @@ func connectShimHandler(data []byte, userData interface{}, response *handlerResp
|
|||||||
|
|
||||||
if payload.Token != proxy.token {
|
if payload.Token != proxy.token {
|
||||||
response.SetErrorMsg("Invalid Token")
|
response.SetErrorMsg("Invalid Token")
|
||||||
|
proxy.logF("Invalid Token (token=%s)", payload.Token)
|
||||||
}
|
}
|
||||||
|
|
||||||
proxy.logF("ConnectShim(token=%s)", payload.Token)
|
|
||||||
|
|
||||||
response.AddResult("version", api.Version)
|
response.AddResult("version", api.Version)
|
||||||
proxy.ShimConnected <- true
|
proxy.ShimConnected <- true
|
||||||
}
|
}
|
||||||
@ -125,8 +125,6 @@ func signalShimHandler(data []byte, userData interface{}, response *handlerRespo
|
|||||||
err := json.Unmarshal(data, &signalPayload)
|
err := json.Unmarshal(data, &signalPayload)
|
||||||
assert.Nil(proxy.t, err)
|
assert.Nil(proxy.t, err)
|
||||||
|
|
||||||
proxy.logF("CCProxyMock received signal: %v", signalPayload)
|
|
||||||
|
|
||||||
proxy.Signal <- signalPayload
|
proxy.Signal <- signalPayload
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +132,6 @@ func disconnectShimHandler(data []byte, userData interface{}, response *handlerR
|
|||||||
client := userData.(*client)
|
client := userData.(*client)
|
||||||
proxy := client.proxy
|
proxy := client.proxy
|
||||||
|
|
||||||
proxy.log("Client sent DisconnectShim Command")
|
|
||||||
proxy.ShimDisconnected <- true
|
proxy.ShimDisconnected <- true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,10 +147,9 @@ func registerVMHandler(data []byte, userData interface{}, response *handlerRespo
|
|||||||
client := userData.(*client)
|
client := userData.(*client)
|
||||||
proxy := client.proxy
|
proxy := client.proxy
|
||||||
|
|
||||||
proxy.log("Register VM")
|
|
||||||
|
|
||||||
payload := api.RegisterVM{}
|
payload := api.RegisterVM{}
|
||||||
if err := json.Unmarshal(data, &payload); err != nil {
|
if err := json.Unmarshal(data, &payload); err != nil {
|
||||||
|
proxy.logF("Register VM failed (%s)", err)
|
||||||
response.SetError(err)
|
response.SetError(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -172,20 +168,15 @@ func registerVMHandler(data []byte, userData interface{}, response *handlerRespo
|
|||||||
}
|
}
|
||||||
|
|
||||||
func unregisterVMHandler(data []byte, userData interface{}, response *handlerResponse) {
|
func unregisterVMHandler(data []byte, userData interface{}, response *handlerResponse) {
|
||||||
client := userData.(*client)
|
|
||||||
proxy := client.proxy
|
|
||||||
|
|
||||||
proxy.log("Unregister VM")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func attachVMHandler(data []byte, userData interface{}, response *handlerResponse) {
|
func attachVMHandler(data []byte, userData interface{}, response *handlerResponse) {
|
||||||
client := userData.(*client)
|
client := userData.(*client)
|
||||||
proxy := client.proxy
|
proxy := client.proxy
|
||||||
|
|
||||||
proxy.log("Attach VM")
|
|
||||||
|
|
||||||
payload := api.AttachVM{}
|
payload := api.AttachVM{}
|
||||||
if err := json.Unmarshal(data, &payload); err != nil {
|
if err := json.Unmarshal(data, &payload); err != nil {
|
||||||
|
proxy.logF("Attach VM failed (%s)", err)
|
||||||
response.SetError(err)
|
response.SetError(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -204,11 +195,6 @@ func attachVMHandler(data []byte, userData interface{}, response *handlerRespons
|
|||||||
}
|
}
|
||||||
|
|
||||||
func hyperCmdHandler(data []byte, userData interface{}, response *handlerResponse) {
|
func hyperCmdHandler(data []byte, userData interface{}, response *handlerResponse) {
|
||||||
client := userData.(*client)
|
|
||||||
proxy := client.proxy
|
|
||||||
|
|
||||||
proxy.log("Hyper command")
|
|
||||||
|
|
||||||
response.SetData([]byte{})
|
response.SetData([]byte{})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,8 +221,6 @@ func (proxy *CCProxyMock) startListening() {
|
|||||||
l, err := net.ListenUnix("unix", &net.UnixAddr{Name: proxy.connectionPath, Net: "unix"})
|
l, err := net.ListenUnix("unix", &net.UnixAddr{Name: proxy.connectionPath, Net: "unix"})
|
||||||
assert.Nil(proxy.t, err)
|
assert.Nil(proxy.t, err)
|
||||||
|
|
||||||
proxy.logF("listening on %s", proxy.connectionPath)
|
|
||||||
|
|
||||||
proxy.listener = l
|
proxy.listener = l
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,11 +229,11 @@ func (proxy *CCProxyMock) serveClient(proto *ccProxyProtocol, newConn net.Conn)
|
|||||||
proxy: proxy,
|
proxy: proxy,
|
||||||
conn: newConn,
|
conn: newConn,
|
||||||
}
|
}
|
||||||
err := proto.Serve(newConn, newClient)
|
if err := proto.Serve(newConn, newClient); err != nil && err != io.EOF {
|
||||||
proxy.logF("Error serving client : %v\n", err)
|
proxy.logF("Error serving client : %v\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
newConn.Close()
|
newConn.Close()
|
||||||
proxy.log("Client closed connection")
|
|
||||||
|
|
||||||
proxy.wg.Done()
|
proxy.wg.Done()
|
||||||
}
|
}
|
||||||
@ -281,7 +265,6 @@ func (proxy *CCProxyMock) serve() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert.NotNil(proxy.t, conn)
|
assert.NotNil(proxy.t, conn)
|
||||||
proxy.log("Client connected")
|
|
||||||
|
|
||||||
proxy.wg.Add(1)
|
proxy.wg.Add(1)
|
||||||
|
|
||||||
@ -319,7 +302,6 @@ func (proxy *CCProxyMock) Stop() {
|
|||||||
proxy.listener.Close()
|
proxy.listener.Close()
|
||||||
|
|
||||||
if proxy.cl != nil {
|
if proxy.cl != nil {
|
||||||
proxy.log("Closing client connection")
|
|
||||||
proxy.cl.Close()
|
proxy.cl.Close()
|
||||||
proxy.cl = nil
|
proxy.cl = nil
|
||||||
} else {
|
} else {
|
||||||
@ -332,7 +314,6 @@ func (proxy *CCProxyMock) Stop() {
|
|||||||
close(proxy.ShimDisconnected)
|
close(proxy.ShimDisconnected)
|
||||||
close(proxy.StdinReceived)
|
close(proxy.StdinReceived)
|
||||||
os.Remove(proxy.connectionPath)
|
os.Remove(proxy.connectionPath)
|
||||||
proxy.log("Stopped")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: could do with its own package to remove that ugly namespacing
|
// XXX: could do with its own package to remove that ugly namespacing
|
||||||
|
@ -200,6 +200,7 @@ func TestQemuMemoryTopology(t *testing.T) {
|
|||||||
|
|
||||||
func testQemuAddDevice(t *testing.T, devInfo interface{}, devType deviceType, expected []govmmQemu.Device) {
|
func testQemuAddDevice(t *testing.T, devInfo interface{}, devType deviceType, expected []govmmQemu.Device) {
|
||||||
q := &qemu{
|
q := &qemu{
|
||||||
|
ctx: context.Background(),
|
||||||
arch: &qemuArchBase{},
|
arch: &qemuArchBase{},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,7 +287,9 @@ func TestQemuAddDeviceKataVSOCK(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestQemuGetSandboxConsole(t *testing.T) {
|
func TestQemuGetSandboxConsole(t *testing.T) {
|
||||||
q := &qemu{}
|
q := &qemu{
|
||||||
|
ctx: context.Background(),
|
||||||
|
}
|
||||||
sandboxID := "testSandboxID"
|
sandboxID := "testSandboxID"
|
||||||
expected := filepath.Join(RunVMStoragePath, sandboxID, consoleSocket)
|
expected := filepath.Join(RunVMStoragePath, sandboxID, consoleSocket)
|
||||||
|
|
||||||
@ -302,6 +305,7 @@ func TestQemuGetSandboxConsole(t *testing.T) {
|
|||||||
|
|
||||||
func TestQemuCapabilities(t *testing.T) {
|
func TestQemuCapabilities(t *testing.T) {
|
||||||
q := &qemu{
|
q := &qemu{
|
||||||
|
ctx: context.Background(),
|
||||||
arch: &qemuArchBase{},
|
arch: &qemuArchBase{},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,6 +369,7 @@ func TestHotplugUnsupportedDeviceType(t *testing.T) {
|
|||||||
qemuConfig := newQemuConfig()
|
qemuConfig := newQemuConfig()
|
||||||
fs := &filesystem{}
|
fs := &filesystem{}
|
||||||
q := &qemu{
|
q := &qemu{
|
||||||
|
ctx: context.Background(),
|
||||||
config: qemuConfig,
|
config: qemuConfig,
|
||||||
storage: fs,
|
storage: fs,
|
||||||
}
|
}
|
||||||
@ -394,6 +399,7 @@ func TestQemuCleanup(t *testing.T) {
|
|||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
q := &qemu{
|
q := &qemu{
|
||||||
|
ctx: context.Background(),
|
||||||
config: newQemuConfig(),
|
config: newQemuConfig(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1759,7 +1759,10 @@ func TestStartNetworkMonitor(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSandboxStopStopped(t *testing.T) {
|
func TestSandboxStopStopped(t *testing.T) {
|
||||||
s := &Sandbox{state: types.State{State: types.StateStopped}}
|
s := &Sandbox{
|
||||||
|
ctx: context.Background(),
|
||||||
|
state: types.State{State: types.StateStopped},
|
||||||
|
}
|
||||||
err := s.Stop()
|
err := s.Stop()
|
||||||
|
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user