Match ' and " in runner values test
What does this MR do?
Fix flaky test on ./spec/models/clusters/applications/runner_spec.rb
reported in gitlab-org/quality/triage-reports#412 (closed)
When runnerToken
begins with -
, it may be quoted with "
when rendered into yaml. The matcher '?
would not match in this case.
Example failure
1) Clusters::Applications::Runner#files focus includes runner valid values
Failure/Error: expect(values).to match(/runnerToken: '?#{Regexp.escape(ci_runner.token)}/)
expected "---\nconcurrent: 4\ncheckInterval: 3\nrbac:\n clusterWideAccess: false\nrunners:\n image: ubuntu:1...vileged: true\nresources: {}\ngitlabUrl: http://localhost/\nrunnerToken: \"-smzcyy3r_eQa_CB3xf_\"\n" to match /runnerToken: '?\-smzcyy3r_eQa_CB3xf_/
Diff:
@@ -1,2 +1,15 @@
-/runnerToken: '?\-smzcyy3r_eQa_CB3xf_/
+---
+concurrent: 4
+checkInterval: 3
+rbac:
+ clusterWideAccess: false
+runners:
+ image: ubuntu:16.04
+ builds: {}
+ services: {}
+ helpers: {}
+ privileged: true
+resources: {}
+gitlabUrl: http://localhost/
+runnerToken: "-smzcyy3r_eQa_CB3xf_"
# ./spec/models/clusters/applications/runner_spec.rb:74:in `block (5 levels) in <main>'
# ./spec/spec_helper.rb:340:in `block (3 levels) in <main>'
# ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
# ./spec/spec_helper.rb:331:in `block (2 levels) in <main>'
# ./spec/spec_helper.rb:327:in `block (3 levels) in <main>'
# ./spec/spec_helper.rb:327:in `block (2 levels) in <main>'
# -e:1:in `<main>'