Skip to content

Commit

Permalink
Fix assets ordering for proper AzureEngine script upload and validation
Browse files Browse the repository at this point in the history
  • Loading branch information
rabelenda-abstracta committed Aug 22, 2023
1 parent 64f6e9d commit 9b5351f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
branch: master
file_pattern: 'pom.xml */pom.xml README.md docs/index.md docs/guide/**'
- name: package release
run: mvn --batch-mode --no-transfer-progress clean install -Dfailsafe.skipAfterFailureCount=1 --settings .github/settings.xml
run: mvn --batch-mode --no-transfer-progress clean install --settings .github/settings.xml
env:
BZ_TOKEN: ${{ secrets.BZ_TOKEN }}
OCTOPERF_API_KEY: ${{ secrets.OCTOPERF_API_KEY }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ Call<Void> updateAppComponents(@Path("testId") String testId,
Call<Void> deleteTestFile(@Path("testId") String testId, @Path("fileName") String fileName);

@PUT("tests/{testId}/files/{fileName}" + API_VERSION)
Call<Void> uploadTestFile(@Path("testId") String testId, @Path("fileName") String fileName,
Call<FileInfo> uploadTestFile(@Path("testId") String testId, @Path("fileName") String fileName,
@Body RequestBody testFile);

@GET("tests/{testId}/files/{fileName}" + API_VERSION)
Expand Down Expand Up @@ -357,8 +357,8 @@ public void deleteTestFile(String fileName, String testId) throws IOException {
execApiCall(loadTestApi.deleteTestFile(testId, fileName));
}

public void uploadTestFile(File file, String fileName, String testId) throws IOException {
execApiCall(loadTestApi.uploadTestFile(testId, fileName,
public FileInfo uploadTestFile(File file, String fileName, String testId) throws IOException {
return execApiCall(loadTestApi.uploadTestFile(testId, fileName,
RequestBody.create(MediaType.get("application/octet-stream"), file)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,6 @@ private void updateAppComponents(LoadTest loadTest) throws IOException {

private void uploadTestFiles(File jmxFile, HashTree tree, BuildTreeContext context,
LoadTest loadTest) throws IOException, InterruptedException, TimeoutException {
LOG.info("Uploading test script and asset files");
for (File f : assets) {
context.processAssetFile(f.getPath());
}
Expand All @@ -492,17 +491,17 @@ private void uploadTestFiles(File jmxFile, HashTree tree, BuildTreeContext conte
}
context.processAssetFile(jmxFile.getPath());
for (Map.Entry<String, File> asset : context.getAssetFiles().entrySet()) {
apiClient.uploadTestFile(asset.getValue(), asset.getKey(), loadTest.getTestId());
awaitValidatedTestFile(asset.getKey(), loadTest.getTestId());
FileInfo testFile = apiClient.uploadTestFile(asset.getValue(), asset.getKey(),
loadTest.getTestId());
awaitValidatedTestFile(testFile, loadTest.getTestId());
}
}

private void awaitValidatedTestFile(String fileName, String testId)
private void awaitValidatedTestFile(FileInfo testFile, String testId)
throws IOException, InterruptedException, TimeoutException {
LOG.info("Validating test script");
EntityProvider<FileInfo> fileProvider = () -> apiClient.findTestFile(fileName, testId);
awaitStatus(fileProvider.get(), fileProvider, FileInfo::isPendingValidation,
FileInfo::isSuccessValidation, VALIDATION_TIMEOUT,
String fileName = testFile.getFileName();
awaitStatus(testFile, () -> apiClient.findTestFile(fileName, testId),
FileInfo::isPendingValidation, FileInfo::isSuccessValidation, VALIDATION_TIMEOUT,
"test file '" + fileName + "' validation", "test plan",
FileInfo::getValidationFailureDetails);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public HashTree buildTreeFor(DslTestElement element, HashTree parentTree) {
}

public static BuildTreeContext buildRemoteExecutionContext() {
return new BuildTreeContext(null, new LinkedHashMap<>(), new HashMap<>());
return new BuildTreeContext(null, new LinkedHashMap<>(), new LinkedHashMap<>());
}

public String processAssetFile(String assetPath) {
Expand Down

0 comments on commit 9b5351f

Please sign in to comment.