Fix code to pass tests

This commit is contained in:
Marcel Otte 2022-02-13 00:26:16 +01:00
parent 5b092b1988
commit b8f92c68ba
2 changed files with 2 additions and 1 deletions

View File

@ -52,7 +52,7 @@ func (b *Backup) CanRun() error {
return fmt.Errorf("the setting targetPath MUST exist within a backup configuration")
}
// script must exist, having only script means this is handled in the script
if b.ScriptPath == "" {
if b.ScriptPath == nil {
return fmt.Errorf("the setting scriptPath must exist within a backup configuration")
}
if !b.ShouldRun() {

View File

@ -68,6 +68,7 @@ func TestCanRun(t *testing.T) {
}
err = bkpScriptPathMissing.CanRun()
if err == nil {
t.Logf("ScriptPath is %v", bkpScriptPathMissing.ScriptPath)
t.Log("Missing scriptPath has to fail function 'CanRun()'")
t.Fail()
}