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 <idsulik@gmail.com>
  • Loading branch information
idsulik authored and glours committed Oct 30, 2024
1 parent 8d176cf commit 0e87616
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions cli/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,36 @@ func TestProjectComposefilesFromWorkingDir(t *testing.T) {
})
}

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

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 0e87616

Please sign in to comment.