Skip to content

Commit

Permalink
Merge pull request #9781 from prezha/fix-TestStartStop-crio-VerifyKub…
Browse files Browse the repository at this point in the history
…ernetesImages

fix TestStartStop crio VerifyKubernetesImages serial test
  • Loading branch information
medyagh authored Nov 26, 2020
2 parents 7dad70d + a60176c commit a244828
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pkg/minikube/bootstrapper/images/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ import (
// Pause returns the image name to pull for a given Kubernetes version
func Pause(v semver.Version, mirror string) string {
// Should match `PauseVersion` in:
// https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/constants/constants.go
// https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/constants/constants_unix.go
pv := "3.2"
if semver.MustParseRange("<1.18.0-alpha.0")(v) {
pv = "3.1"
}
return path.Join(kubernetesRepo(mirror), "pause"+archTag(false)+pv)
}

// essentials returns images needed too bootstrap a kubenretes
// essentials returns images needed too bootstrap a Kubernetes
func essentials(mirror string, v semver.Version) []string {
imgs := []string{
componentImage("kube-proxy", v, mirror),
Expand Down
16 changes: 12 additions & 4 deletions test/integration/start_stop_delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func TestStartStop(t *testing.T) {
{"UserAppExistsAfterStop", validateAppExistsAfterStop},
{"AddonExistsAfterStop", validateAddonAfterStop},
{"VerifyKubernetesImages", validateKubernetesImages},
{"Pause", validatePauseAfterSart},
{"Pause", validatePauseAfterStart},
}
for _, stc := range serialTests {
if ctx.Err() == context.DeadlineExceeded {
Expand Down Expand Up @@ -233,7 +233,7 @@ func validateKubernetesImages(ctx context.Context, t *testing.T, profile string,
}
}

func validatePauseAfterSart(ctx context.Context, t *testing.T, profile string, tcName string, tcVersion string, startArgs []string) {
func validatePauseAfterStart(ctx context.Context, t *testing.T, profile string, tcName string, tcVersion string, startArgs []string) {
defer PostMortemLogs(t, profile)
testPause(ctx, t, profile)
}
Expand Down Expand Up @@ -317,8 +317,16 @@ func testPulledImages(ctx context.Context, t *testing.T, profile string, version
}
sort.Strings(want)
sort.Strings(gotImages)
if diff := cmp.Diff(want, gotImages); diff != "" {
t.Errorf("%s images mismatch (-want +got):\n%s", version, diff)
// check if we got all the images we want, ignoring any extraneous ones in cache (eg, may be created by other tests)
missing := false
for _, img := range want {
if sort.SearchStrings(gotImages, img) == len(gotImages) {
missing = true
break
}
}
if missing {
t.Errorf("%s images missing (-want +got):\n%s", version, cmp.Diff(want, gotImages))
}
}

Expand Down

0 comments on commit a244828

Please sign in to comment.