mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-06 22:40:31 -05:00
Fail the test if the configuration fails.
This commit is contained in:
parent
af42d2a54a
commit
e66aa25fce
1 changed files with 4 additions and 4 deletions
|
@ -13,18 +13,18 @@ func TestRoot(t *testing.T) {
|
||||||
|
|
||||||
// Predefined error substrings
|
// Predefined error substrings
|
||||||
parseErrContent := "Parse error:"
|
parseErrContent := "Parse error:"
|
||||||
unableToAccessErroContent := "Unable to access root path"
|
unableToAccessErrContent := "Unable to access root path"
|
||||||
|
|
||||||
existingDirPath, err := getTempDirPath()
|
existingDirPath, err := getTempDirPath()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("BeforeTest: Failed to find an existing directory for testing! Error was: %v", err)
|
t.Fatalf("BeforeTest: Failed to find an existing directory for testing! Error was: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
nonExistingDir := filepath.Join(existingDirPath, "highly_unlikely_to_exist_dir")
|
nonExistingDir := filepath.Join(existingDirPath, "highly_unlikely_to_exist_dir")
|
||||||
|
|
||||||
existingFile, err := ioutil.TempFile("", "root_test")
|
existingFile, err := ioutil.TempFile("", "root_test")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("BeforeTest: Failed to create temp file for testing! Error was: %v", err)
|
t.Fatalf("BeforeTest: Failed to create temp file for testing! Error was: %v", err)
|
||||||
}
|
}
|
||||||
defer os.Remove(existingFile.Name())
|
defer os.Remove(existingFile.Name())
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ func TestRoot(t *testing.T) {
|
||||||
`root `, true, "", parseErrContent,
|
`root `, true, "", parseErrContent,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fmt.Sprintf(`root %s`, unaccessiblePath), true, "", unableToAccessErroContent,
|
fmt.Sprintf(`root %s`, unaccessiblePath), true, "", unableToAccessErrContent,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fmt.Sprintf(`root {
|
fmt.Sprintf(`root {
|
||||||
|
|
Loading…
Reference in a new issue