Add integration test to ensure that we addons enabled while the cluster was stopped come up successfully

pull/6471/head
tstromberg 2020-02-03 10:50:06 -08:00
parent bcc186b908
commit 4ed5b4838e
1 changed files with 25 additions and 11 deletions

View File

@ -105,9 +105,18 @@ func TestStartStop(t *testing.T) {
t.Errorf("%s failed: %v", rr.Args, err)
}
got := Status(ctx, t, Target(), profile, "Host")
if got != state.Stopped.String() {
t.Errorf("status = %q; want = %q", got, state.Stopped)
// The none driver never really stops
if !NoneDriver() {
got := Status(ctx, t, Target(), profile, "Host")
if got != state.Stopped.String() {
t.Errorf("post-stop host status = %q; want = %q", got, state.Stopped)
}
}
// Enable an addon to assert it comes up afterwards
rr, err = Run(t, exec.CommandContext(ctx, Target(), "addons", "enable", "dashboard", "-p", profile))
if err != nil {
t.Errorf("%s failed: %v", rr.Args, err)
}
rr, err = Run(t, exec.CommandContext(ctx, Target(), startArgs...))
@ -118,13 +127,18 @@ func TestStartStop(t *testing.T) {
if strings.Contains(tc.name, "cni") {
t.Logf("WARNING: cni mode requires additional setup before pods can schedule :(")
} else if _, err := PodWait(ctx, t, profile, "default", "integration-test=busybox", 4*time.Minute); err != nil {
t.Fatalf("wait: %v", err)
} else {
if _, err := PodWait(ctx, t, profile, "default", "integration-test=busybox", 4*time.Minute); err != nil {
t.Fatalf("post-stop-start pod wait: %v", err)
}
if _, err := PodWait(ctx, t, profile, "kubernetes-dashboard", "k8s-app=kubernetes-dashboard", 4*time.Minute); err != nil {
t.Fatalf("post-stop-start addon wait: %v", err)
}
}
got = Status(ctx, t, Target(), profile, "Host")
got := Status(ctx, t, Target(), profile, "Host")
if got != state.Running.String() {
t.Errorf("host status = %q; want = %q", got, state.Running)
t.Errorf("post-start host status = %q; want = %q", got, state.Running)
}
if !NoneDriver() {
@ -227,12 +241,12 @@ func testPause(ctx context.Context, t *testing.T, profile string) {
got := Status(ctx, t, Target(), profile, "APIServer")
if got != state.Paused.String() {
t.Errorf("apiserver status = %q; want = %q", got, state.Paused)
t.Errorf("post-pause apiserver status = %q; want = %q", got, state.Paused)
}
got = Status(ctx, t, Target(), profile, "Kubelet")
if got != state.Stopped.String() {
t.Errorf("kubelet status = %q; want = %q", got, state.Stopped)
t.Errorf("post-pause kubelet status = %q; want = %q", got, state.Stopped)
}
rr, err = Run(t, exec.CommandContext(ctx, Target(), "unpause", "-p", profile, "--alsologtostderr", "-v=1"))
@ -242,12 +256,12 @@ func testPause(ctx context.Context, t *testing.T, profile string) {
got = Status(ctx, t, Target(), profile, "APIServer")
if got != state.Running.String() {
t.Errorf("apiserver status = %q; want = %q", got, state.Running)
t.Errorf("post-unpause apiserver status = %q; want = %q", got, state.Running)
}
got = Status(ctx, t, Target(), profile, "Kubelet")
if got != state.Running.String() {
t.Errorf("kubelet status = %q; want = %q", got, state.Running)
t.Errorf("post-unpause kubelet status = %q; want = %q", got, state.Running)
}
}