Skip to content

Commit

Permalink
Cleanup updater specs output
Browse files Browse the repository at this point in the history
Up to now, running updater specs prints a lot of server logs with a lot
of "E" letters that can be confused with spec failures, and it's hard to
process.

This commit adds some bare assertions on the output instead of printing
it, so that it's clean.
  • Loading branch information
deivid-rodriguez committed Sep 9, 2022
1 parent 909fe0b commit f0c39c3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions updater/spec/dependabot/file_fetcher_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
)
expect(api_client).to receive(:mark_job_as_processed)

perform_job
expect { perform_job }.to output(/Error during file fetching; aborting/).to_stdout_from_any_process
end
end

Expand All @@ -94,7 +94,7 @@
)
expect(api_client).to receive(:mark_job_as_processed)

perform_job
expect { perform_job }.to output(/Error during file fetching; aborting/).to_stdout_from_any_process
end
end

Expand Down Expand Up @@ -123,7 +123,7 @@
)
expect(api_client).to receive(:mark_job_as_processed)

perform_job
expect { perform_job }.to output(/Repository is rate limited, attempting to retry/).to_stdout_from_any_process
end
end

Expand Down Expand Up @@ -181,7 +181,7 @@
end
expect(api_client).to receive(:mark_job_as_processed)

perform_job
expect { perform_job }.to output(/Something went wrong/).to_stdout_from_any_process

expect(Dir.exist?(Dependabot::Environment.repo_contents_path)).to be_truthy
expect(Dir.empty?(Dependabot::Environment.repo_contents_path)).to be_truthy
Expand Down
9 changes: 5 additions & 4 deletions updater/spec/dependabot/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,18 +175,18 @@
expect(api_client).to receive(:record_update_job_error).
with(job_id, { error_type: "unknown_error", error_details: nil })

end_to_end_job.run
expect { end_to_end_job.run }.to output(/oh no!/).to_stdout_from_any_process
end

it "indicates there was an error in the summary" do
expect(Dependabot.logger).not_to receive(:info).with(/Changes to Dependabot Pull Requests/)
expect(Dependabot.logger).to receive(:info).with(/Dependabot encountered '1' error/)

end_to_end_job.run
expect { end_to_end_job.run }.to output(/oh no!/).to_stdout_from_any_process
end

it "does not raise an exception" do
expect { end_to_end_job.run }.not_to raise_error
expect { end_to_end_job.run }.to output(/oh no!/).to_stdout_from_any_process
end

context "when GITHUB_ACTIONS is set" do
Expand All @@ -195,7 +195,8 @@
end

it "raises an exception" do
expect { end_to_end_job.run }.to raise_error(Dependabot::RunFailure)
expect { end_to_end_job.run }.to raise_error(Dependabot::RunFailure).
and output(/oh no!/).to_stdout_from_any_process
end
end
end
Expand Down

0 comments on commit f0c39c3

Please sign in to comment.