File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -242,6 +242,36 @@ func TestProjectComposefilesFromWorkingDir(t *testing.T) {
242242 })
243243}
244244
245+ func TestProjectComposefilesFromStdin (t * testing.T ) {
246+ composeData := `
247+ services:
248+ simple:
249+ image: nginx
250+ `
251+ originalStdin := os .Stdin
252+ r , w , _ := os .Pipe ()
253+ defer func () {
254+ os .Stdin = originalStdin
255+ }()
256+
257+ w .WriteString (composeData )
258+ w .Close ()
259+
260+ os .Stdin = r
261+
262+ opts , err := NewProjectOptions (
263+ []string {
264+ "-" ,
265+ }, WithName ("my_project" ),
266+ )
267+ assert .NilError (t , err )
268+ p , err := opts .LoadProject (context .TODO ())
269+ assert .NilError (t , err )
270+ service , err := p .GetService ("simple" )
271+ assert .NilError (t , err )
272+ assert .Equal (t , service .Image , "nginx" )
273+ }
274+
245275func TestProjectWithDotEnv (t * testing.T ) {
246276 wd , err := os .Getwd ()
247277 assert .NilError (t , err )
You can’t perform that action at this time.
0 commit comments