Skip to content

Commit 53c5e26

Browse files
committed
test: restart tests and data loss
This is part of an investigation around "unexpected error while removing target path" in NodeUnpublishVolume: the target path got lost during the sudden power loss that the "can mount again" test simulates which in combination with insufficient idempotency caused NodeUnpublishVolume to fail. The comment for v.unpublish was misleading: the volume has not been unpublished, only unmounted as part of the reboot. It is less clear whether the directories created for the driver also got lost. To be on the safe side, sync is called for the entire filesystem.
1 parent 8e32bef commit 53c5e26

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

test/e2e/storage/sanity.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,13 @@ var _ = deploy.DescribeForSome("sanity", func(d *deploy.Deployment) bool {
169169
}
170170
}
171171
mkdir := func(path string) (string, error) {
172-
return execOnTestNode("mktemp", "-d", path), nil
172+
path = execOnTestNode("mktemp", "-d", path)
173+
// Ensure that the path that we created
174+
// survives a sudden power loss (as during the
175+
// restart tests below), otherwise rmdir will
176+
// fail when it's gone.
177+
execOnTestNode("sync", "-f", path)
178+
return path, nil
173179
}
174180
rmdir := func(path string) error {
175181
execOnTestNode("rmdir", path)
@@ -294,7 +300,9 @@ var _ = deploy.DescribeForSome("sanity", func(d *deploy.Deployment) bool {
294300
_, err := ncc.ListVolumes(context.Background(), &csi.ListVolumesRequest{})
295301
framework.ExpectNoError(err, "Failed to list volumes after reboot")
296302

297-
// No failure, is already unpublished.
303+
// No failure expected although rebooting already unmounted the volume.
304+
// We still need to remove the target path, if it has survived
305+
// the hard power off.
298306
v.unpublish(vol, nodeID)
299307

300308
// Publish for the second time.

0 commit comments

Comments
 (0)