Update test based on new CRI.

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu 2018-10-05 11:01:20 -07:00
parent 5a2da31351
commit 0580ce45fd
14 changed files with 20 additions and 19 deletions

View File

@ -36,7 +36,7 @@ func TestAdditionalGids(t *testing.T) {
t.Log("Create a sandbox with log directory")
sbConfig := PodSandboxConfig("sandbox", "additional-gids",
WithPodLogDirectory(testPodLogDir))
sb, err := runtimeService.RunPodSandbox(sbConfig)
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
require.NoError(t, err)
defer func() {
assert.NoError(t, runtimeService.StopPodSandbox(sb))

View File

@ -39,7 +39,7 @@ func TestLongContainerLog(t *testing.T) {
sbConfig := PodSandboxConfig("sandbox", "long-container-log",
WithPodLogDirectory(testPodLogDir),
)
sb, err := runtimeService.RunPodSandbox(sbConfig)
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
require.NoError(t, err)
defer func() {
assert.NoError(t, runtimeService.StopPodSandbox(sb))

View File

@ -31,7 +31,7 @@ import (
func TestContainerStats(t *testing.T) {
t.Logf("Create a pod config and run sandbox container")
sbConfig := PodSandboxConfig("sandbox1", "stats")
sb, err := runtimeService.RunPodSandbox(sbConfig)
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
require.NoError(t, err)
defer func() {
assert.NoError(t, runtimeService.StopPodSandbox(sb))
@ -76,7 +76,7 @@ func TestContainerStats(t *testing.T) {
func TestContainerListStats(t *testing.T) {
t.Logf("Create a pod config and run sandbox container")
sbConfig := PodSandboxConfig("running-pod", "statsls")
sb, err := runtimeService.RunPodSandbox(sbConfig)
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
require.NoError(t, err)
defer func() {
assert.NoError(t, runtimeService.StopPodSandbox(sb))
@ -131,7 +131,7 @@ func TestContainerListStats(t *testing.T) {
func TestContainerListStatsWithIdFilter(t *testing.T) {
t.Logf("Create a pod config and run sandbox container")
sbConfig := PodSandboxConfig("running-pod", "statsls")
sb, err := runtimeService.RunPodSandbox(sbConfig)
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
require.NoError(t, err)
defer func() {
assert.NoError(t, runtimeService.StopPodSandbox(sb))
@ -191,7 +191,7 @@ func TestContainerListStatsWithIdFilter(t *testing.T) {
func TestContainerListStatsWithSandboxIdFilter(t *testing.T) {
t.Logf("Create a pod config and run sandbox container")
sbConfig := PodSandboxConfig("running-pod", "statsls")
sb, err := runtimeService.RunPodSandbox(sbConfig)
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
require.NoError(t, err)
defer func() {
assert.NoError(t, runtimeService.StopPodSandbox(sb))
@ -247,7 +247,7 @@ func TestContainerListStatsWithSandboxIdFilter(t *testing.T) {
func TestContainerListStatsWithIdSandboxIdFilter(t *testing.T) {
t.Logf("Create a pod config and run sandbox container")
sbConfig := PodSandboxConfig("running-pod", "statsls")
sb, err := runtimeService.RunPodSandbox(sbConfig)
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
require.NoError(t, err)
defer func() {
assert.NoError(t, runtimeService.StopPodSandbox(sb))

View File

@ -39,7 +39,7 @@ func checkMemoryLimit(t *testing.T, spec *runtimespec.Spec, memLimit int64) {
func TestUpdateContainerResources(t *testing.T) {
t.Log("Create a sandbox")
sbConfig := PodSandboxConfig("sandbox", "update-container-resources")
sb, err := runtimeService.RunPodSandbox(sbConfig)
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
require.NoError(t, err)
defer func() {
assert.NoError(t, runtimeService.StopPodSandbox(sb))

View File

@ -121,7 +121,7 @@ func TestContainerdImage(t *testing.T) {
t.Logf("should be able to start container with the image")
sbConfig := PodSandboxConfig("sandbox", "containerd-image")
sb, err := runtimeService.RunPodSandbox(sbConfig)
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
require.NoError(t, err)
defer func() {
assert.NoError(t, runtimeService.StopPodSandbox(sb))

View File

@ -26,7 +26,7 @@ import (
func TestDuplicateName(t *testing.T) {
t.Logf("Create a sandbox")
sbConfig := PodSandboxConfig("sandbox", "duplicate-name")
sb, err := runtimeService.RunPodSandbox(sbConfig)
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
require.NoError(t, err)
defer func() {
assert.NoError(t, runtimeService.StopPodSandbox(sb))
@ -34,7 +34,7 @@ func TestDuplicateName(t *testing.T) {
}()
t.Logf("Create the sandbox again should fail")
_, err = runtimeService.RunPodSandbox(sbConfig)
_, err = runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
require.Error(t, err)
t.Logf("Create a container")

View File

@ -70,7 +70,7 @@ func TestImageLoad(t *testing.T) {
t.Logf("create a container with the loaded image")
sbConfig := PodSandboxConfig("sandbox", Randomize("image-load"))
sb, err := runtimeService.RunPodSandbox(sbConfig)
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
require.NoError(t, err)
defer func() {
assert.NoError(t, runtimeService.StopPodSandbox(sb))

View File

@ -37,7 +37,7 @@ func TestImageFSInfo(t *testing.T) {
}()
t.Logf("Create a sandbox to make sure there is an active snapshot")
config := PodSandboxConfig("running-pod", "imagefs")
sb, err := runtimeService.RunPodSandbox(config)
sb, err := runtimeService.RunPodSandbox(config, *runtimeHandler)
require.NoError(t, err)
defer func() {
assert.NoError(t, runtimeService.StopPodSandbox(sb))

View File

@ -63,7 +63,7 @@ func TestPodHostnameEnv(t *testing.T) {
opts := append(test.opts, WithPodLogDirectory(testPodLogDir))
t.Log("Create a sandbox with hostname")
sbConfig := PodSandboxConfig("sandbox", "hostname-env", opts...)
sb, err := runtimeService.RunPodSandbox(sbConfig)
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
require.NoError(t, err)
defer func() {
assert.NoError(t, runtimeService.StopPodSandbox(sb))

View File

@ -91,7 +91,7 @@ func TestContainerdRestart(t *testing.T) {
for i := range sandboxes {
s := &sandboxes[i]
sbCfg := PodSandboxConfig(s.name, sandboxNS)
sid, err := runtimeService.RunPodSandbox(sbCfg)
sid, err := runtimeService.RunPodSandbox(sbCfg, *runtimeHandler)
require.NoError(t, err)
defer func() {
// Make sure the sandbox is cleaned up in any case.

View File

@ -31,7 +31,7 @@ func TestSandboxCleanRemove(t *testing.T) {
ctx := context.Background()
t.Logf("Create a sandbox")
sbConfig := PodSandboxConfig("sandbox", "clean-remove")
sb, err := runtimeService.RunPodSandbox(sbConfig)
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
require.NoError(t, err)
defer func() {
// Make sure the sandbox is cleaned up in any case.

View File

@ -58,6 +58,7 @@ var (
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 runtimeHandler = flag.String("runtime-handler", "", "The runtime handler to use in the test.")
func init() {
flag.Parse()

View File

@ -55,7 +55,7 @@ func TestTruncIndex(t *testing.T) {
t.Logf("Create a sandbox")
sbConfig := PodSandboxConfig("sandbox", "truncindex")
sb, err := runtimeService.RunPodSandbox(sbConfig)
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
require.NoError(t, err)
sbTruncIndex := genTruncIndex(sb)
var hasStoppedSandbox bool

View File

@ -35,7 +35,7 @@ func TestVolumeCopyUp(t *testing.T) {
t.Logf("Create a sandbox")
sbConfig := PodSandboxConfig("sandbox", "volume-copy-up")
sb, err := runtimeService.RunPodSandbox(sbConfig)
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
require.NoError(t, err)
defer func() {
assert.NoError(t, runtimeService.StopPodSandbox(sb))
@ -97,7 +97,7 @@ func TestVolumeOwnership(t *testing.T) {
t.Logf("Create a sandbox")
sbConfig := PodSandboxConfig("sandbox", "volume-ownership")
sb, err := runtimeService.RunPodSandbox(sbConfig)
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
require.NoError(t, err)
defer func() {
assert.NoError(t, runtimeService.StopPodSandbox(sb))