Skip to content

Commit

Permalink
fixing more feedback from review
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
  • Loading branch information
jjbustamante committed May 20, 2024
1 parent 35cf9be commit 46ec0df
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 9 deletions.
2 changes: 1 addition & 1 deletion acceptance/acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func testWithoutSpecificBuilderRequirement(
})

it.After(func() {
//assert.Nil(os.RemoveAll(tmpDir))
assert.Nil(os.RemoveAll(tmpDir))
})

generateAggregatePackageToml := func(buildpackURI, nestedPackageName, operatingSystem string) string {
Expand Down
1 change: 0 additions & 1 deletion pkg/buildpack/multi_architecture_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ type MultiArchConfig struct {
}

func NewMultiArchConfig(targets []dist.Target, expected []dist.Target, logger logging.Logger) (*MultiArchConfig, error) {
// TODO: Let's do some validations
return &MultiArchConfig{
buildpackTargets: targets,
expectedTargets: expected,
Expand Down
15 changes: 15 additions & 0 deletions pkg/buildpack/multi_architecture_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,21 @@ func testMultiArchConfig(t *testing.T, when spec.G, it spec.S) {
h.AssertEq(t, multiArchConfig.Targets()[0].ArchVariant, "v6")
})
})

when("buildpack targets are defined and flags are provided", func() {
it.Before(func() {
multiArchConfig, err = buildpack.NewMultiArchConfig(targetsFromBuildpack, targetsFromFlags, logger)
h.AssertNil(t, err)
})

it("returns targets from flags", func() {
// flags overrides the targets in the configuration files
h.AssertEq(t, len(multiArchConfig.Targets()), 1)
h.AssertEq(t, multiArchConfig.Targets()[0].OS, "linux")
h.AssertEq(t, multiArchConfig.Targets()[0].Arch, "arm64")
h.AssertEq(t, multiArchConfig.Targets()[0].ArchVariant, "v6")
})
})
})

when("#CopyConfigFiles", func() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/package_buildpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type PackageBuildpackOptions struct {
// Flatten layers
Flatten bool

// List of buildpack images to exclude from the package being flattened.
// List of buildpack images to exclude from being flattened.
FlattenExclude []string

// Map of labels to add to the Buildpack
Expand Down
12 changes: 6 additions & 6 deletions pkg/client/package_buildpack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ func testPackageBuildpack(t *testing.T, when spec.G, it spec.S) {
expectedMultiPlatformImage{digest: newDigest(t, repoName, "sha256:b9d056b83bb6446fee29e89a7fcf10203c562c1f59586a6e2f39c903597bda35")})
})

it("creates a multi-platform buildpack and push it to a registry", func() {
it("creates a multi-platform buildpack and pushes it to a registry", func() {
// Define targets we want to package
targets = []dist.Target{{OS: "linux", Arch: "amd64"}, {OS: "linux", Arch: "arm"}}

Expand Down Expand Up @@ -615,7 +615,7 @@ func testPackageBuildpack(t *testing.T, when spec.G, it spec.S) {
expectedMultiPlatformImage{digest: newDigest(t, repoName, "sha256:b9d056b83bb6446fee29e89a7fcf10203c562c1f59586a6e2f39c903597bda35")})
})

it("creates a multi-platform buildpack and push it to a registry", func() {
it("creates a multi-platform buildpack and pushes it to a registry", func() {
// Define targets we want to package
targets = []dist.Target{{OS: "linux", Arch: "amd64"}, {OS: "linux", Arch: "arm"}}

Expand Down Expand Up @@ -671,7 +671,7 @@ func testPackageBuildpack(t *testing.T, when spec.G, it spec.S) {
{Name: "ubuntu", Version: "21.01"}}}, expectedMultiPlatformImage{digest: newDigest(t, repoName, "sha256:b9d056b83bb6446fee29e89a7fcf10203c562c1f59586a6e2f39c903597bda36")})
})

it("creates a multi-platform buildpack and push it to a registry", func() {
it("creates a multi-platform buildpack and pushes it to a registry", func() {
// Define targets we want to package
targets = []dist.Target{{OS: "linux", Arch: "amd64", ArchVariant: "v5",
Distributions: []dist.Distribution{{Name: "ubuntu", Version: "18.01"}, {Name: "ubuntu", Version: "21.01"}}},
Expand Down Expand Up @@ -755,7 +755,7 @@ func testPackageBuildpack(t *testing.T, when spec.G, it spec.S) {
mockIndexFactory.EXPECT().CreateIndex(gomock.Eq(repoName), gomock.Any()).Return(index, nil)
})

it("creates a multi-platform buildpack and push it to a registry", func() {
it("creates a multi-platform buildpack and pushes it to a registry", func() {
h.AssertNil(t, subject.PackageBuildpack(context.TODO(), client.PackageBuildpackOptions{
Format: client.FormatImage,
Publish: true,
Expand Down Expand Up @@ -802,7 +802,7 @@ func testPackageBuildpack(t *testing.T, when spec.G, it spec.S) {
targets = []dist.Target{target1, target2}
})

it("errors a message", func() {
it("errors with a message", func() {
// If dependencies point to a file or a URL like https://example.com/buildpack.tgz
// we will need to define some conventions to fetch by target
// The OCI registry already solved the problem, that's why we do not allow this path for now
Expand Down Expand Up @@ -1230,7 +1230,7 @@ func prepareExpectedMultiPlaformImages(t *testing.T, mockImageFactory *testmocks
mockImageFetcher.EXPECT().Fetch(gomock.Any(), expected.digest.Name(), gomock.Any()).Return(fakeImage, nil)
}

// prepareRemoteMultiPlatformBuildpackPackage creates remotes buildpack packages requires to create a composite buildapck
// prepareRemoteMultiPlatformBuildpackPackage creates remotes buildpack packages required to create a composite buildapck
// repoName: image index reference name
// digest: manifest digest for the given target
// target: os/arch for the given manifest
Expand Down

0 comments on commit 46ec0df

Please sign in to comment.