Skip to content

Commit

Permalink
chore: fix failing test for local run (#5197)
Browse files Browse the repository at this point in the history
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.
  • Loading branch information
Varun359 authored Aug 16, 2023
1 parent 37a49be commit 86efee6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion internal/pkg/cli/local_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,9 @@ func (o *localRunOpts) runPauseContainer(ctx context.Context, containerPorts map
errCh := make(chan error, 1)

go func() {
errCh <- o.dockerEngine.Run(ctx, runOptions)
if err := o.dockerEngine.Run(ctx, runOptions); err != nil {
errCh <- err
}
}()

// go routine to check if pause container is running
Expand Down
6 changes: 3 additions & 3 deletions internal/pkg/cli/local_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package cli

import (
"context"
"errors"
"fmt"
"testing"
Expand Down Expand Up @@ -365,8 +364,9 @@ func TestLocalRunOpts_Execute(t *testing.T) {
return []string{"mockFeature1"}
},
}
m.mockDockerEngine.EXPECT().IsContainerRunning(mockPauseContainerName)
m.mockDockerEngine.EXPECT().Run(context.Background(), gomock.Any()).Return(testError)
m.mockDockerEngine.EXPECT().IsContainerRunning(mockPauseContainerName).AnyTimes()
m.mockDockerEngine.EXPECT().Run(gomock.Any(), gomock.Any()).Return(testError)

},
wantedError: fmt.Errorf("run pause container: %w", testError),
},
Expand Down

0 comments on commit 86efee6

Please sign in to comment.