Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only pull appropriate images for testing #1387

Merged
merged 1 commit into from
May 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions test/cri-containerd/containerdrestart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ func Test_ContainerdRestart_LCOW(t *testing.T) {

// test restarting containers and pods
func Test_Container_CRI_Restart(t *testing.T) {
pullRequiredImages(t, []string{imageWindowsNanoserver})
pullRequiredLCOWImages(t, []string{imageLcowK8sPause, imageLcowAlpine})

client := newTestRuntimeClient(t)
pluginClient := newTestPluginClient(t)
ctx, cancel := context.WithCancel(context.Background())
Expand Down Expand Up @@ -143,6 +140,13 @@ func Test_Container_CRI_Restart(t *testing.T) {
t.Run(tt.Name+suffix, func(t *testing.T) {
requireFeatures(t, tt.Feature)

switch tt.Feature {
case featureLCOW:
pullRequiredLCOWImages(t, append([]string{imageLcowK8sPause}, tt.Image))
case featureWCOWHypervisor, featureWCOWProcess:
pullRequiredImages(t, []string{tt.Image})
}

opts := tt.SandboxOpts
if !explicit {
opts = append(tt.SandboxOpts,
Expand Down Expand Up @@ -215,9 +219,6 @@ func Test_Container_CRI_Restart(t *testing.T) {
func Test_Container_CRI_Restart_State(t *testing.T) {
testFile := "t.txt"

pullRequiredImages(t, []string{imageWindowsNanoserver})
pullRequiredLCOWImages(t, []string{imageLcowK8sPause, imageLcowAlpine})

client := newTestRuntimeClient(t)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
Expand Down Expand Up @@ -281,6 +282,13 @@ func Test_Container_CRI_Restart_State(t *testing.T) {
requireFeatures(t, featureTerminateOnRestart)
}

switch tt.Feature {
case featureLCOW:
pullRequiredLCOWImages(t, append([]string{imageLcowK8sPause}, tt.Image))
case featureWCOWHypervisor, featureWCOWProcess:
pullRequiredImages(t, []string{tt.Image})
}

sandboxRequest := getRunPodSandboxRequest(t, tt.Runtime,
append(tt.SandboxOpts,
WithSandboxAnnotations(map[string]string{
Expand Down