Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/scripts/generateE2ETestMatrix.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
os_options=('ubuntu-latest' 'windows-latest')
node_options=('18' '20' '22')

ScriptsRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
E2ETestConfigFile="$ScriptsRoot/../config/e2eTestConfig.json"
Expand All @@ -8,12 +9,13 @@ matrix_json="{\"include\":["

while read -r config; do
rand_os=${os_options[$((RANDOM % 2))]} # Random OS for each test
rand_node=${node_options[$((RANDOM % 3))]} # Random Node version for each test

configFile=$(echo "$config" | jq -r '.configFile')
secrets=$(echo "$config" | jq -r '.secrets')
env=$(echo "$config" | jq -r '.env')

matrix_json+="{\"configFile\":\"$configFile\",\"secrets\":\"$secrets\",\"env\":\"$env\",\"os\":\"$rand_os\"},"
matrix_json+="{\"configFile\":\"$configFile\",\"secrets\":\"$secrets\",\"env\":\"$env\",\"os\":\"$rand_os\",\"node\":\"$rand_node\"},"
done <<< "$(echo -e "$configs")"

matrix_json="${matrix_json::-1}]}" # Remove trailing comma
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr_check_load_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
node-version: ${{ matrix.node }}

- name: Installing dependencies and building latest changes
if: github.ref == 'refs/heads/main' || (github.event_name == 'pull_request' && github.base_ref == 'main')
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ inputs:
outputVariableName:
description: 'Name of the output variable that stores the test run ID for use in subsequent tasks.'
required: false
waitForCompletion:
description: 'Wait for the load test run to complete. If false, the action will return after starting the test run. Default is true.'
required: false
default: 'true'

branding:
icon: 'extension-icon.svg'
Expand Down
3 changes: 2 additions & 1 deletion lib/Constants/InputConstants.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadTestConfigFileLabel = exports.loadTestResourceLabel = exports.resourceGroupLabel = exports.serviceConnectionNameLabel = exports.secretsLabel = exports.envVarsLabel = exports.outputVariableNameLabel = exports.overRideParametersLabel = exports.runDescriptionLabel = exports.testRunNameLabel = exports.loadTestConfigFile = exports.loadTestResource = exports.resourceGroup = exports.secrets = exports.envVars = exports.outputVariableName = exports.overRideParameters = exports.runDescription = exports.testRunName = void 0;
exports.loadTestConfigFileLabel = exports.loadTestResourceLabel = exports.resourceGroupLabel = exports.serviceConnectionNameLabel = exports.secretsLabel = exports.envVarsLabel = exports.outputVariableNameLabel = exports.overRideParametersLabel = exports.runDescriptionLabel = exports.testRunNameLabel = exports.waitForCompletion = exports.loadTestConfigFile = exports.loadTestResource = exports.resourceGroup = exports.secrets = exports.envVars = exports.outputVariableName = exports.overRideParameters = exports.runDescription = exports.testRunName = void 0;
exports.testRunName = 'loadTestRunName';
exports.runDescription = 'loadTestRunDescription';
exports.overRideParameters = 'overrideParameters';
Expand All @@ -10,6 +10,7 @@ exports.secrets = 'secrets';
exports.resourceGroup = 'resourceGroup';
exports.loadTestResource = 'loadTestResource';
exports.loadTestConfigFile = 'loadTestConfigFile';
exports.waitForCompletion = 'waitForCompletion';
// labels user visible strings
exports.testRunNameLabel = 'Load Test Run Name';
exports.runDescriptionLabel = 'Load Test Run Description';
Expand Down
23 changes: 16 additions & 7 deletions lib/RunnerFiles/CreateAndRunTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class CreateAndRunTest {
this.apiService = apiService;
}
createAndRunTest() {
return __awaiter(this, void 0, void 0, function* () {
return __awaiter(this, arguments, void 0, function* (waitForRunCompletionInput = true) {
var _a;
yield this.initialize();
let testPayload = yield this.getTestPayload();
Expand Down Expand Up @@ -83,12 +83,18 @@ class CreateAndRunTest {
let testRunResult = yield this.apiService.createTestRun(testRunPayload);
this.printPortalUrl(testRunResult);
CoreUtils.exportVariable(UtilModels_1.PostTaskParameters.runId, testRunResult.testRunId);
yield this.awaitTerminationForTestRun(testRunResult.testRunId, this.apiService);
testRunResult = (_a = yield this.awaitResultsPopulation(testRunResult.testRunId, this.apiService)) !== null && _a !== void 0 ? _a : testRunResult;
CoreUtils.exportVariable(UtilModels_1.PostTaskParameters.isRunCompleted, 'true');
this.printMetrics(testRunResult);
yield this.uploadResultsToPipeline(testRunResult);
this.setTaskResults(testRunResult);
if (waitForRunCompletionInput) {
yield this.awaitTerminationForTestRun(testRunResult.testRunId, this.apiService);
testRunResult = (_a = yield this.awaitResultsPopulation(testRunResult.testRunId, this.apiService)) !== null && _a !== void 0 ? _a : testRunResult;
CoreUtils.exportVariable(UtilModels_1.PostTaskParameters.isRunCompleted, 'true');
this.printMetrics(testRunResult);
yield this.uploadResultsToPipeline(testRunResult);
this.setTaskResults(testRunResult);
}
else {
console.log("Test run started. Not waiting for completion as per input.");
this.setRunStarted();
}
this.setOutputVariable(testRunResult);
});
}
Expand Down Expand Up @@ -331,6 +337,9 @@ class CreateAndRunTest {
CoreUtils.setFailed("TestStatus: " + testRunObj.status);
}
}
setRunStarted() {
console.log("Result: Test Run Started Successfully.");
}
setOutputVariable(testRunObj) {
let outputVarName = (0, CreateAndRunUtils_1.validateAndGetOutPutVarName)();
let outputVar = {
Expand Down
Loading
Loading