fix: pass exitCode to beforeExit extension in run-fargate#3674
Open
RohanHandore wants to merge 1 commit intoartilleryio:mainfrom
Open
fix: pass exitCode to beforeExit extension in run-fargate#3674RohanHandore wants to merge 1 commit intoartilleryio:mainfrom
RohanHandore wants to merge 1 commit intoartilleryio:mainfrom
Conversation
Add exitCode and earlyStop parameters to beforeExit extension call in run-cluster.js gracefulShutdown function. This fixes the bug where Slack plugin incorrectly reported failures for successful Fargate runs. Fixes artilleryio#3588
Member
|
thanks for taking the time @RohanHandore but I'm not sure this actually fixes an issue. Passing Moreover a worker failure should in fact mark the test as unsuccessful, so existing behavior would be correct. The new test tests itself rather than the actual functionality too. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes a bug where the Slack plugin incorrectly reported "Failed" status for successful
artillery run-fargatetest runs. The issue occurred because thebeforeExitextension was not receiving theexitCodeparameter when called from thegracefulShutdownfunction inrun-cluster.js.Problem
When running tests with
artillery run-fargate, the Slack plugin would show "🔴 Artillery test run failed" even when tests completed successfully. This was because:gracefulShutdownfunction inrun-cluster.jscalls thebeforeExitextension without passingexitCodeandearlyStopparametersopts.exitCodeto determine success/failure statusexitCode, the plugin falls back toglobal.artillery.suggestedExitCode, which may be incorrectly set from worker errorsSolution
Added
exitCodeandearlyStopparameters to thebeforeExitextension call ingracefulShutdown, matching the pattern used in the regularruncommand (packages/artillery/lib/cmds/run.js).Changes
Modified:
packages/artillery/lib/platform/aws-ecs/legacy/run-cluster.jsexitCode: opts.exitCodeandearlyStop: opts.earlyStopto thebeforeExitextension call (lines 524-525)Added:
packages/artillery/test/unit/before-exit-exitcode.test.jsbeforeExitextension receivesexitCodecorrectlyTesting
Impact
After this fix, the Slack plugin will correctly report:
This ensures consistency between Slack notifications and the Artillery Cloud dashboard status.
Closes #3588
Pre-merge checklist
This is for use by the Artillery team. Please leave this in if you're contributing to Artillery.