github.com/bkosm/gompose/v2@v2.3.1/down_test.go (about) 1 package gompose 2 3 import ( 4 "fmt" 5 "testing" 6 "time" 7 ) 8 9 func TestDown(t *testing.T) { 10 t.Run("down fails if there is no file", func(t *testing.T) { 11 t.Parallel() 12 13 err := Down() 14 assertError(t, err) 15 }) 16 17 t.Run("down does not fail if there was no up before", func(t *testing.T) { 18 err := Down(customFileOpt) 19 assertNoError(t, err) 20 }) 21 22 t.Run("down cleans up after a successful setup", func(t *testing.T) { 23 testUp(t) 24 assertEventually(t, serviceIsUp, time.Second, 50*time.Millisecond) 25 26 err := Down(customFileOpt) 27 assertNoError(t, err) 28 assertServiceIsDown(t) 29 }) 30 } 31 32 func ExampleDown() { 33 err := Down(CustomFile("./testdata/docker-compose.yml")) 34 fmt.Print(err) 35 36 // Output: 37 // <nil> 38 }