This commit is contained in:
a 2024-06-18 20:14:51 -05:00
parent b491fc5d6c
commit 41a4320fd3
No known key found for this signature in database
GPG Key ID: 374BC539FE795AF0
2 changed files with 3 additions and 5 deletions

View File

@ -93,7 +93,6 @@ func (tc *Tester) CleanupCaddy() error {
if err != nil { if err != nil {
return fmt.Errorf("couldn't stop caddytest server: %w", err) return fmt.Errorf("couldn't stop caddytest server: %w", err)
} }
time.Sleep(200 * time.Millisecond)
for retries := 0; retries < 10; retries++ { for retries := 0; retries < 10; retries++ {
if isCaddyAdminRunning() != nil { if isCaddyAdminRunning() != nil {
return nil return nil
@ -206,8 +205,8 @@ func (tc *Tester) startServer() error {
caddycmd.Main() caddycmd.Main()
}() }()
// wait for caddy admin api to start. it should happen quickly. // wait for caddy admin api to start. it should happen quickly.
for retries := 3; retries > 0 && isCaddyAdminRunning() != nil; retries-- { for retries := 10; retries > 0 && isCaddyAdminRunning() != nil; retries-- {
time.Sleep(1 * time.Second) time.Sleep(100 * time.Millisecond)
} }
// one more time to return the error // one more time to return the error

View File

@ -24,8 +24,7 @@ func AssertLoadError(t *testing.T, rawConfig string, configType string, expected
if !strings.Contains(err.Error(), expectedError) { if !strings.Contains(err.Error(), expectedError) {
t.Errorf("expected error \"%s\" but got \"%s\"", expectedError, err.Error()) t.Errorf("expected error \"%s\" but got \"%s\"", expectedError, err.Error())
} }
err = tc.CleanupCaddy() tc.CleanupCaddy()
require.NoError(t, err)
} }
// CompareAdapt adapts a config and then compares it against an expected result // CompareAdapt adapts a config and then compares it against an expected result