Skip to content

Commit

Permalink
Add test to options_test.go
Browse files Browse the repository at this point in the history
Signed-off-by: Suleiman Dibirov <[email protected]>
  • Loading branch information
idsulik committed Oct 30, 2024
1 parent b377c30 commit f603025
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions cli/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,35 @@ func TestProjectComposefilesFromWorkingDir(t *testing.T) {
})
}

func TestProjectComposefilesFromStdin(t *testing.T) {
composeData := `
services:
simple:
image: nginx
`
r, w, _ := os.Pipe()
defer func() {
os.Stdin = r
}()

w.WriteString(composeData)
w.Close()

os.Stdin = r

opts, err := NewProjectOptions(
[]string{
"-",
}, WithName("my_project"),
)
assert.NilError(t, err)
p, err := opts.LoadProject(context.TODO())
assert.NilError(t, err)
service, err := p.GetService("simple")
assert.NilError(t, err)
assert.Equal(t, service.Image, "nginx")
}

func TestProjectWithDotEnv(t *testing.T) {
wd, err := os.Getwd()
assert.NilError(t, err)
Expand Down

0 comments on commit f603025

Please sign in to comment.