Skip to content

Commit

Permalink
Bugfix: Retry install app if failed (#368)
Browse files Browse the repository at this point in the history
* Retry if install failed

* Update TestRunner.java
  • Loading branch information
zhou9584 authored Mar 14, 2023
1 parent 2e44a69 commit e2c8cb5
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.microsoft.hydralab.common.management.device.TestDeviceManager;
import com.microsoft.hydralab.common.management.device.impl.IOSTestDeviceManager;
import com.microsoft.hydralab.common.util.DateUtil;
import com.microsoft.hydralab.common.util.FlowUtil;
import com.microsoft.hydralab.common.util.LogUtils;
import com.microsoft.hydralab.common.util.ThreadPoolUtil;
import com.microsoft.hydralab.common.util.ThreadUtils;
Expand Down Expand Up @@ -204,8 +205,11 @@ protected void reInstallApp(DeviceInfo deviceInfo, TestTask testTask, Logger rep
testDeviceManager.resetPackage(deviceInfo, testTask.getPkgName(), reportLogger);
}
checkTestTaskCancel(testTask);

testDeviceManager.installApp(deviceInfo, testTask.getAppFile().getAbsolutePath(), reportLogger);
try {
FlowUtil.retryAndSleepWhenFalse(3, 10, () -> testDeviceManager.installApp(deviceInfo, testTask.getAppFile().getAbsolutePath(), reportLogger));
} catch (Exception e) {
throw new Exception(e);
}
}

protected void reInstallTestApp(DeviceInfo deviceInfo, TestTask testTask, Logger reportLogger)
Expand All @@ -228,7 +232,11 @@ protected void reInstallTestApp(DeviceInfo deviceInfo, TestTask testTask, Logger
ThreadUtils.safeSleep(2000);
}
checkTestTaskCancel(testTask);
testDeviceManager.installApp(deviceInfo, testTask.getTestAppFile().getAbsolutePath(), reportLogger);
try {
FlowUtil.retryAndSleepWhenFalse(3, 10, () -> testDeviceManager.installApp(deviceInfo, testTask.getTestAppFile().getAbsolutePath(), reportLogger));
} catch (Exception e) {
throw new Exception(e);
}
}

protected boolean shouldInstallTestPackageAsApp() {
Expand Down

0 comments on commit e2c8cb5

Please sign in to comment.