Skip to content

Fix flaky test

Pedro Pombeiro requested to merge pedropombeiro/fix-flaky-test into master

What does this MR do and why?

This MR fixes a flaky test by using a fixed runner token that contains all classes of runner token characters in it. This is better than quarantining the test altogether. I'm working locally to figure out an example of a token that results in a deployment name that doesn't comply with the regex. I have the impression that something else is at play here, since after creating hundreds of thousands of random tokens, I'm yet to find one failure locally.

Script
user = User.first; group = Group.last; Ci::Runner.transaction { 100000.times { runner = Ci::Runner.new(runner_type: :group_type, groups: [group]).tap(&:save!); result = Ci::Runners::CreateGoogleCloudProvisioningStepsService.new(container: group, current_user: user, params: { runner_token: runner.token }).send(:validate); if result&.error? puts "#{runner.token}: #{result.message}"; raise ActiveRecord::Rollback; end }; raise ActiveRecord::Rollback; }

Fixes #450267 (closed)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

n/a

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Pedro Pombeiro

Merge request reports