Use image lists in client tests
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
parent
db3ecb286b
commit
552d763447
@ -25,6 +25,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/integration/images"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||
@ -38,7 +40,7 @@ func TestAdditionalGids(t *testing.T) {
|
||||
WithPodLogDirectory(testPodLogDir))
|
||||
|
||||
var (
|
||||
testImage = GetImage(BusyBox)
|
||||
testImage = images.Get(images.BusyBox)
|
||||
containerName = "test-container"
|
||||
)
|
||||
|
||||
|
@ -23,6 +23,7 @@ import (
|
||||
"testing"
|
||||
|
||||
. "github.com/containerd/containerd"
|
||||
"github.com/containerd/containerd/integration/images"
|
||||
"github.com/containerd/containerd/platforms"
|
||||
)
|
||||
|
||||
@ -33,8 +34,8 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
testImage = "ghcr.io/containerd/busybox:1.32"
|
||||
testMultiLayeredImage = "ghcr.io/containerd/volume-copy-up:2.1"
|
||||
testImage = images.Get(images.BusyBox)
|
||||
testMultiLayeredImage = images.Get(images.VolumeCopyUp)
|
||||
shortCommand = withProcessArgs("true")
|
||||
longCommand = withProcessArgs("/bin/sh", "-c", "while true; do sleep 1; done")
|
||||
)
|
||||
|
@ -24,6 +24,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/integration/images"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||
@ -38,7 +40,7 @@ func TestContainerLogWithoutTailingNewLine(t *testing.T) {
|
||||
)
|
||||
|
||||
var (
|
||||
testImage = GetImage(BusyBox)
|
||||
testImage = images.Get(images.BusyBox)
|
||||
containerName = "test-container"
|
||||
)
|
||||
|
||||
@ -86,7 +88,7 @@ func TestLongContainerLog(t *testing.T) {
|
||||
)
|
||||
|
||||
var (
|
||||
testImage = GetImage(BusyBox)
|
||||
testImage = images.Get(images.BusyBox)
|
||||
containerName = "test-container"
|
||||
)
|
||||
|
||||
|
@ -19,6 +19,7 @@ package integration
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/containerd/containerd/integration/images"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@ -28,12 +29,12 @@ func TestContainerRestart(t *testing.T) {
|
||||
t.Logf("Create a pod config and run sandbox container")
|
||||
sb, sbConfig := PodSandboxConfigWithCleanup(t, "sandbox1", "restart")
|
||||
|
||||
EnsureImageExists(t, pauseImage)
|
||||
EnsureImageExists(t, images.PauseImage)
|
||||
|
||||
t.Logf("Create a container config and run container in a pod")
|
||||
containerConfig := ContainerConfig(
|
||||
"container1",
|
||||
pauseImage,
|
||||
images.PauseImage,
|
||||
WithTestLabels(),
|
||||
WithTestAnnotations(),
|
||||
)
|
||||
@ -62,12 +63,12 @@ func TestFailedContainerRestart(t *testing.T) {
|
||||
t.Logf("Create a pod config and run sandbox container")
|
||||
sb, sbConfig := PodSandboxConfigWithCleanup(t, "sandbox1", "restart")
|
||||
|
||||
EnsureImageExists(t, pauseImage)
|
||||
EnsureImageExists(t, images.PauseImage)
|
||||
|
||||
t.Logf("Create a container config in a pod with a command that fails")
|
||||
containerConfig := ContainerConfig(
|
||||
"container1",
|
||||
pauseImage,
|
||||
images.PauseImage,
|
||||
WithCommand("something-that-doesnt-exist"),
|
||||
WithTestLabels(),
|
||||
WithTestAnnotations(),
|
||||
@ -88,7 +89,7 @@ func TestFailedContainerRestart(t *testing.T) {
|
||||
|
||||
containerConfig = ContainerConfig(
|
||||
"container1",
|
||||
pauseImage,
|
||||
images.PauseImage,
|
||||
WithTestLabels(),
|
||||
WithTestAnnotations(),
|
||||
)
|
||||
|
@ -23,6 +23,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/integration/images"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||
@ -33,12 +34,12 @@ func TestContainerStats(t *testing.T) {
|
||||
t.Logf("Create a pod config and run sandbox container")
|
||||
sb, sbConfig := PodSandboxConfigWithCleanup(t, "sandbox1", "stats")
|
||||
|
||||
EnsureImageExists(t, pauseImage)
|
||||
EnsureImageExists(t, images.PauseImage)
|
||||
|
||||
t.Logf("Create a container config and run container in a pod")
|
||||
containerConfig := ContainerConfig(
|
||||
"container1",
|
||||
pauseImage,
|
||||
images.PauseImage,
|
||||
WithTestLabels(),
|
||||
WithTestAnnotations(),
|
||||
)
|
||||
@ -74,7 +75,7 @@ func TestContainerConsumedStats(t *testing.T) {
|
||||
t.Logf("Create a pod config and run sandbox container")
|
||||
sb, sbConfig := PodSandboxConfigWithCleanup(t, "sandbox1", "stats")
|
||||
|
||||
testImage := GetImage(ResourceConsumer)
|
||||
testImage := images.Get(images.ResourceConsumer)
|
||||
EnsureImageExists(t, testImage)
|
||||
|
||||
t.Logf("Create a container config and run container in a pod")
|
||||
@ -145,7 +146,7 @@ func TestContainerListStats(t *testing.T) {
|
||||
t.Logf("Create a pod config and run sandbox container")
|
||||
sb, sbConfig := PodSandboxConfigWithCleanup(t, "running-pod", "statsls")
|
||||
|
||||
EnsureImageExists(t, pauseImage)
|
||||
EnsureImageExists(t, images.PauseImage)
|
||||
|
||||
t.Logf("Create a container config and run containers in a pod")
|
||||
containerConfigMap := make(map[string]*runtime.ContainerConfig)
|
||||
@ -153,7 +154,7 @@ func TestContainerListStats(t *testing.T) {
|
||||
cName := fmt.Sprintf("container%d", i)
|
||||
containerConfig := ContainerConfig(
|
||||
cName,
|
||||
pauseImage,
|
||||
images.PauseImage,
|
||||
WithTestLabels(),
|
||||
WithTestAnnotations(),
|
||||
)
|
||||
@ -199,7 +200,7 @@ func TestContainerListStatsWithIdFilter(t *testing.T) {
|
||||
t.Logf("Create a pod config and run sandbox container")
|
||||
sb, sbConfig := PodSandboxConfigWithCleanup(t, "running-pod", "statsls")
|
||||
|
||||
EnsureImageExists(t, pauseImage)
|
||||
EnsureImageExists(t, images.PauseImage)
|
||||
|
||||
t.Logf("Create a container config and run containers in a pod")
|
||||
containerConfigMap := make(map[string]*runtime.ContainerConfig)
|
||||
@ -207,7 +208,7 @@ func TestContainerListStatsWithIdFilter(t *testing.T) {
|
||||
cName := fmt.Sprintf("container%d", i)
|
||||
containerConfig := ContainerConfig(
|
||||
cName,
|
||||
pauseImage,
|
||||
images.PauseImage,
|
||||
WithTestLabels(),
|
||||
WithTestAnnotations(),
|
||||
)
|
||||
@ -258,7 +259,7 @@ func TestContainerListStatsWithSandboxIdFilter(t *testing.T) {
|
||||
t.Logf("Create a pod config and run sandbox container")
|
||||
sb, sbConfig := PodSandboxConfigWithCleanup(t, "running-pod", "statsls")
|
||||
|
||||
EnsureImageExists(t, pauseImage)
|
||||
EnsureImageExists(t, images.PauseImage)
|
||||
|
||||
t.Logf("Create a container config and run containers in a pod")
|
||||
containerConfigMap := make(map[string]*runtime.ContainerConfig)
|
||||
@ -266,7 +267,7 @@ func TestContainerListStatsWithSandboxIdFilter(t *testing.T) {
|
||||
cName := fmt.Sprintf("container%d", i)
|
||||
containerConfig := ContainerConfig(
|
||||
cName,
|
||||
pauseImage,
|
||||
images.PauseImage,
|
||||
WithTestLabels(),
|
||||
WithTestAnnotations(),
|
||||
)
|
||||
@ -318,7 +319,7 @@ func TestContainerListStatsWithIdSandboxIdFilter(t *testing.T) {
|
||||
t.Logf("Create a pod config and run sandbox container")
|
||||
sb, sbConfig := PodSandboxConfigWithCleanup(t, "running-pod", "statsls")
|
||||
|
||||
EnsureImageExists(t, pauseImage)
|
||||
EnsureImageExists(t, images.PauseImage)
|
||||
|
||||
t.Logf("Create container config and run containers in a pod")
|
||||
containerConfigMap := make(map[string]*runtime.ContainerConfig)
|
||||
@ -326,7 +327,7 @@ func TestContainerListStatsWithIdSandboxIdFilter(t *testing.T) {
|
||||
cName := fmt.Sprintf("container%d", i)
|
||||
containerConfig := ContainerConfig(
|
||||
cName,
|
||||
pauseImage,
|
||||
images.PauseImage,
|
||||
WithTestLabels(),
|
||||
WithTestAnnotations(),
|
||||
)
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/integration/images"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||
@ -42,7 +43,7 @@ func TestSharedPidMultiProcessContainerStop(t *testing.T) {
|
||||
}()
|
||||
|
||||
var (
|
||||
testImage = GetImage(BusyBox)
|
||||
testImage = images.Get(images.BusyBox)
|
||||
containerName = "test-container"
|
||||
)
|
||||
|
||||
@ -79,7 +80,7 @@ func TestContainerStopCancellation(t *testing.T) {
|
||||
sb, sbConfig := PodSandboxConfigWithCleanup(t, "sandbox", "cancel-container-stop")
|
||||
|
||||
var (
|
||||
testImage = GetImage(BusyBox)
|
||||
testImage = images.Get(images.BusyBox)
|
||||
containerName = "test-container"
|
||||
)
|
||||
|
||||
|
@ -29,6 +29,7 @@ import (
|
||||
"github.com/containerd/cgroups"
|
||||
cgroupsv2 "github.com/containerd/cgroups/v2"
|
||||
"github.com/containerd/containerd"
|
||||
"github.com/containerd/containerd/integration/images"
|
||||
runtimespec "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
@ -151,7 +152,7 @@ func TestUpdateContainerResources_MemorySwap(t *testing.T) {
|
||||
t.Log("Create a sandbox")
|
||||
sb, sbConfig := PodSandboxConfigWithCleanup(t, "sandbox", "update-container-swap-resources")
|
||||
|
||||
EnsureImageExists(t, pauseImage)
|
||||
EnsureImageExists(t, images.PauseImage)
|
||||
|
||||
memoryLimit := int64(128 * 1024 * 1024)
|
||||
baseSwapLimit := int64(200 * 1024 * 1024)
|
||||
@ -168,7 +169,7 @@ func TestUpdateContainerResources_MemorySwap(t *testing.T) {
|
||||
t.Log("Create a container with memory limit but no swap")
|
||||
cnConfig := ContainerConfig(
|
||||
"container",
|
||||
pauseImage,
|
||||
images.PauseImage,
|
||||
WithResources(&runtime.LinuxContainerResources{
|
||||
MemoryLimitInBytes: memoryLimit,
|
||||
MemorySwapLimitInBytes: baseSwapLimit,
|
||||
@ -223,12 +224,12 @@ func TestUpdateContainerResources_MemoryLimit(t *testing.T) {
|
||||
t.Log("Create a sandbox")
|
||||
sb, sbConfig := PodSandboxConfigWithCleanup(t, "sandbox", "update-container-resources")
|
||||
|
||||
EnsureImageExists(t, pauseImage)
|
||||
EnsureImageExists(t, images.PauseImage)
|
||||
|
||||
t.Log("Create a container with memory limit")
|
||||
cnConfig := ContainerConfig(
|
||||
"container",
|
||||
pauseImage,
|
||||
images.PauseImage,
|
||||
WithResources(&runtime.LinuxContainerResources{
|
||||
MemoryLimitInBytes: 200 * 1024 * 1024,
|
||||
}),
|
||||
|
@ -23,6 +23,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/integration/images"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||
@ -99,7 +100,7 @@ func TestContainerSymlinkVolumes(t *testing.T) {
|
||||
)
|
||||
|
||||
var (
|
||||
testImage = GetImage(BusyBox)
|
||||
testImage = images.Get(images.BusyBox)
|
||||
containerName = "test-container"
|
||||
containerMountPath = "/mounted_file"
|
||||
)
|
||||
|
@ -19,6 +19,7 @@ package integration
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/containerd/containerd/integration/images"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||
@ -30,7 +31,7 @@ func TestContainerLifecycleWithoutImageRef(t *testing.T) {
|
||||
sb, sbConfig := PodSandboxConfigWithCleanup(t, "sandbox", "container-lifecycle-without-image-ref")
|
||||
|
||||
var (
|
||||
testImage = GetImage(BusyBox)
|
||||
testImage = images.Get(images.BusyBox)
|
||||
containerName = "test-container"
|
||||
)
|
||||
|
||||
|
@ -25,6 +25,7 @@ import (
|
||||
|
||||
"github.com/containerd/containerd"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/integration/images"
|
||||
"github.com/containerd/containerd/namespaces"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
@ -33,7 +34,7 @@ import (
|
||||
|
||||
// Test to test the CRI plugin should see image pulled into containerd directly.
|
||||
func TestContainerdImage(t *testing.T) {
|
||||
var testImage = GetImage(BusyBox)
|
||||
var testImage = images.Get(images.BusyBox)
|
||||
ctx := context.Background()
|
||||
|
||||
t.Logf("make sure the test image doesn't exist in the cri plugin")
|
||||
@ -150,7 +151,7 @@ func TestContainerdImage(t *testing.T) {
|
||||
|
||||
// Test image managed by CRI plugin shouldn't be affected by images in other namespaces.
|
||||
func TestContainerdImageInOtherNamespaces(t *testing.T) {
|
||||
var testImage = GetImage(BusyBox)
|
||||
var testImage = images.Get(images.BusyBox)
|
||||
ctx := context.Background()
|
||||
|
||||
t.Logf("make sure the test image doesn't exist in the cri plugin")
|
||||
|
@ -19,6 +19,7 @@ package integration
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/containerd/containerd/integration/images"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@ -30,12 +31,12 @@ func TestDuplicateName(t *testing.T) {
|
||||
_, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
|
||||
require.Error(t, err)
|
||||
|
||||
EnsureImageExists(t, pauseImage)
|
||||
EnsureImageExists(t, images.PauseImage)
|
||||
|
||||
t.Logf("Create a container")
|
||||
cnConfig := ContainerConfig(
|
||||
"container",
|
||||
pauseImage,
|
||||
images.PauseImage,
|
||||
)
|
||||
_, err = runtimeService.CreateContainer(sb, cnConfig, sbConfig)
|
||||
require.NoError(t, err)
|
||||
|
@ -21,6 +21,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/integration/images"
|
||||
"github.com/stretchr/testify/require"
|
||||
exec "golang.org/x/sys/execabs"
|
||||
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||
@ -28,7 +29,7 @@ import (
|
||||
|
||||
// Test to load an image from tarball.
|
||||
func TestImageLoad(t *testing.T) {
|
||||
testImage := GetImage(BusyBox)
|
||||
testImage := images.Get(images.BusyBox)
|
||||
loadedImage := testImage
|
||||
_, err := exec.LookPath("docker")
|
||||
if err != nil {
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/integration/images"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||
@ -32,7 +33,7 @@ func TestImageFSInfo(t *testing.T) {
|
||||
PodSandboxConfigWithCleanup(t, "running-pod", "imagefs")
|
||||
|
||||
t.Logf("Pull an image to make sure image fs is not empty")
|
||||
EnsureImageExists(t, GetImage(BusyBox))
|
||||
EnsureImageExists(t, images.Get(images.BusyBox))
|
||||
|
||||
// It takes time to populate imagefs stats. Use eventually
|
||||
// to check for a period of time.
|
||||
|
@ -14,20 +14,19 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package integration
|
||||
package images
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
cri "github.com/containerd/containerd/integration/cri-api/pkg/apis"
|
||||
"github.com/pelletier/go-toml"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/stretchr/testify/require"
|
||||
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||
)
|
||||
|
||||
var imageListFile = flag.String("image-list", "", "The TOML file containing the non-default images to be used in tests.")
|
||||
|
||||
// ImageList holds public image references
|
||||
type ImageList struct {
|
||||
Alpine string
|
||||
@ -39,12 +38,15 @@ type ImageList struct {
|
||||
}
|
||||
|
||||
var (
|
||||
imageService cri.ImageManagerService
|
||||
imageMap map[int]string
|
||||
imageList ImageList
|
||||
pauseImage string // This is the same with default sandbox image
|
||||
imageMap map[int]string
|
||||
imageList ImageList
|
||||
PauseImage string // This is the same with default sandbox image
|
||||
)
|
||||
|
||||
func init() {
|
||||
initImages(*imageListFile)
|
||||
}
|
||||
|
||||
func initImages(imageListFile string) {
|
||||
imageList = ImageList{
|
||||
Alpine: "docker.io/library/alpine:latest",
|
||||
@ -70,7 +72,7 @@ func initImages(imageListFile string) {
|
||||
logrus.Infof("Using the following image list: %+v", imageList)
|
||||
|
||||
imageMap = initImageMap(imageList)
|
||||
pauseImage = GetImage(Pause)
|
||||
PauseImage = Get(Pause)
|
||||
}
|
||||
|
||||
const (
|
||||
@ -101,24 +103,7 @@ func initImageMap(imageList ImageList) map[int]string {
|
||||
return images
|
||||
}
|
||||
|
||||
// GetImage returns the fully qualified URI to an image (including version)
|
||||
func GetImage(image int) string {
|
||||
// Get returns the fully qualified URI to an image (including version)
|
||||
func Get(image int) string {
|
||||
return imageMap[image]
|
||||
}
|
||||
|
||||
// EnsureImageExists pulls the given image, ensures that no error was encountered
|
||||
// while pulling it.
|
||||
func EnsureImageExists(t *testing.T, imageName string) string {
|
||||
img, err := imageService.ImageStatus(&runtime.ImageSpec{Image: imageName})
|
||||
require.NoError(t, err)
|
||||
if img != nil {
|
||||
t.Logf("Image %q already exists, not pulling.", imageName)
|
||||
return img.Id
|
||||
}
|
||||
|
||||
t.Logf("Pull test image %q", imageName)
|
||||
imgID, err := imageService.PullImage(&runtime.ImageSpec{Image: imageName}, nil, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
return imgID
|
||||
}
|
@ -54,6 +54,7 @@ const (
|
||||
|
||||
var (
|
||||
runtimeService cri.RuntimeService
|
||||
imageService cri.ImageManagerService
|
||||
containerdClient *containerd.Client
|
||||
containerdEndpoint string
|
||||
)
|
||||
@ -62,11 +63,9 @@ var criEndpoint = flag.String("cri-endpoint", "unix:///run/containerd/containerd
|
||||
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.")
|
||||
var containerdBin = flag.String("containerd-bin", "containerd", "The containerd binary name. The name is used to restart containerd during test.")
|
||||
var imageListFile = flag.String("image-list", "", "The TOML file containing the non-default images to be used in tests.")
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
flag.Parse()
|
||||
initImages(*imageListFile)
|
||||
if err := ConnectDaemons(); err != nil {
|
||||
logrus.WithError(err).Fatalf("Failed to connect daemons")
|
||||
}
|
||||
@ -506,3 +505,20 @@ func RestartContainerd(t *testing.T) {
|
||||
return ConnectDaemons() == nil, nil
|
||||
}, time.Second, 30*time.Second), "wait for containerd to be restarted")
|
||||
}
|
||||
|
||||
// EnsureImageExists pulls the given image, ensures that no error was encountered
|
||||
// while pulling it.
|
||||
func EnsureImageExists(t *testing.T, imageName string) string {
|
||||
img, err := imageService.ImageStatus(&runtime.ImageSpec{Image: imageName})
|
||||
require.NoError(t, err)
|
||||
if img != nil {
|
||||
t.Logf("Image %q already exists, not pulling.", imageName)
|
||||
return img.Id
|
||||
}
|
||||
|
||||
t.Logf("Pull test image %q", imageName)
|
||||
imgID, err := imageService.PullImage(&runtime.ImageSpec{Image: imageName}, nil, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
return imgID
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/integration/images"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||
@ -37,7 +38,7 @@ func TestPodDualStack(t *testing.T) {
|
||||
sb, sbConfig := PodSandboxConfigWithCleanup(t, "sandbox", "dualstack", WithPodLogDirectory(testPodLogDir))
|
||||
|
||||
var (
|
||||
testImage = GetImage(BusyBox)
|
||||
testImage = images.Get(images.BusyBox)
|
||||
containerName = "test-container"
|
||||
)
|
||||
|
||||
|
@ -24,6 +24,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/integration/images"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||
@ -86,7 +87,7 @@ func TestPodHostname(t *testing.T) {
|
||||
}
|
||||
|
||||
var (
|
||||
testImage = GetImage(BusyBox)
|
||||
testImage = images.Get(images.BusyBox)
|
||||
containerName = "test-container"
|
||||
)
|
||||
|
||||
|
@ -26,6 +26,7 @@ import (
|
||||
|
||||
"github.com/containerd/containerd"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/integration/images"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||
@ -108,12 +109,12 @@ func TestContainerdRestart(t *testing.T) {
|
||||
runtimeService.RemovePodSandbox(sid)
|
||||
}()
|
||||
|
||||
EnsureImageExists(t, pauseImage)
|
||||
EnsureImageExists(t, images.PauseImage)
|
||||
|
||||
s.id = sid
|
||||
for j := range s.containers {
|
||||
c := &s.containers[j]
|
||||
cfg := ContainerConfig(c.name, pauseImage,
|
||||
cfg := ContainerConfig(c.name, images.PauseImage,
|
||||
// Set pid namespace as per container, so that container won't die
|
||||
// when sandbox container is killed.
|
||||
WithPidNamespace(runtime.NamespaceMode_CONTAINER),
|
||||
@ -170,7 +171,7 @@ func TestContainerdRestart(t *testing.T) {
|
||||
}
|
||||
|
||||
t.Logf("Pull test images")
|
||||
for _, image := range []string{GetImage(BusyBox), GetImage(Pause)} {
|
||||
for _, image := range []string{images.Get(images.BusyBox), images.Get(images.Pause)} {
|
||||
EnsureImageExists(t, image)
|
||||
}
|
||||
imagesBeforeRestart, err := imageService.ListImages(nil)
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
goruntime "runtime"
|
||||
"testing"
|
||||
|
||||
"github.com/containerd/containerd/integration/images"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||
@ -33,7 +34,7 @@ func TestTruncIndex(t *testing.T) {
|
||||
sbConfig := PodSandboxConfig("sandbox", "truncindex")
|
||||
|
||||
t.Logf("Pull an image")
|
||||
var appImage = GetImage(BusyBox)
|
||||
var appImage = images.Get(images.BusyBox)
|
||||
|
||||
imgID := EnsureImageExists(t, appImage)
|
||||
imgTruncID := genTruncIndex(imgID)
|
||||
|
@ -24,6 +24,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/integration/images"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@ -37,7 +38,7 @@ const (
|
||||
|
||||
func TestVolumeCopyUp(t *testing.T) {
|
||||
var (
|
||||
testImage = GetImage(VolumeCopyUp)
|
||||
testImage = images.Get(images.VolumeCopyUp)
|
||||
execTimeout = time.Minute
|
||||
)
|
||||
|
||||
@ -95,7 +96,7 @@ func TestVolumeCopyUp(t *testing.T) {
|
||||
|
||||
func TestVolumeOwnership(t *testing.T) {
|
||||
var (
|
||||
testImage = GetImage(VolumeOwnership)
|
||||
testImage = images.Get(images.VolumeOwnership)
|
||||
execTimeout = time.Minute
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user