Update test based on new CRI.
Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
parent
5a2da31351
commit
0580ce45fd
@ -36,7 +36,7 @@ func TestAdditionalGids(t *testing.T) {
|
|||||||
t.Log("Create a sandbox with log directory")
|
t.Log("Create a sandbox with log directory")
|
||||||
sbConfig := PodSandboxConfig("sandbox", "additional-gids",
|
sbConfig := PodSandboxConfig("sandbox", "additional-gids",
|
||||||
WithPodLogDirectory(testPodLogDir))
|
WithPodLogDirectory(testPodLogDir))
|
||||||
sb, err := runtimeService.RunPodSandbox(sbConfig)
|
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer func() {
|
defer func() {
|
||||||
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
||||||
|
@ -39,7 +39,7 @@ func TestLongContainerLog(t *testing.T) {
|
|||||||
sbConfig := PodSandboxConfig("sandbox", "long-container-log",
|
sbConfig := PodSandboxConfig("sandbox", "long-container-log",
|
||||||
WithPodLogDirectory(testPodLogDir),
|
WithPodLogDirectory(testPodLogDir),
|
||||||
)
|
)
|
||||||
sb, err := runtimeService.RunPodSandbox(sbConfig)
|
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer func() {
|
defer func() {
|
||||||
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
||||||
|
@ -31,7 +31,7 @@ import (
|
|||||||
func TestContainerStats(t *testing.T) {
|
func TestContainerStats(t *testing.T) {
|
||||||
t.Logf("Create a pod config and run sandbox container")
|
t.Logf("Create a pod config and run sandbox container")
|
||||||
sbConfig := PodSandboxConfig("sandbox1", "stats")
|
sbConfig := PodSandboxConfig("sandbox1", "stats")
|
||||||
sb, err := runtimeService.RunPodSandbox(sbConfig)
|
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer func() {
|
defer func() {
|
||||||
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
||||||
@ -76,7 +76,7 @@ func TestContainerStats(t *testing.T) {
|
|||||||
func TestContainerListStats(t *testing.T) {
|
func TestContainerListStats(t *testing.T) {
|
||||||
t.Logf("Create a pod config and run sandbox container")
|
t.Logf("Create a pod config and run sandbox container")
|
||||||
sbConfig := PodSandboxConfig("running-pod", "statsls")
|
sbConfig := PodSandboxConfig("running-pod", "statsls")
|
||||||
sb, err := runtimeService.RunPodSandbox(sbConfig)
|
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer func() {
|
defer func() {
|
||||||
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
||||||
@ -131,7 +131,7 @@ func TestContainerListStats(t *testing.T) {
|
|||||||
func TestContainerListStatsWithIdFilter(t *testing.T) {
|
func TestContainerListStatsWithIdFilter(t *testing.T) {
|
||||||
t.Logf("Create a pod config and run sandbox container")
|
t.Logf("Create a pod config and run sandbox container")
|
||||||
sbConfig := PodSandboxConfig("running-pod", "statsls")
|
sbConfig := PodSandboxConfig("running-pod", "statsls")
|
||||||
sb, err := runtimeService.RunPodSandbox(sbConfig)
|
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer func() {
|
defer func() {
|
||||||
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
||||||
@ -191,7 +191,7 @@ func TestContainerListStatsWithIdFilter(t *testing.T) {
|
|||||||
func TestContainerListStatsWithSandboxIdFilter(t *testing.T) {
|
func TestContainerListStatsWithSandboxIdFilter(t *testing.T) {
|
||||||
t.Logf("Create a pod config and run sandbox container")
|
t.Logf("Create a pod config and run sandbox container")
|
||||||
sbConfig := PodSandboxConfig("running-pod", "statsls")
|
sbConfig := PodSandboxConfig("running-pod", "statsls")
|
||||||
sb, err := runtimeService.RunPodSandbox(sbConfig)
|
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer func() {
|
defer func() {
|
||||||
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
||||||
@ -247,7 +247,7 @@ func TestContainerListStatsWithSandboxIdFilter(t *testing.T) {
|
|||||||
func TestContainerListStatsWithIdSandboxIdFilter(t *testing.T) {
|
func TestContainerListStatsWithIdSandboxIdFilter(t *testing.T) {
|
||||||
t.Logf("Create a pod config and run sandbox container")
|
t.Logf("Create a pod config and run sandbox container")
|
||||||
sbConfig := PodSandboxConfig("running-pod", "statsls")
|
sbConfig := PodSandboxConfig("running-pod", "statsls")
|
||||||
sb, err := runtimeService.RunPodSandbox(sbConfig)
|
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer func() {
|
defer func() {
|
||||||
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
||||||
|
@ -39,7 +39,7 @@ func checkMemoryLimit(t *testing.T, spec *runtimespec.Spec, memLimit int64) {
|
|||||||
func TestUpdateContainerResources(t *testing.T) {
|
func TestUpdateContainerResources(t *testing.T) {
|
||||||
t.Log("Create a sandbox")
|
t.Log("Create a sandbox")
|
||||||
sbConfig := PodSandboxConfig("sandbox", "update-container-resources")
|
sbConfig := PodSandboxConfig("sandbox", "update-container-resources")
|
||||||
sb, err := runtimeService.RunPodSandbox(sbConfig)
|
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer func() {
|
defer func() {
|
||||||
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
||||||
|
@ -121,7 +121,7 @@ func TestContainerdImage(t *testing.T) {
|
|||||||
|
|
||||||
t.Logf("should be able to start container with the image")
|
t.Logf("should be able to start container with the image")
|
||||||
sbConfig := PodSandboxConfig("sandbox", "containerd-image")
|
sbConfig := PodSandboxConfig("sandbox", "containerd-image")
|
||||||
sb, err := runtimeService.RunPodSandbox(sbConfig)
|
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer func() {
|
defer func() {
|
||||||
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
||||||
|
@ -26,7 +26,7 @@ import (
|
|||||||
func TestDuplicateName(t *testing.T) {
|
func TestDuplicateName(t *testing.T) {
|
||||||
t.Logf("Create a sandbox")
|
t.Logf("Create a sandbox")
|
||||||
sbConfig := PodSandboxConfig("sandbox", "duplicate-name")
|
sbConfig := PodSandboxConfig("sandbox", "duplicate-name")
|
||||||
sb, err := runtimeService.RunPodSandbox(sbConfig)
|
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer func() {
|
defer func() {
|
||||||
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
||||||
@ -34,7 +34,7 @@ func TestDuplicateName(t *testing.T) {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
t.Logf("Create the sandbox again should fail")
|
t.Logf("Create the sandbox again should fail")
|
||||||
_, err = runtimeService.RunPodSandbox(sbConfig)
|
_, err = runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
|
||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
|
|
||||||
t.Logf("Create a container")
|
t.Logf("Create a container")
|
||||||
|
@ -70,7 +70,7 @@ func TestImageLoad(t *testing.T) {
|
|||||||
|
|
||||||
t.Logf("create a container with the loaded image")
|
t.Logf("create a container with the loaded image")
|
||||||
sbConfig := PodSandboxConfig("sandbox", Randomize("image-load"))
|
sbConfig := PodSandboxConfig("sandbox", Randomize("image-load"))
|
||||||
sb, err := runtimeService.RunPodSandbox(sbConfig)
|
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer func() {
|
defer func() {
|
||||||
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
||||||
|
@ -37,7 +37,7 @@ func TestImageFSInfo(t *testing.T) {
|
|||||||
}()
|
}()
|
||||||
t.Logf("Create a sandbox to make sure there is an active snapshot")
|
t.Logf("Create a sandbox to make sure there is an active snapshot")
|
||||||
config := PodSandboxConfig("running-pod", "imagefs")
|
config := PodSandboxConfig("running-pod", "imagefs")
|
||||||
sb, err := runtimeService.RunPodSandbox(config)
|
sb, err := runtimeService.RunPodSandbox(config, *runtimeHandler)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer func() {
|
defer func() {
|
||||||
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
||||||
|
@ -63,7 +63,7 @@ func TestPodHostnameEnv(t *testing.T) {
|
|||||||
opts := append(test.opts, WithPodLogDirectory(testPodLogDir))
|
opts := append(test.opts, WithPodLogDirectory(testPodLogDir))
|
||||||
t.Log("Create a sandbox with hostname")
|
t.Log("Create a sandbox with hostname")
|
||||||
sbConfig := PodSandboxConfig("sandbox", "hostname-env", opts...)
|
sbConfig := PodSandboxConfig("sandbox", "hostname-env", opts...)
|
||||||
sb, err := runtimeService.RunPodSandbox(sbConfig)
|
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer func() {
|
defer func() {
|
||||||
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
||||||
|
@ -91,7 +91,7 @@ func TestContainerdRestart(t *testing.T) {
|
|||||||
for i := range sandboxes {
|
for i := range sandboxes {
|
||||||
s := &sandboxes[i]
|
s := &sandboxes[i]
|
||||||
sbCfg := PodSandboxConfig(s.name, sandboxNS)
|
sbCfg := PodSandboxConfig(s.name, sandboxNS)
|
||||||
sid, err := runtimeService.RunPodSandbox(sbCfg)
|
sid, err := runtimeService.RunPodSandbox(sbCfg, *runtimeHandler)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer func() {
|
defer func() {
|
||||||
// Make sure the sandbox is cleaned up in any case.
|
// Make sure the sandbox is cleaned up in any case.
|
||||||
|
@ -31,7 +31,7 @@ func TestSandboxCleanRemove(t *testing.T) {
|
|||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
t.Logf("Create a sandbox")
|
t.Logf("Create a sandbox")
|
||||||
sbConfig := PodSandboxConfig("sandbox", "clean-remove")
|
sbConfig := PodSandboxConfig("sandbox", "clean-remove")
|
||||||
sb, err := runtimeService.RunPodSandbox(sbConfig)
|
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer func() {
|
defer func() {
|
||||||
// Make sure the sandbox is cleaned up in any case.
|
// Make sure the sandbox is cleaned up in any case.
|
||||||
|
@ -58,6 +58,7 @@ var (
|
|||||||
|
|
||||||
var criEndpoint = flag.String("cri-endpoint", "unix:///run/containerd/containerd.sock", "The endpoint of cri plugin.")
|
var criEndpoint = flag.String("cri-endpoint", "unix:///run/containerd/containerd.sock", "The endpoint of cri plugin.")
|
||||||
var criRoot = flag.String("cri-root", "/var/lib/containerd/io.containerd.grpc.v1.cri", "The root directory of cri plugin.")
|
var criRoot = flag.String("cri-root", "/var/lib/containerd/io.containerd.grpc.v1.cri", "The root directory of cri plugin.")
|
||||||
|
var runtimeHandler = flag.String("runtime-handler", "", "The runtime handler to use in the test.")
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
@ -55,7 +55,7 @@ func TestTruncIndex(t *testing.T) {
|
|||||||
|
|
||||||
t.Logf("Create a sandbox")
|
t.Logf("Create a sandbox")
|
||||||
sbConfig := PodSandboxConfig("sandbox", "truncindex")
|
sbConfig := PodSandboxConfig("sandbox", "truncindex")
|
||||||
sb, err := runtimeService.RunPodSandbox(sbConfig)
|
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
sbTruncIndex := genTruncIndex(sb)
|
sbTruncIndex := genTruncIndex(sb)
|
||||||
var hasStoppedSandbox bool
|
var hasStoppedSandbox bool
|
||||||
|
@ -35,7 +35,7 @@ func TestVolumeCopyUp(t *testing.T) {
|
|||||||
|
|
||||||
t.Logf("Create a sandbox")
|
t.Logf("Create a sandbox")
|
||||||
sbConfig := PodSandboxConfig("sandbox", "volume-copy-up")
|
sbConfig := PodSandboxConfig("sandbox", "volume-copy-up")
|
||||||
sb, err := runtimeService.RunPodSandbox(sbConfig)
|
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer func() {
|
defer func() {
|
||||||
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
||||||
@ -97,7 +97,7 @@ func TestVolumeOwnership(t *testing.T) {
|
|||||||
|
|
||||||
t.Logf("Create a sandbox")
|
t.Logf("Create a sandbox")
|
||||||
sbConfig := PodSandboxConfig("sandbox", "volume-ownership")
|
sbConfig := PodSandboxConfig("sandbox", "volume-ownership")
|
||||||
sb, err := runtimeService.RunPodSandbox(sbConfig)
|
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer func() {
|
defer func() {
|
||||||
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
||||||
|
Loading…
Reference in New Issue
Block a user