From b98c89fbb6352d98deb8ace26134d4aa9de37114 Mon Sep 17 00:00:00 2001 From: a Date: Tue, 18 Jun 2024 19:46:43 -0500 Subject: [PATCH] noot --- caddytest/caddytest_assert.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/caddytest/caddytest_assert.go b/caddytest/caddytest_assert.go index d81764d66..359538ad3 100644 --- a/caddytest/caddytest_assert.go +++ b/caddytest/caddytest_assert.go @@ -10,12 +10,18 @@ import ( "github.com/aryann/difflib" "github.com/caddyserver/caddy/v2/caddyconfig" + "github.com/stretchr/testify/require" ) // AssertLoadError will load a config and expect an error func AssertLoadError(t *testing.T, rawConfig string, configType string, expectedError string) { - tc := StartHarness(t) - err := tc.tester.LoadConfig(rawConfig, configType) + tc, err := NewTester() + require.NoError(t, err) + err = tc.LaunchCaddy() + require.NoError(t, err) + defer tc.CleanupCaddy() + + err = tc.LoadConfig(rawConfig, configType) if !strings.Contains(err.Error(), expectedError) { t.Errorf("expected error \"%s\" but got \"%s\"", expectedError, err.Error()) }