fix NfsGCCase
@@ -61,11 +61,17 @@ class NfsGCCase extends SubCase {
uuid = vol.uuid
}
- GarbageCollectorInventory inv = queryGCJob {
+ GarbageCollectorInventory inv = null
+
+ retryInSecs(5) {
+ inv = queryGCJob {
conditions = ["context~=%${vol.getUuid()}%".toString()]
}[0]
+ return {
assert inv.status == GCStatus.Idle.toString()
+ }
+ }
triggerGCJob {
uuid = inv.uuid
@@ -77,14 +83,17 @@ class NfsGCCase extends SubCase {
return rsp
}
- TimeUnit.SECONDS.sleep(1)
- assert called
-
+ retryInSecs(5) {
inv = queryGCJob {
conditions = ["context~=%${vol.getUuid()}%".toString()]
}[0]
+
+ return {
+ assert called
assert inv.status == GCStatus.Done.toString()
}
+ }
+ }
void testVolumeSnapshotGCSuccess() {
@@ -107,11 +116,16 @@ class NfsGCCase extends SubCase {
uuid = sp.uuid
}
- GarbageCollectorInventory inv = queryGCJob {
+ GarbageCollectorInventory inv = null
+ retryInSecs(5) {
+ inv = queryGCJob {
conditions = ["context~=%${sp.getUuid()}%".toString()]
}[0]
+ return {
assert inv.status == GCStatus.Idle.toString()
+ }
+ }
triggerGCJob {
uuid = inv.uuid
@@ -123,14 +137,17 @@ class NfsGCCase extends SubCase {
return rsp
}
- TimeUnit.SECONDS.sleep(1)
- assert called
-
+ retryInSecs(5) {
inv = queryGCJob {
conditions = ["context~=%${sp.getUuid()}%".toString()]
}[0]
+
+ return {
+ assert called
assert inv.status == GCStatus.Done.toString()
}
+ }
+ }
void testVolumeSnapshotAndVolumeGCCancelledAfterPrimaryStorageDeleted() {
VolumeInventory vol = createDataVolume {
@@ -156,17 +173,22 @@ class NfsGCCase extends SubCase {
uuid = vol.uuid
}
- GarbageCollectorInventory spGC = queryGCJob {
+ GarbageCollectorInventory spGC = null
+ GarbageCollectorInventory volumeGC = null
+ retryInSecs(5) {
+ spGC = queryGCJob {
conditions = ["context~=%${sp.getUuid()}%".toString()]
}[0]
- assert spGC.status == GCStatus.Idle.toString()
-
- GarbageCollectorInventory volumeGC = queryGCJob {
+ volumeGC = queryGCJob {
conditions = ["context~=%${vol.getUuid()}%".toString(), "runnerClass=${NfsDeleteVolumeGC.class.name}".toString()]
}[0]
+ return {
+ assert spGC.status == GCStatus.Idle.toString()
assert volumeGC.status == GCStatus.Idle.toString()
+ }
+ }
detachPrimaryStorageFromCluster {
clusterUuid = (env.specByName("cluster") as ClusterSpec).inventory.uuid
@@ -180,27 +202,33 @@ class NfsGCCase extends SubCase {
triggerGCJob {
uuid = spGC.uuid
}
- TimeUnit.SECONDS.sleep(1)
+ retryInSecs(5) {
// trigger GC cause it's cancelled
spGC = queryGCJob {
conditions = ["context~=%${sp.getUuid()}%".toString()]
}[0]
+ return {
assert spGC.status == GCStatus.Done.toString()
+ }
+ }
triggerGCJob {
uuid = volumeGC.uuid
}
- TimeUnit.SECONDS.sleep(1)
+ retryInSecs(5) {
// trigger GC cause it's cancelled
volumeGC = queryGCJob {
conditions = ["context~=%${vol.getUuid()}%".toString(), "runnerClass=${NfsDeleteVolumeGC.class.name}".toString()]
}[0]
+ return {
assert volumeGC.status == GCStatus.Done.toString()
}
+ }
+ }
@Override
void test() {
