Skip to content

Commit f0f0c2c

Browse files
authored
Merge pull request #2703 from lsm5/integration-test-binary-path
test-integration-local: use SKOPEO_BINARY if set
2 parents 96eabba + a489ea3 commit f0f0c2c

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

Makefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,15 @@ test-integration:
201201
$(MAKE) test-integration-local
202202

203203

204+
# Helper target to set up SKOPEO_BINARY variable for local test targets
205+
.eval-skopeo-binary: $(if $(SKOPEO_BINARY),,bin/skopeo)
206+
$(eval SKOPEO_BINARY := $(or $(SKOPEO_BINARY),./bin/skopeo))
207+
@echo "Testing with $(SKOPEO_BINARY) ..."
208+
204209
# Primarily intended for CI.
205-
test-integration-local: bin/skopeo
210+
test-integration-local: .eval-skopeo-binary
206211
hack/warn-destructive-tests.sh
207-
$(MAKE) PREFIX=/usr install
208-
cd ./integration && $(GO) test $(SKOPEO_LDFLAGS) $(TESTFLAGS) $(if $(BUILDTAGS),-tags "$(BUILDTAGS)")
212+
cd ./integration && SKOPEO_BINARY="$(abspath $(SKOPEO_BINARY))" $(GO) test $(SKOPEO_LDFLAGS) $(TESTFLAGS) $(if $(BUILDTAGS),-tags "$(BUILDTAGS)")
209213

210214
# complicated set of options needed to run podman-in-podman
211215
test-system:
@@ -220,9 +224,8 @@ test-system:
220224
exit $$rc
221225

222226
# Primarily intended for CI.
223-
test-system-local: $(if $(SKOPEO_BINARY),,bin/skopeo)
227+
test-system-local: .eval-skopeo-binary
224228
hack/warn-destructive-tests.sh
225-
@echo "Testing with $(or $(SKOPEO_BINARY),$(eval SKOPEO_BINARY := "bin/skopeo")$(SKOPEO_BINARY)) ..."
226229
bats --tap systemtest
227230

228231
test-unit:

integration/check_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (s *skopeoSuite) TearDownSuite() {
5050

5151
func (s *skopeoSuite) TestVersion() {
5252
t := s.T()
53-
assertSkopeoSucceeds(t, fmt.Sprintf(".*%s version %s.*", skopeoBinary, version.Version),
53+
assertSkopeoSucceeds(t, fmt.Sprintf(".*skopeo version %s.*", version.Version),
5454
"--version")
5555
}
5656

integration/proxy_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ func newProxy() (*proxy, error) {
282282
}
283283

284284
// Note ExtraFiles starts at 3
285-
proc := exec.Command("skopeo", "experimental-image-proxy", "--sockfd", "3")
285+
proc := exec.Command(skopeoBinary, "experimental-image-proxy", "--sockfd", "3")
286286
proc.Stderr = os.Stderr
287287
cmdLifecycleToParentIfPossible(proc)
288288
proc.ExtraFiles = append(proc.ExtraFiles, theirfd)

integration/utils_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,14 @@ import (
2020
"go.podman.io/image/v5/manifest"
2121
)
2222

23-
const skopeoBinary = "skopeo"
23+
// FIXME: Move to SetupSuite
24+
// https://github.com/containers/skopeo/pull/2703#discussion_r2331374730
25+
var skopeoBinary = func() string {
26+
if binary := os.Getenv("SKOPEO_BINARY"); binary != "" {
27+
return binary
28+
}
29+
return "skopeo"
30+
}()
2431

2532
const testFQIN = "docker://quay.io/libpod/busybox" // tag left off on purpose, some tests need to add a special one
2633
const testFQIN64 = "docker://quay.io/libpod/busybox:amd64"

0 commit comments

Comments
 (0)