Skip to content

chore: improve testing coverage on ExtractProvisionerDaemonAuthenticated middleware #15622

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 8 commits into from
Nov 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
improve testing coverage
  • Loading branch information
defelmnq committed Nov 22, 2024
commit 13d6dd91eb97abbc197d665f847706279c8c1f2a
4 changes: 2 additions & 2 deletions coderd/httpmw/provisionerdaemon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,11 @@ func TestExtractProvisionerDaemonAuthenticated(t *testing.T) {
r.Header.Set(codersdk.ProvisionerDaemonPSK, test.provisionerPSK)
}

httpmw.ExtractProvisionerDaemonAuthenticated(test.opts)(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
httpmw.ExtractProvisionerDaemonAuthenticated(test.opts)(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusOK)
})).ServeHTTP(res, r)

//nolint:bodyclose
require.Equal(t, test.expectedStatusCode, res.Result().StatusCode)
if test.expectedResponseMessage != "" {
require.Contains(t, res.Body.String(), test.expectedResponseMessage)
Expand Down Expand Up @@ -215,5 +216,4 @@ func TestExtractProvisionerDaemonAuthenticated(t *testing.T) {
// require.Equal(t, http.StatusUnauthorized, res.Result().StatusCode)
// require.Contains(t, res.Body.String(), "provisioner daemon key invalid")
// })

}
Loading