Skip to content

Commit 86efee6

Browse files
authored
chore: fix failing test for local run (#5197)
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.
1 parent 37a49be commit 86efee6

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

internal/pkg/cli/local_run.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,9 @@ func (o *localRunOpts) runPauseContainer(ctx context.Context, containerPorts map
340340
errCh := make(chan error, 1)
341341

342342
go func() {
343-
errCh <- o.dockerEngine.Run(ctx, runOptions)
343+
if err := o.dockerEngine.Run(ctx, runOptions); err != nil {
344+
errCh <- err
345+
}
344346
}()
345347

346348
// go routine to check if pause container is running

internal/pkg/cli/local_run_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
package cli
55

66
import (
7-
"context"
87
"errors"
98
"fmt"
109
"testing"
@@ -365,8 +364,9 @@ func TestLocalRunOpts_Execute(t *testing.T) {
365364
return []string{"mockFeature1"}
366365
},
367366
}
368-
m.mockDockerEngine.EXPECT().IsContainerRunning(mockPauseContainerName)
369-
m.mockDockerEngine.EXPECT().Run(context.Background(), gomock.Any()).Return(testError)
367+
m.mockDockerEngine.EXPECT().IsContainerRunning(mockPauseContainerName).AnyTimes()
368+
m.mockDockerEngine.EXPECT().Run(gomock.Any(), gomock.Any()).Return(testError)
369+
370370
},
371371
wantedError: fmt.Errorf("run pause container: %w", testError),
372372
},

0 commit comments

Comments
 (0)