@@ -79,16 +79,23 @@ func TestComposeUp(t *testing.T) {
7979 res .Assert (t , icmd.Expected {Out : `[{"Name":"compose-kube-demo","Status":"deployed"}]` })
8080 })
8181
82- t .Run ("compose ps" , func (t * testing.T ) {
83- getServiceRegx := func (project string , service string ) string {
82+ t .Run ("compose ps --all " , func (t * testing.T ) {
83+ getServiceRegx := func (service string ) string {
8484 // match output with random hash / spaces like:
85- // myproject- db-698f4dd798-jd9gw db Running
86- return fmt .Sprintf ("%s-%s- .*\\ s+%s\\ s+Pending\\ s+" , project , service , service )
85+ // db-698f4dd798-jd9gw db Running
86+ return fmt .Sprintf ("%s-.*\\ s+%s\\ s+Pending\\ s+" , service , service )
8787 }
88+ res := c .RunDockerCmd ("compose" , "ps" , "-p" , projectName , "--all" )
89+ testify .Regexp (t , getServiceRegx ("db" ), res .Stdout ())
90+ testify .Regexp (t , getServiceRegx ("words" ), res .Stdout ())
91+ testify .Regexp (t , getServiceRegx ("web" ), res .Stdout ())
92+
93+ assert .Equal (t , len (Lines (res .Stdout ())), 4 , res .Stdout ())
94+ })
95+
96+ t .Run ("compose ps hides non running containers" , func (t * testing.T ) {
8897 res := c .RunDockerCmd ("compose" , "ps" , "-p" , projectName )
89- testify .Regexp (t , getServiceRegx (projectName , "db" ), res .Stdout ())
90- testify .Regexp (t , getServiceRegx (projectName , "words" ), res .Stdout ())
91- testify .Regexp (t , getServiceRegx (projectName , "web" ), res .Stdout ())
98+ assert .Equal (t , len (Lines (res .Stdout ())), 1 , res .Stdout ())
9299 })
93100
94101 t .Run ("check running project" , func (t * testing.T ) {
0 commit comments