All checks were successful
continuous-integration/drone/push Build is passing
See #792
39 lines
587 B
Go
39 lines
587 B
Go
package recipe
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"coopcloud.tech/abra/pkg/test"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestIsDirty(t *testing.T) {
|
|
test.Setup()
|
|
t.Cleanup(func() { test.Teardown() })
|
|
|
|
r := Get(test.RecipeName)
|
|
if err := r.EnsureExists(); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
assert.False(t, r.Dirty)
|
|
|
|
fpath := filepath.Join(r.Dir, "foo.txt")
|
|
f, err := os.Create(fpath)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
defer f.Close()
|
|
t.Cleanup(func() { os.Remove(fpath) })
|
|
|
|
dirty, err := r.IsDirty()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
assert.True(t, dirty)
|
|
}
|