Repository navigation
fix: treat ephemeral containers consistently #276
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -132,6 +132,22 @@ def stub_reporter_loop | |||||||||||||||||||||||||
| _(log_string).must_include "Set api_base_url to enable metrics reporting" | ||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| [ | ||||||||||||||||||||||||||
| ["Heroku release", Platform::Heroku.new("release.1")], | ||||||||||||||||||||||||||
| ["Heroku", Platform::Heroku.new("run.1234")], | ||||||||||||||||||||||||||
| ["Scalingo", Platform::Scalingo.new("one-off-1234")] | ||||||||||||||||||||||||||
| ].each do |platform_name, platform| | ||||||||||||||||||||||||||
| it "does not run the reporter thread in a #{platform_name} ephemeral instance" do | ||||||||||||||||||||||||||
|
Comment on lines
+135
to
+140
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. previous commentMinor suggestion to run a single test for "ephemeral instances" and then if we're testing multiple we loop inside. It's fine though to have individual/separated tests, but generally for single behavior-testing on a few variants, and even slightly perf-gain, I usually lean on that.
Suggested change
Update: it's a bit of a personal opinion and may be controversial, and I also see the node and python packages are doing a similar test, so it's totally cool to leave as-is for consistency across the board. |
||||||||||||||||||||||||||
| Judoscale.configure { |config| config.current_platform = platform } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Reporter.instance.stub(:run_loop, ->(*) { raise "SHOULD NOT BE CALLED" }) { | ||||||||||||||||||||||||||
| Reporter.instance.start!(Config.instance, Judoscale.adapters) | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| _(log_string).must_include "Reporter not started: in an ephemeral container" | ||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| it "does not run the reporter thread when there are no metrics collectors" do | ||||||||||||||||||||||||||
| Reporter.instance.stub(:run_loop, ->(*) { raise "SHOULD NOT BE CALLED" }) { | ||||||||||||||||||||||||||
| Reporter.instance.start!(Config.instance, Judoscale.adapters.select { |a| a.metrics_collector.nil? }) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
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.
No longer needed here since
Reporter#start!has this logic. We're moving it there for parity with Node/Python libs and so this behavior is not Rails-specific.