Skip to content

Commit 15fcba1

Browse files
committed
Create integration test for multinode restart.
1 parent fbad4cf commit 15fcba1

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/integration/multinode_test.go

+31
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ func TestMultiNode(t *testing.T) {
5555
{"CopyFile", validateCopyFileWithMultiNode},
5656
{"StopNode", validateStopRunningNode},
5757
{"StartAfterStop", validateStartNodeAfterStop},
58+
{"RestartKeepsNodes", validateRestartKeepsNodes},
5859
{"DeleteNode", validateDeleteNodeFromMultiNode},
5960
{"StopMultiNode", validateStopMultiNodeCluster},
6061
{"RestartMultiNode", validateRestartMultiNodeCluster},
@@ -258,6 +259,36 @@ func validateStartNodeAfterStop(ctx context.Context, t *testing.T, profile strin
258259
}
259260
}
260261

262+
// validateRestartKeepsNodes restarts minikube cluster and checks if the reported node list is unchanged
263+
func validateRestartKeepsNodes(ctx context.Context, t *testing.T, profile string) {
264+
rr, err := Run(t, exec.CommandContext(ctx, Target(), "node", "list", "-p", profile))
265+
if err != nil {
266+
t.Errorf("failed to run node list. args %q : %v", rr.Command(), err)
267+
}
268+
269+
nodeList := rr.Stdout.String()
270+
271+
_, err = Run(t, exec.CommandContext(ctx, Target(), "stop", "-p", profile))
272+
if err != nil {
273+
t.Errorf("failed to run minikube stop. args %q : %v", rr.Command(), err)
274+
}
275+
276+
_, err = Run(t, exec.CommandContext(ctx, Target(), "start", "-p", profile, "--wait=true", "-v=8", "--alsologtostderr"))
277+
if err != nil {
278+
t.Errorf("failed to run minikube start. args %q : %v", rr.Command(), err)
279+
}
280+
281+
rr, err = Run(t, exec.CommandContext(ctx, Target(), "node", "list", "-p", profile))
282+
if err != nil {
283+
t.Errorf("failed to run node list. args %q : %v", rr.Command(), err)
284+
}
285+
286+
restartedNodeList := rr.Stdout.String()
287+
if nodeList != restartedNodeList {
288+
t.Fatalf("reported node list is not the same after restart. Before restart: %s\nAfter restart: %s", nodeList, restartedNodeList)
289+
}
290+
}
291+
261292
// validateStopMultiNodeCluster runs minikube stop on a multinode cluster
262293
func validateStopMultiNodeCluster(ctx context.Context, t *testing.T, profile string) {
263294
// Run minikube stop on the cluster

0 commit comments

Comments
 (0)