Skip to content

Commit

Permalink
log base commit for easier debugging (dependabot#9654)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakecoffman authored May 3, 2024
1 parent a549c93 commit ad8047f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions updater/lib/dependabot/file_fetcher_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def perform_job # rubocop:disable Metrics/PerceivedComplexity,Metrics/AbcSize
return nil
end

Dependabot.logger.info("Base commit SHA: #{@base_commit_sha}")
File.write(Environment.output_path, JSON.dump(
base64_dependency_files: base64_dependency_files.map(&:to_h),
base_commit_sha: @base_commit_sha
Expand Down
13 changes: 9 additions & 4 deletions updater/spec/dependabot/file_fetcher_command_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,12 @@
end

it "logs connectivity is successful and does not raise an error" do
expect(Dependabot.logger).to receive(:info).with(/Connectivity check starting/)
expect(Dependabot.logger).to receive(:info).with(/Connectivity check successful/)
allow(Dependabot.logger).to receive(:info)

expect { perform_job }.not_to raise_error

expect(Dependabot.logger).to have_received(:info).with(/Connectivity check starting/)
expect(Dependabot.logger).to have_received(:info).with(/Connectivity check successful/)
end

context "when connectivity is broken" do
Expand All @@ -350,10 +352,13 @@
end

it "logs connectivity failed and does not raise an error" do
expect(Dependabot.logger).to receive(:info).with(/Connectivity check starting/)
expect(Dependabot.logger).to receive(:error).with(/Connectivity check failed/)
allow(Dependabot.logger).to receive(:info)
allow(Dependabot.logger).to receive(:error)

expect { perform_job }.not_to raise_error

expect(Dependabot.logger).to have_received(:info).with(/Connectivity check starting/)
expect(Dependabot.logger).to have_received(:error).with(/Connectivity check failed/)
end
end
end
Expand Down

0 comments on commit ad8047f

Please sign in to comment.