cephfs admin: fix issues with TestWorkflow

Due to a new ceph nautilus the workflow test was breaking because the
existing code failed to anticipate the "subvolume uuid" in the path
to the snapshot data. This is the curse of writing code without anything
to test it against. I also add a very short delay just to give us
a chance to avoid issues in the future in case the snapshot creation
is not quite synchronous.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2020-10-26 10:16:55 -04:00 committed by John Mulligan
parent 55821a9300
commit 11b6c916ed
1 changed files with 3 additions and 1 deletions

View File

@ -66,7 +66,7 @@ func getSnapPath(t *testing.T, mount *cephfs.MountInfo, subvol, snapname string)
if err == nil {
return snapPath
}
snapPath = path.Join(path.Dir(subvol), snapDir, snapname)
snapPath = path.Join(path.Dir(subvol), snapDir, snapname, path.Base(subvol))
_, err = mount.Statx(snapPath, cephfs.StatxBasicStats, 0)
if err == nil {
return snapPath
@ -158,6 +158,8 @@ func TestWorkflow(t *testing.T) {
require.NoError(t, err)
require.NotNil(t, sinfo)
time.Sleep(500 * time.Millisecond) // is there a race?
// examine the snapshot
snapPath := getSnapPath(t, mount, subPath, snapname1)
require.NotEqual(t, "", snapPath)