Skip to content

Commit

Permalink
fixed mocks
Browse files Browse the repository at this point in the history
Signed-off-by: Rashad Sirajudeen <[email protected]>
  • Loading branch information
rashadism committed Jun 14, 2024
1 parent 0ccb347 commit c00a832
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
1 change: 0 additions & 1 deletion internal/commands/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ This option may set DOCKER_HOST environment variable for the build container if
cmd.Flags().MarkHidden("sparse")
}
}

}

func validateBuildFlags(flags *BuildFlags, cfg config.Config, inputImageRef client.InputImageReference, logger logging.Logger) error {
Expand Down
14 changes: 14 additions & 0 deletions internal/commands/testmocks/mock_pack_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions internal/fakes/fake_lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ func (f *FakeLifecycle) Execute(ctx context.Context, opts build.LifecycleOptions
f.Opts = opts
return nil
}

func (f *FakeLifecycle) Detect(ctx context.Context, opts build.LifecycleOptions) error {
f.Opts = opts
return nil
}
5 changes: 1 addition & 4 deletions pkg/client/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package client
import (
"context"
"fmt"

"github.com/docker/docker/api/types"
)

func (c *Client) Detect(ctx context.Context, opts BuildOptions) error {
Expand All @@ -13,8 +11,7 @@ func (c *Client) Detect(ctx context.Context, opts BuildOptions) error {
return err
}

defer c.docker.ImageRemove(context.Background(), lifecycleOpts.LifecycleImage, types.ImageRemoveOptions{Force: true})
defer c.docker.ImageRemove(context.Background(), lifecycleOpts.Builder.Name(), types.ImageRemoveOptions{Force: true})
// TODO: Cleanup

if err = c.lifecycleExecutor.Detect(ctx, *lifecycleOpts); err != nil {
return fmt.Errorf("executing detect: %w", err)
Expand Down

0 comments on commit c00a832

Please sign in to comment.