De-flake the vehicle turret test #51249
Merged
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.
Summary
Bugfixes "De-flake the vehicle turret test"
Purpose of change
The vehicle turret test occasionally fails because a turret randomly misfires.
This seems to happen with 0.5% probability if the default ammo of the turret is RECYCLED (which is a separate bug but I'll fix it here anyway).
Describe the solution
Add 2 more attempts to fire. The test will pass if at least one bullet is fired.
Also fix the RNG seed to make the test deterministic, hence less annoying to debug.[@jbytheway talked me out of it, saying the seed is printed by failing tests]Changed default ammo for improvised railguns to steel rail, which doesn't misfire (unlike rebar rail).
Added a warning message when the default turret ammo is RECYCLED, this is silent now but will warn if someone adds a turret with bad default ammo in the future.
Describe alternatives you've considered
Testing
Ran the test.
Additional context
The only turrets that fire recycled ammo (and can misfire) are the 2 obsolete improvised railguns.
Edit: Changed their default ammo to steel rail, so now no turrets can misfire when using default ammo.