Skip to content

Commit e20d3cc

Browse files
zhou9584Le Zhou
andauthored
[Feature] Provide API to generate SAS for each file (#702)
<!-- Please provide brief information about the PR, what it contains & its purpose, new behaviors after the change. And let us know here if you need any help: https://github.com/microsoft/HydraLab/issues/new --> ## Description <!-- A few words to explain your changes --> ### Linked GitHub issue ID: # ## Pull Request Checklist <!-- Put an x in the boxes that apply. This is simply a reminder of what we are going to look for before merging your code. --> - [ ] Tests for the changes have been added (for bug fixes / features) - [x] Code compiles correctly with all tests are passed. - [x] I've read the [contributing guide](https://github.com/microsoft/HydraLab/blob/main/CONTRIBUTING.md#making-changes-to-the-code) and followed the recommended practices. - [ ] [Wikis](https://github.com/microsoft/HydraLab/wiki) or [README](https://github.com/microsoft/HydraLab/blob/main/README.md) have been reviewed and added / updated if needed (for bug fixes / features) ### Does this introduce a breaking change? *If this introduces a breaking change for Hydra Lab users, please describe the impact and migration path.* - [x] Yes - [ ] No ## How you tested it *Please make sure the change is tested, you can test it by adding UTs, do local test and share the screenshots, etc.* Please check the type of change your PR introduces: - [ ] Bugfix - [x] Feature - [ ] Technical design - [ ] Build related changes - [ ] Refactoring (no functional changes, no api changes) - [ ] Code style update (formatting, renaming) or Documentation content changes - [ ] Other (please describe): ### Feature UI screenshots or Technical design diagrams *If this is a relatively large or complex change, kick it off by drawing the tech design with PlantUML and explaining why you chose the solution you did and what alternatives you considered, etc...* --------- Co-authored-by: Le Zhou <[email protected]>
1 parent 872a516 commit e20d3cc

37 files changed

+419
-126
lines changed

agent/src/main/java/com/microsoft/hydralab/agent/config/AppOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public String getDeviceLogStorageLocation() {
3636
}
3737

3838
public String getScreenshotStorageLocation() {
39-
return getDeviceStorageLocation() + "/screenshot/";
39+
return getDeviceStorageLocation() + "/screenshots/";
4040
}
4141

4242
public String getTestPackageLocation() {

agent/src/main/java/com/microsoft/hydralab/agent/runner/analysis/AnalysisRunner.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,11 @@ public void teardown(AnalysisTask testTask, TestRun testRun) {
125125
Assert.notNull(files, "should have result file to upload");
126126
for (File file : files) {
127127
if (!file.isDirectory()) {
128-
attachments.add(testTaskEngineService.saveFileToBlob(file, deviceTestResultFolder, testRun.getLogger()));
128+
attachments.add(testTaskEngineService.saveFileToBlob(file, deviceTestResultFolder, testRun.getLogger(), testTask.getTeamId(), testTask.getTeamName()));
129129
} else if (file.listFiles().length > 0) {
130130
File zipFile = FileUtil.zipFile(file.getAbsolutePath(),
131131
deviceTestResultFolder + "/" + file.getName() + ".zip");
132-
attachments.add(testTaskEngineService.saveFileToBlob(zipFile, deviceTestResultFolder, testRun.getLogger()));
132+
attachments.add(testTaskEngineService.saveFileToBlob(zipFile, deviceTestResultFolder, testRun.getLogger(), testTask.getTeamId(), testTask.getTeamName()));
133133
}
134134
}
135135
testRun.setAttachments(attachments);

agent/src/main/java/com/microsoft/hydralab/agent/runner/appium/AppiumListener.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ public void testRunFinished(Result result) {
214214
testRunDeviceOrchestrator.stopGitEncoder(testRunDevice, agentManagementService.getScreenshotDir(), logger);
215215
}
216216
if (!testTask.isDisableRecording()) {
217-
testRunDeviceOrchestrator.stopScreenRecorder(testRunDevice, testRun.getResultFolder(), logger);
217+
String videoFilePath = testRunDeviceOrchestrator.stopScreenRecorder(testRunDevice, testRun.getResultFolder(), logger);
218+
testRun.setVideoPath(agentManagementService.getTestBaseRelPathInUrl(videoFilePath));
218219
}
219220
testRunDeviceOrchestrator.stopLogCollector(testRunDevice);
220221
alreadyEnd = true;

agent/src/main/java/com/microsoft/hydralab/agent/runner/appium/Junit5Listener.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ public void testPlanExecutionFinished(TestPlan testPlan) {
129129
testRunDeviceOrchestrator.stopGitEncoder(testRunDevice, agentManagementService.getScreenshotDir(), logger);
130130
}
131131
if (!testTask.isDisableRecording()) {
132-
testRunDeviceOrchestrator.stopScreenRecorder(testRunDevice, testRun.getResultFolder(), logger);
132+
String videoFilePath = testRunDeviceOrchestrator.stopScreenRecorder(testRunDevice, testRun.getResultFolder(), logger);
133+
testRun.setVideoPath(agentManagementService.getTestBaseRelPathInUrl(videoFilePath));
133134
}
134135
testRunDeviceOrchestrator.stopLogCollector(testRunDevice);
135136
alreadyEnd = true;

agent/src/main/java/com/microsoft/hydralab/agent/runner/espresso/EspressoTestInfoProcessorListener.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,8 @@ private void releaseResource() {
250250
testRunDeviceOrchestrator.stopGitEncoder(testRunDevice, agentManagementService.getScreenshotDir(), logger);
251251
}
252252
if (!testTask.isDisableRecording()) {
253-
testRunDeviceOrchestrator.stopScreenRecorder(testRunDevice, testRun.getResultFolder(), logger);
253+
String videoFilePath = testRunDeviceOrchestrator.stopScreenRecorder(testRunDevice, testRun.getResultFolder(), logger);
254+
testRun.setVideoPath(agentManagementService.getTestBaseRelPathInUrl(videoFilePath));
254255
}
255256
testRunDeviceOrchestrator.stopLogCollector(testRunDevice);
256257
}

agent/src/main/java/com/microsoft/hydralab/agent/runner/maestro/MaestroListener.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ public void testRunEnded() {
156156
testRunDeviceOrchestrator.stopGitEncoder(testRunDevice, agentManagementService.getScreenshotDir(), logger);
157157
}
158158
if (!testTask.isDisableRecording()) {
159-
testRunDeviceOrchestrator.stopScreenRecorder(testRunDevice, testRun.getResultFolder(), logger);
159+
String videoFilePath = testRunDeviceOrchestrator.stopScreenRecorder(testRunDevice, testRun.getResultFolder(), logger);
160+
testRun.setVideoPath(agentManagementService.getTestBaseRelPathInUrl(videoFilePath));
160161
}
161162
testRunDeviceOrchestrator.stopLogCollector(testRunDevice);
162163
alreadyEnd = true;

agent/src/main/java/com/microsoft/hydralab/agent/runner/monkey/AdbMonkeyRunner.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ public void releaseResource(TestTask testTask, TestRunDevice testRunDevice, Test
175175
testRunDeviceOrchestrator.stopGitEncoder(testRunDevice, agentManagementService.getScreenshotDir(), testRun.getLogger());
176176
}
177177
if (!testTask.isDisableRecording()) {
178-
testRunDeviceOrchestrator.stopScreenRecorder(testRunDevice, testRun.getResultFolder(), testRun.getLogger());
178+
String videoFilePath = testRunDeviceOrchestrator.stopScreenRecorder(testRunDevice, testRun.getResultFolder(), testRun.getLogger());
179+
testRun.setVideoPath(agentManagementService.getTestBaseRelPathInUrl(videoFilePath));
179180
}
180181
testRunDeviceOrchestrator.stopLogCollector(testRunDevice);
181182
}

agent/src/main/java/com/microsoft/hydralab/agent/runner/python/PythonRunner.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ public void releaseResource(TestTask testTask, TestRunDevice testRunDevice, Test
123123
testRunDeviceOrchestrator.stopGitEncoder(testRunDevice, agentManagementService.getScreenshotDir(), testRun.getLogger());
124124
}
125125
if (!testTask.isDisableRecording()) {
126-
testRunDeviceOrchestrator.stopScreenRecorder(testRunDevice, testRun.getResultFolder(), testRun.getLogger());
126+
String videoFilePath = testRunDeviceOrchestrator.stopScreenRecorder(testRunDevice, testRun.getResultFolder(), testRun.getLogger());
127+
testRun.setVideoPath(agentManagementService.getTestBaseRelPathInUrl(videoFilePath));
127128
}
128129
testRunDeviceOrchestrator.stopLogCollector(testRunDevice);
129130
}

agent/src/main/java/com/microsoft/hydralab/agent/runner/smart/SmartRunner.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ public void testRunEnded(TestRunDevice testRunDevice, TestTask testTask, TestRun
190190
testRunDeviceOrchestrator.stopGitEncoder(testRunDevice, agentManagementService.getScreenshotDir(), testRun.getLogger());
191191
}
192192
if (!testTask.isDisableRecording()) {
193-
testRunDeviceOrchestrator.stopScreenRecorder(testRunDevice, testRun.getResultFolder(), testRun.getLogger());
193+
String videoFilePath = testRunDeviceOrchestrator.stopScreenRecorder(testRunDevice, testRun.getResultFolder(), testRun.getLogger());
194+
testRun.setVideoPath(agentManagementService.getTestBaseRelPathInUrl(videoFilePath));
194195
}
195196
testRunDeviceOrchestrator.stopLogCollector(testRunDevice);
196197
}

agent/src/main/java/com/microsoft/hydralab/agent/runner/xctest/XCTestRunner.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ private void finishTest(TestRunDevice testRunDevice, TestTask testTask, TestRun
218218
testRunDeviceOrchestrator.stopGitEncoder(testRunDevice, agentManagementService.getScreenshotDir(), testRun.getLogger());
219219
}
220220
if (!testTask.isDisableRecording()) {
221-
testRunDeviceOrchestrator.stopScreenRecorder(testRunDevice, testRun.getResultFolder(), testRun.getLogger());
221+
String videoFilePath = testRunDeviceOrchestrator.stopScreenRecorder(testRunDevice, testRun.getResultFolder(), testRun.getLogger());
222+
testRun.setVideoPath(agentManagementService.getTestBaseRelPathInUrl(videoFilePath));
222223
}
223224
testRunDeviceOrchestrator.stopLogCollector(testRunDevice);
224225
}

0 commit comments

Comments
 (0)