Skip to content
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

Even more silent Job API #2695

Merged
merged 3 commits into from Mar 20, 2024
Merged

Even more silent Job API #2695

merged 3 commits into from Mar 20, 2024

Conversation

triarius
Copy link
Contributor

@triarius triarius commented Mar 20, 2024

Description

I've made a few PRs to reduce the amount of logging that the job api does. But I kept missing a few places. This PR should fix that, and for good measure I've added a test to make sure that the job api doesn't log anything unless in debug mode. To test that the tests work, the commit that introduces the tests should fail and that failure should be fixed by the next commit.

In particular, it should stop printing the message that the Job API server has shut down. This was difficult to see if log headers (e.g. +++, ~~~, etc) are being used in a job as it's often hidden in the last log group. But it's still an annoyance if log groups are not being used.

Context

#2690
#2662

Changes

  • The Job API should no longer print anything to the job logs unless in debug mode.

Testing

  • Tests have run locally (with go test ./...). Buildkite employees may check this if the pipeline has run automatically.
  • Code is formatted (with go fmt ./...)

@triarius triarius changed the title Even more silend job api Even more silent Job API Mar 20, 2024
@triarius triarius requested a review from a team March 20, 2024 02:23
assert.NilError(t, srv.Stop())

logs := logBuf.String()
assert.Check(t, strings.Contains(logs, "~~~ Job API"), "logs: %q", logs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the test names need swapping?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep 🤦‍♂️. It's fixed now.

The Job API should not print anything to the job logs unless in debug
mode. This is not currently the case, but it will be fixed in a later
commit. The test will succeed once the fix is in place.
Unless if in debug mode
@triarius triarius force-pushed the triarius/even-more-silent-job-api branch from 0f2416c to a7ff25a Compare March 20, 2024 09:52
@triarius triarius merged commit 00fe547 into main Mar 20, 2024
1 check passed
@triarius triarius deleted the triarius/even-more-silent-job-api branch March 20, 2024 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants