forked from kata-containers/kata-containers
-
Notifications
You must be signed in to change notification settings - Fork 4
/
remote_test.go
45 lines (35 loc) · 1 KB
/
remote_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (c) 2023 IBM Corporation
// SPDX-License-Identifier: Apache-2.0
package virtcontainers
import (
"testing"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
"github.com/stretchr/testify/assert"
)
func newRemoteConfig() HypervisorConfig {
return HypervisorConfig{
RemoteHypervisorSocket: "/run/peerpod/hypervisor.sock",
RemoteHypervisorTimeout: 600,
DisableGuestSeLinux: true,
EnableAnnotations: []string{},
}
}
func TestRemoteHypervisorGenerateSocket(t *testing.T) {
assert := assert.New(t)
remoteHypervisor := remoteHypervisor{
config: newRemoteConfig(),
}
id := "sandboxId"
// No socketPath should error
_, err := remoteHypervisor.GenerateSocket(id)
assert.Error(err)
socketPath := "socketPath"
remoteHypervisor.agentSocketPath = socketPath
result, err := remoteHypervisor.GenerateSocket(id)
assert.NoError(err)
expected := types.RemoteSock{
SandboxID: id,
TunnelSocketPath: socketPath,
}
assert.Equal(result, expected)
}