(t *testing.T)
| 34 | ) |
| 35 | |
| 36 | func newPreStartTestService(t *testing.T) (*composeService, *mocks.MockAPIClient) { |
| 37 | t.Helper() |
| 38 | // Register the goroutine-leak check first so it runs last (t.Cleanup is |
| 39 | // LIFO), after gomock's own cleanup has drained any internal goroutines. |
| 40 | // Any goroutine spawned by the code under test that outlives the test will |
| 41 | // fail this assertion. |
| 42 | ignoreExisting := goleak.IgnoreCurrent() |
| 43 | t.Cleanup(func() { |
| 44 | goleak.VerifyNone(t, ignoreExisting) |
| 45 | }) |
| 46 | mockCtrl := gomock.NewController(t) |
| 47 | t.Cleanup(mockCtrl.Finish) |
| 48 | apiClient := mocks.NewMockAPIClient(mockCtrl) |
| 49 | cli := mocks.NewMockCli(mockCtrl) |
| 50 | cli.EXPECT().Client().Return(apiClient).AnyTimes() |
| 51 | apiClient.EXPECT().Ping(gomock.Any(), client.PingOptions{NegotiateAPIVersion: true}). |
| 52 | Return(client.PingResult{APIVersion: "1.44"}, nil).AnyTimes() |
| 53 | apiClient.EXPECT().ClientVersion().Return("1.44").AnyTimes() |
| 54 | tested, err := NewComposeService(cli) |
| 55 | assert.NilError(t, err) |
| 56 | return tested.(*composeService), apiClient |
| 57 | } |
| 58 | |
| 59 | func waitResultExit(code int64) client.ContainerWaitResult { |
| 60 | resultC := make(chan container.WaitResponse, 1) |
no test coverage detected