1
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00

Fail the test if the configuration fails.

This commit is contained in:
Makpoc 2015-10-10 04:15:25 +03:00
parent af42d2a54a
commit e66aa25fce

View file

@ -13,18 +13,18 @@ func TestRoot(t *testing.T) {
// Predefined error substrings
parseErrContent := "Parse error:"
unableToAccessErroContent := "Unable to access root path"
unableToAccessErrContent := "Unable to access root path"
existingDirPath, err := getTempDirPath()
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")
existingFile, err := ioutil.TempFile("", "root_test")
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())
@ -48,7 +48,7 @@ func TestRoot(t *testing.T) {
`root `, true, "", parseErrContent,
},
{
fmt.Sprintf(`root %s`, unaccessiblePath), true, "", unableToAccessErroContent,
fmt.Sprintf(`root %s`, unaccessiblePath), true, "", unableToAccessErrContent,
},
{
fmt.Sprintf(`root {