Enhance VirtualRouterRuningHostConnectedCase
package org.zstack.test.integration.networkservice.provider.virtualrouter
import org.zstack.core.db.DatabaseFacade
-import org.zstack.header.vm.VmInstance
-import org.zstack.header.vm.VmInstanceEO
import org.zstack.header.vm.VmInstanceState
import org.zstack.header.vm.VmInstanceVO
import org.zstack.network.service.virtualrouter.VirtualRouterVmVO
import org.zstack.sdk.HostInventory
import org.zstack.sdk.VmInstanceInventory
import org.zstack.test.integration.networkservice.provider.NetworkServiceProviderTest
-import org.zstack.test.integration.networkservice.provider.flat.FlatNetworkServiceEnv
-import org.zstack.test.integration.storage.Env
import org.zstack.testlib.EnvSpec
import org.zstack.testlib.SubCase
-import java.util.concurrent.TimeUnit
-
/**
* Created by heathhose on 17-3-25.
*/
@@ -52,20 +46,21 @@ test the vr is set to never stop
reconnectHost {
uuid = host1.uuid
}
- TimeUnit.SECONDS.sleep(2);
- assert dbf.listAll(VirtualRouterVmVO.class).size() == 1
- assert dbFindByUuid(vr.uuid,VmInstanceVO.class).state == VmInstanceState.Running
+ assert retryInSecs {
+ return dbf.listAll(VirtualRouterVmVO.class).size() == 1 && dbFindByUuid(vr.uuid,VmInstanceVO.class).state == VmInstanceState.Running
+ }
destroyVmInstance {
uuid = vr.uuid
}
assert dbf.listAll(VirtualRouterVmVO.class).size() == 0
+
rebootVmInstance {
uuid = vmi.uuid
}
- TimeUnit.SECONDS.sleep(2);
- vr = dbf.listAll(VirtualRouterVmVO.class).get(0)
- assert dbFindByUuid(vr.uuid,VmInstanceVO.class).state == VmInstanceState.Running
+ assert retryInSecs {
+ return dbf.listAll(VirtualRouterVmVO.class).size() == 1 && dbf.listAll(VirtualRouterVmVO.class).get(0).state == VmInstanceState.Running
+ }
}
@Override
void clean() {
