Skip to content

Commit

Permalink
Only pull appropriate images for testing (#1387)
Browse files Browse the repository at this point in the history
Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
  • Loading branch information
helsaawy committed May 5, 2022
1 parent 1c049f1 commit 840593a
Showing 1 changed file with 14 additions and 6 deletions.
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

0 comments on commit 840593a

Please sign in to comment.