Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/orchestrator/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func Load(appPath string) (ArduinoApp, error) {
return ArduinoApp{}, fmt.Errorf("app path is not valid: %w", err)
}
if !exist {
return ArduinoApp{}, fmt.Errorf("no such file or directory: %s", path)
return ArduinoApp{}, fmt.Errorf("app path must be a directory: %s", path)
}
path, err = path.Abs()
if err != nil {
Expand Down
17 changes: 15 additions & 2 deletions internal/orchestrator/app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,26 @@ import (
)

func TestLoad(t *testing.T) {
t.Run("empty", func(t *testing.T) {
t.Run("it fails if tha app path is empty", func(t *testing.T) {
app, err := Load("")
assert.Error(t, err)
assert.Empty(t, app)
assert.Contains(t, err.Error(), "empty app path")
})

t.Run("AppSimple", func(t *testing.T) {
t.Run("it fails if the app path exist but it's a file", func(t *testing.T) {
_, err := Load("testdata/app.yaml")
assert.Error(t, err)
assert.Contains(t, err.Error(), "app path must be a directory")
})

t.Run("it fails if the app path does not exist", func(t *testing.T) {
_, err := Load("testdata/this-folder-does-not-exist")
assert.Error(t, err)
assert.Contains(t, err.Error(), "app path is not valid")
})

t.Run("it loads an app correctly", func(t *testing.T) {
app, err := Load("testdata/AppSimple")
assert.NoError(t, err)
assert.NotEmpty(t, app)
Expand Down