Skip to content

Commit

Permalink
crond: fixed test on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jkellerer committed Nov 12, 2023
1 parent ba2284c commit ef798d5
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions crond/crontab_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"testing"

"github.com/creativeprojects/resticprofile/calendar"
"github.com/creativeprojects/resticprofile/platform"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -179,14 +180,18 @@ func TestLoadCurrentFromFile(t *testing.T) {
}

func TestLoadCurrent(t *testing.T) {
cmd := exec.Command("go", "build", "-o", "crontab", "./stdin")
require.NoError(t, cmd.Run())

defer func() {
_ = os.Remove(CrontabBinary)
CrontabBinary = DefaultCrontabBinary
_ = os.Remove("./crontab")
}()
cmd := exec.Command("go", "build", "-o", "crontab", "./stdin")
err := cmd.Run()
require.NoError(t, err)
CrontabBinary = "./crontab"
if platform.IsWindows() {
CrontabBinary = "crontab.exe"
} else {
CrontabBinary = "./crontab"
}

crontab := NewCrontab(nil)
assert.NotNil(t, crontab)
Expand Down

0 comments on commit ef798d5

Please sign in to comment.