Skip to content

Commit

Permalink
Fix acceptance by skipping test if feature not supported
Browse files Browse the repository at this point in the history
Signed-off-by: Natalie Arellano <[email protected]>
  • Loading branch information
natalieparellano committed May 20, 2024
1 parent d81ec16 commit 6f50db6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions acceptance/acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2512,6 +2512,7 @@ include = [ "*.jar", "media/mountain.jpg", "/media/person.png", ]
when("--platform", func() {
wrongArch := "arm64"
it.Before(func() {
h.SkipIf(t, !pack.SupportsFeature(invoke.PlatformOption), "")
h.SkipIf(t, imageManager.HostOS() == "windows", "Not relevant on windows")
if hostArch := imageManager.HostArch(); hostArch == wrongArch {
wrongArch = "amd64"
Expand Down
4 changes: 4 additions & 0 deletions acceptance/invoke/pack.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ const (
FlattenBuilderCreationV2
FixesRunImageMetadata
ManifestCommands
PlatformOption
)

var featureTests = map[Feature]func(i *PackInvoker) bool{
Expand Down Expand Up @@ -278,6 +279,9 @@ var featureTests = map[Feature]func(i *PackInvoker) bool{
ManifestCommands: func(i *PackInvoker) bool {
return i.atLeast("v0.34.0")
},
PlatformOption: func(i *PackInvoker) bool {
return i.atLeast("v0.34.0")
},
}

func (i *PackInvoker) SupportsFeature(f Feature) bool {
Expand Down
4 changes: 2 additions & 2 deletions pkg/client/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ func (c *Client) Build(ctx context.Context, opts BuildOptions) error {

platformToUse := opts.Platform
if platformToUse == "" {
platformToUse = fmt.Sprintf("%s/%s", builderOS, builderArch) // TODO: what about arch variant, etc.
platformToUse = fmt.Sprintf("%s/%s", builderOS, builderArch) // FIXME: what about arch variant, etc.
}

bldr, err := c.getBuilder(rawBuilderImage)
Expand Down Expand Up @@ -1231,7 +1231,7 @@ func (c *Client) fetchBuildpack(ctx context.Context, bp string, relativeBaseDir

platformToUse := opts.Platform
if platformToUse == "" {
platformToUse = fmt.Sprintf("%s/%s", builderOS, builderArch) // TODO: what about arch variant, etc.
platformToUse = fmt.Sprintf("%s/%s", builderOS, builderArch) // FIXME: what about arch variant, etc.
}

downloadOptions := buildpack.DownloadOptions{
Expand Down

0 comments on commit 6f50db6

Please sign in to comment.