Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ test-unit:

test-integration:
mkdir -p tests/results-integration
$(GO) test $(GO_MOD_FLAGS) $(GO_BUILD_FLAGS) -coverprofile=tests/results-integration/cover-additional.out -race -count=1 ./internal/pkg/... -run TestIntegrationAdditional
$(GO) test $(GO_MOD_FLAGS) $(GO_BUILD_FLAGS) -coverprofile=tests/results-integration/cover-release.out -race -count=1 ./internal/pkg/... -run TestIntegrationRelease
$(GO) test $(GO_MOD_FLAGS) $(GO_BUILD_FLAGS) -coverprofile=tests/results-integration/cover-additional.out -race -count=1 ./internal/pkg/... -run 'TestIntegrationAdditional$'
$(GO) test $(GO_MOD_FLAGS) $(GO_BUILD_FLAGS) -coverprofile=tests/results-integration/cover-release.out -race -count=1 ./internal/pkg/... -run 'TestIntegrationRelease$'
Comment on lines +55 to +56
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two ran the M2M tests as well

$(GO) test $(GO_MOD_FLAGS) $(GO_BUILD_FLAGS) -coverprofile=tests/results-integration/cover-additional.out -race -count=1 ./internal/pkg/... -run TestIntegrationAdditionalM2M
$(GO) test $(GO_MOD_FLAGS) $(GO_BUILD_FLAGS) -coverprofile=tests/results-integration/cover-release.out -race -count=1 ./internal/pkg/... -run TestIntegrationReleaseM2M
make -C v1 test-integration
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/cli/release_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (suite *TestEnvironmentRelease) runMirror2Disk(t *testing.T) {
err := os.MkdirAll(resultFolder, 0755)
assert.NoError(t, err, "should not fail creating a temp folder for results")

ocmirror.SetArgs([]string{"-c", suite.tempFolder + "/isc.yaml", "--v2", "-p", "56001", "--src-tls-verify=false", "--dest-tls-verify=false", "file://" + resultFolder})
ocmirror.SetArgs([]string{"-c", suite.tempFolder + "/isc.yaml", "--v2", "-p", "56001", "--src-tls-verify=false", "--dest-tls-verify=false", "--remove-signatures", "file://" + resultFolder})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to add, otherwise fails on pulling the sig

err = ocmirror.Execute()
assert.NoError(t, err, "should not fail executing oc-mirror")

Expand Down
13 changes: 13 additions & 0 deletions internal/testutils/testutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"os"
"path"
"path/filepath"
"runtime"
"strings"
"text/template"

Expand All @@ -23,6 +24,7 @@ import (
v1 "github.com/google/go-containerregistry/pkg/v1"
"github.com/google/go-containerregistry/pkg/v1/empty"
"github.com/google/go-containerregistry/pkg/v1/layout"
"github.com/google/go-containerregistry/pkg/v1/mutate"
"github.com/google/go-containerregistry/pkg/v1/remote"
"github.com/openshift/oc-mirror/v2/internal/pkg/image"
)
Expand Down Expand Up @@ -127,6 +129,17 @@ func buildAndPushFakeImage(content map[string][]byte, imgRef string, dir string)
return "", err
}
i, _ := crane.Image(content)
// Set the platform to match the local GOARCH
cfg, err := i.ConfigFile()
if err != nil {
return "", err
}
cfg.OS = runtime.GOOS
cfg.Architecture = runtime.GOARCH
i, err = mutate.ConfigFile(i, cfg)
Comment on lines +137 to +139
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not get this to work on linux/ppc64le without adding the mutate.ConfigFile with the arch/OS

if err != nil {
return "", err
}
if err := crane.Push(i, tag.String()); err != nil {
return "", err
}
Expand Down