Merge pull request #9781 from prezha/fix-TestStartStop-crio-VerifyKubernetesImages

fix TestStartStop crio VerifyKubernetesImages serial test
pull/9796/head
Medya Ghazizadeh 2020-11-25 16:23:55 -08:00 committed by GitHub
commit a244828b84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 6 deletions

View File

@ -29,7 +29,7 @@ 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"
@ -37,7 +37,7 @@ func Pause(v semver.Version, mirror string) string {
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),

View File

@ -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 {
@ -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)
}
@ -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))
}
}