-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Create feature flag for Grouped security updates #8529
Changes from 2 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 |
---|---|---|
|
@@ -209,8 +209,12 @@ | |
context "when there is an exception that blocks PR creation (cloud)" do | ||
before do | ||
allow(api_client).to receive(:create_pull_request).and_raise(StandardError, "oh no!") | ||
allow(Dependabot::Experiments).to receive(:enabled?).with(:record_ecosystem_versions).and_return(true) | ||
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. As far as I can tell doing it this way really only worked while we had a single call against |
||
allow(Dependabot::Experiments).to receive(:enabled?).with(:record_update_job_unknown_error).and_return(true) | ||
Dependabot::Experiments.register(:record_ecosystem_versions, true) | ||
Dependabot::Experiments.register(:record_update_job_unknown_error, true) | ||
end | ||
|
||
after do | ||
Dependabot::Experiments.reset! | ||
end | ||
|
||
it "notifies Dependabot API of the problem" do | ||
|
@@ -258,8 +262,6 @@ | |
|
||
context "when there is an exception that blocks PR creation (ghes)" do | ||
before do | ||
allow(Dependabot::Experiments).to receive(:enabled?).with(:record_ecosystem_versions).and_return(false) | ||
allow(Dependabot::Experiments).to receive(:enabled?).with(:record_update_job_unknown_error).and_return(false) | ||
allow(api_client).to receive(:create_pull_request).and_raise(StandardError, "oh no!") | ||
end | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,11 @@ | |
end | ||
|
||
before do | ||
allow(Dependabot::Experiments).to receive(:enabled?).with(:record_update_job_unknown_error).and_return(true) | ||
Dependabot::Experiments.register(:record_update_job_unknown_error, true) | ||
end | ||
|
||
after do | ||
Dependabot::Experiments.reset! | ||
end | ||
|
||
it "records the error with both update job error api services, logs the backtrace and captures the exception" do | ||
|
@@ -115,10 +119,6 @@ | |
end | ||
end | ||
|
||
before do | ||
allow(Dependabot::Experiments).to receive(:enabled?).with(:record_update_job_unknown_error).and_return(false) | ||
end | ||
|
||
it "records error with only update job error api service, logs the backtrace and captures the exception" do | ||
expect(mock_service).to_not receive(:record_update_job_unknown_error) | ||
|
||
|
@@ -162,7 +162,11 @@ | |
end | ||
|
||
before do | ||
allow(Dependabot::Experiments).to receive(:enabled?).with(:record_update_job_unknown_error).and_return(true) | ||
Dependabot::Experiments.register(:record_update_job_unknown_error, true) | ||
end | ||
|
||
after do | ||
Dependabot::Experiments.reset! | ||
end | ||
|
||
it "records the error with the service and logs the backtrace" do | ||
|
@@ -232,10 +236,6 @@ | |
end | ||
end | ||
|
||
before do | ||
allow(Dependabot::Experiments).to receive(:enabled?).with(:record_update_job_unknown_error).and_return(false) | ||
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. These explicit mocks were not needed once we stop mocking (default to false), so I deleted them. |
||
end | ||
|
||
it "records the error with the service and logs the backtrace" do | ||
expect(mock_service).to receive(:record_update_job_error).with( | ||
error_type: "unknown_error", | ||
|
@@ -310,7 +310,11 @@ | |
end | ||
|
||
before do | ||
allow(Dependabot::Experiments).to receive(:enabled?).with(:record_update_job_unknown_error).and_return(true) | ||
Dependabot::Experiments.register(:record_update_job_unknown_error, true) | ||
end | ||
|
||
after do | ||
Dependabot::Experiments.reset! | ||
end | ||
|
||
it "records the error with the update job error services, logs the backtrace and captures the exception" do | ||
|
@@ -360,10 +364,6 @@ | |
end | ||
end | ||
|
||
before do | ||
allow(Dependabot::Experiments).to receive(:enabled?).with(:record_update_job_unknown_error).and_return(false) | ||
end | ||
|
||
it "records the error with the update job error services, logs the backtrace and captures the exception" do | ||
expect(mock_service).to receive(:record_update_job_error).with( | ||
error_type: "unknown_error", | ||
|
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.
I recognize that it's a bit weird to phrase it like this, but I need the default case to be grouped_security_updates being on and the way Dependabot::Experiments works is it's falsy by default.