mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-13 22:36:27 +03:00
noot
This commit is contained in:
parent
2619271a5c
commit
b98c89fbb6
1 changed files with 8 additions and 2 deletions
|
@ -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())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue