Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: manage health settings using Coder API #10861

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

Merged
merged 11 commits into from
Nov 28, 2023
Merged

Conversation

mtojek
Copy link
Member

@mtojek mtojek commented Nov 24, 2023

Related: #10712

This PR exposes new API endpoints to modify health page settings.

Follow-up:

  • Expose dismissed property via /debug/health

@mtojek mtojek self-assigned this Nov 24, 2023
@mtojek mtojek marked this pull request as ready for review November 28, 2023 12:28
@mtojek mtojek requested a review from johnstcn November 28, 2023 12:28
Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

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

LGTM, just a couple things I'd like to see added first.

@@ -232,6 +233,52 @@ func TestDebugHealth(t *testing.T) {
})
}

func TestHealthSettings(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

  1. Can we add a test case where we un-dismiss?
  2. This should be audited, so we want to add an auditor and assert that an audit action took place.

Copy link
Member Author

Choose a reason for hiding this comment

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

This should be audited, so we want to add an auditor and assert that an audit action took place.

Do you know any good code examples I can review first?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

  1. Undismiss test case done

Copy link
Member Author

Choose a reason for hiding this comment

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

  1. I added support for auditing, but I have no idea if this is sufficient. Keep in mind that "health settings" are stored as site configs, so in this case, the resource (and its ID) is artificial.

Copy link
Member

Choose a reason for hiding this comment

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

You can add a mock auditor into the unit tests and assert that the changes were audited as expected.

@mtojek mtojek requested a review from johnstcn November 28, 2023 15:29
@mtojek mtojek merged commit 19b6d19 into main Nov 28, 2023
@mtojek mtojek deleted the 10712-api-health-settings branch November 28, 2023 17:15
@github-actions github-actions bot locked and limited conversation to collaborators Nov 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants