Skip to content

Commit

Permalink
Add a test for two overlapping groups
Browse files Browse the repository at this point in the history
  • Loading branch information
brrygrdn committed May 4, 2023
1 parent 3fef015 commit b2fb42b
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def perform
def run_grouped_dependency_updates
Dependabot.logger.info("Starting grouped update job for #{job.source.repo}")

Dependabot.logger.info("Found #{dependency_snapshot.groups.count} group(s).")

dependency_snapshot.groups.each do |_group_hash, group|
Dependabot.logger.info("Starting update group for '#{group.name}'")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,40 @@
end
end

context "when there are two overlapping groups" do
let(:job_definition) do
job_definition_fixture("bundler/version_updates/group_update_all_overlapping_groups")
end

let(:dependency_files) do
original_bundler_files
end

before do
stub_rubygems_calls
end

it "creates a pull request for each containing the same dependencies" do
allow(Dependabot.logger).to receive(:info)
expect(Dependabot.logger).to receive(:info).with(
"Found 2 group(s)."
)

expect(mock_error_handler).not_to receive(:handle_dependabot_error)
expect(mock_service).to receive(:create_pull_request) do |dependency_change|
expect(dependency_change.dependency_group.name).to eql("my-group")
expect(dependency_change.updated_dependency_files_hash).to eql(updated_bundler_files_hash)
end

expect(mock_service).to receive(:create_pull_request) do |dependency_change|
expect(dependency_change.dependency_group.name).to eql("my-overlapping-group")
expect(dependency_change.updated_dependency_files_hash).to eql(updated_bundler_files_hash)
end

group_update_all.perform
end
end

context "when nothing in the group needs to be updated" do
let(:job_definition) do
job_definition_fixture("bundler/version_updates/group_update_all")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
job:
package-manager: bundler
source:
provider: github
repo: dependabot/smoke-tests
directory: "/bundler"
branch:
api-endpoint: https://api.github.com/
hostname: github.com
dependencies:
existing-pull-requests: []
updating-a-pull-request: false
lockfile-only: false
update-subdependencies: false
ignore-conditions: []
requirements-update-strategy:
allowed-updates:
- dependency-type: direct
update-type: all
credentials-metadata:
- type: git_source
host: github.com
security-advisories: []
max-updater-run-time: 2700
vendor-dependencies: false
experiments:
grouped-updates-prototype: true
reject-external-code: false
commit-message-options:
prefix:
prefix-development:
include-scope:
security-updates-only: false
dependency-groups:
- name: my-group
rules:
patterns:
- "dummy-pkg-*"
- name: my-overlapping-group
rules:
patterns:
- "dummy-pkg-*"

0 comments on commit b2fb42b

Please sign in to comment.