Skip to content

Commit

Permalink
test case checking we manage empty files
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas De Loof <[email protected]>
  • Loading branch information
ndeloof committed Nov 8, 2023
1 parent 8df318e commit b82a7be
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions loader/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2081,6 +2081,18 @@ services:
assert.NilError(t, err)
}

func TestEmptyFile(t *testing.T) {
_, err := LoadWithContext(context.TODO(),
types.ConfigDetails{
ConfigFiles: []types.ConfigFile{
{
Filename: filepath.Join("testdata", "empty.yaml"),
},
},
})
assert.Error(t, err, "empty compose file")
}

func TestLoadServiceWithEnvFile(t *testing.T) {
file, err := os.CreateTemp("", "test-compose-go")
assert.NilError(t, err)
Expand Down
1 change: 1 addition & 0 deletions loader/testdata/empty.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Empty file

0 comments on commit b82a7be

Please sign in to comment.