Skip to content

Commit 5a5dbaa

Browse files
authored
[tmpnet] Enure node config is saved on restart for both runtimes (#4015)
1 parent c5b97dd commit 5a5dbaa

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

scripts/tests.e2e.existing.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ function cleanup {
2626
}
2727
trap cleanup EXIT
2828

29+
# TMPNET_NETWORK_DIR needs to be unset to ensure --reuse-network won't target an existing network
30+
unset TMPNET_NETWORK_DIR
31+
2932
print_separator
3033
echo "starting initial test run that should create the reusable network"
3134
./scripts/tests.e2e.sh --reuse-network --ginkgo.focus-file=xsvm.go "${@}"
@@ -37,7 +40,8 @@ INITIAL_NETWORK_DIR="$(realpath "${SYMLINK_PATH}")"
3740

3841
print_separator
3942
echo "starting second test run that should reuse the network created by the first run"
40-
./scripts/tests.e2e.sh --reuse-network --ginkgo.focus-file=xsvm.go "${@}"
43+
echo "the network is first restarted to verify that the network state was correctly serialized"
44+
./scripts/tests.e2e.sh --restart-network --ginkgo.focus-file=xsvm.go "${@}"
4145

4246
SUBSEQUENT_NETWORK_DIR="$(realpath "${SYMLINK_PATH}")"
4347
echo "checking that the symlink path remains the same, indicating that the network was reused"

tests/fixture/tmpnet/kube_runtime.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -462,11 +462,6 @@ func (p *KubeRuntime) Restart(ctx context.Context) error {
462462
return err
463463
}
464464

465-
// Save node to disk to ensure the same state can be used to restart
466-
if err := p.node.Write(); err != nil {
467-
return err
468-
}
469-
470465
statefulset, err := clientset.AppsV1().StatefulSets(namespace).Get(ctx, statefulSetName, metav1.GetOptions{})
471466
if err != nil {
472467
return err

tests/fixture/tmpnet/network.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ func (n *Network) Restart(ctx context.Context) error {
545545
if err := restartNodes(ctx, nodes); err != nil {
546546
return err
547547
}
548-
return WaitForHealthyNodes(ctx, n.log, n.Nodes)
548+
return WaitForHealthyNodes(ctx, n.log, nodes)
549549
}
550550

551551
// Waits for the provided nodes to become healthy.

tests/fixture/tmpnet/node.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ func (n *Node) WaitForStopped(ctx context.Context) error {
188188
}
189189

190190
func (n *Node) Restart(ctx context.Context) error {
191+
// Ensure the config used to restart the node is persisted for future use
192+
if err := n.Write(); err != nil {
193+
return err
194+
}
191195
return n.getRuntime().Restart(ctx)
192196
}
193197

0 commit comments

Comments
 (0)