Skip to content

Commit

Permalink
test: delete existing config at end of test run
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammed90 committed Jun 20, 2024
1 parent c2ccf86 commit 55bd9da
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions caddytest/caddytest.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,15 @@ func (tc *Tester) initServer(rawConfig string, configType string) error {
_ = json.Indent(&out, body, "", " ")
tc.t.Logf("----------- failed with config -----------\n%s", out.String())
}
tc.t.Log("deleting existing config in test cleanup")
deleteRequest, _ := http.NewRequest(http.MethodDelete, fmt.Sprintf("http://localhost:%d/config/", Default.AdminPort), nil)
res, err := tc.Client.Do(deleteRequest)

Check failure on line 138 in caddytest/caddytest.go

View workflow job for this annotation

GitHub Actions / lint (linux)

response body must be closed (bodyclose)
if err != nil {
tc.t.Logf("failed to delete existing config: %s", err)
}
if res != nil {
_, _ = io.Copy(io.Discard, res.Body)
}
})

rawConfig = prependCaddyFilePath(rawConfig)
Expand Down

0 comments on commit 55bd9da

Please sign in to comment.