github.com/bkosm/gompose/v2@v2.3.1/readyonlog_test.go (about) 1 package gompose 2 3 import ( 4 "fmt" 5 "testing" 6 "time" 7 ) 8 9 func TestReadyOnLog(t *testing.T) { 10 t.Run("ready on log pushes compose logs into ReadyOnStdout", func(t *testing.T) { 11 testUp(t) 12 defer testDown(t) 13 14 rc := ReadyOnLog(expectedLogLine, customFileOpt) 15 16 select { 17 case err := <-rc: 18 assertNoError(t, err) 19 case <-time.After(2 * time.Minute): 20 t.Fatal("time out waiting on compose (might be pulling the image)") 21 } 22 }) 23 } 24 25 func ExampleReadyOnLog() { 26 customFile := CustomFile("./testdata/docker-compose.yml") 27 _ = Up(customFile) 28 ch := ReadyOnLog(expectedLogLine, customFile) 29 30 <-ch 31 fmt.Println("the service is up now") 32 // Output: 33 // the service is up now 34 35 _ = Down(customFileOpt) 36 }