-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support to override the allowed test tiers #253
Conversation
cdf8244
to
2effadc
Compare
expect { described_class.setup_beaker(task) }.to raise_error(RuntimeError, %r{not a valid test tier}) | ||
end | ||
it 'Override TEST_TIERS_ALLOWED' do | ||
ENV['TEST_TIERS_ALLOWED'] = 'dev,rnd' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please set up mocking like in the next line, instead of altering the global environment.
Background: using the allow(ENV).to receive(:[]).with('TEST_TIERS').and_return('dev')
syntax means that everything is cleaned up in all cases. Modifying global state means that when errors happen, cleanup is skipped, leading to flaky tests.
@@ -64,10 +64,11 @@ def self.setup_beaker(t) | |||
# TEST_TIERS env variable is a comma separated list of tiers to run. e.g. low, medium, high | |||
if ENV['TEST_TIERS'] | |||
test_tiers = ENV['TEST_TIERS'].split(',') | |||
raise 'TEST_TIERS env variable must have at least 1 tier specified. low, medium or high (comma separated).' if test_tiers.count == 0 | |||
test_tiers_allowed = ENV.fetch('TEST_TIERS_ALLOWED', 'low,medium,high').split(',') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, clicked the wrong button there. Please see comments above
@DavidS My rspec foo is not that good and i was unable to get it to work using the following it 'Override TEST_TIERS_ALLOWED' do
allow(ENV).to receive(:[]).with('TEST_TIERS_ALLOWED').and_return('dev,rnd')
allow(ENV).to receive(:[]).with('TEST_TIERS').and_return('dev')
expect(described_class.setup_beaker(task).rspec_opts.to_s).to match(%r{--tag tier_dev})
end Im not entirely sure why Thanks John |
CLA signed by all contributors. |
@b4ldr I'll have 👀 on that tomorrow. |
ah, actually, that's easy. because your code is using |
2effadc
to
0de5995
Compare
@DavidS thanks that was an easy one :), let me know if you want any other changes |
Codecov Report
@@ Coverage Diff @@
## master #253 +/- ##
=========================================
+ Coverage 39.22% 39.3% +0.08%
=========================================
Files 10 10
Lines 719 720 +1
=========================================
+ Hits 282 283 +1
Misses 437 437
Continue to review full report at Codecov.
|
Thank you for your time and work! |
This PR adds support for a new environment variable
TEST_TIERS_ALLOWED
to allow users to override the default list of allowed test teirs