Merge pull request #9781 from prezha/fix-TestStartStop-crio-VerifyKubernetesImages
fix TestStartStop crio VerifyKubernetesImages serial testpull/9796/head
commit
a244828b84
|
@ -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),
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue