diff --git a/Makefile b/Makefile index 9b78d011bb..ebfd2e7a02 100644 --- a/Makefile +++ b/Makefile @@ -201,10 +201,11 @@ test-integration: $(MAKE) test-integration-local -# Intended for CI, assumed to be running in quay.io/libpod/skopeo_cidev container. +# Primarily intended for CI. test-integration-local: bin/skopeo hack/warn-destructive-tests.sh - hack/test-integration.sh $(SKOPEO_LDFLAGS) $(TESTFLAGS) + $(MAKE) PREFIX=/usr install + cd ./integration && $(GO) test $(SKOPEO_LDFLAGS) $(TESTFLAGS) $(if $(BUILDTAGS),-tags "$(BUILDTAGS)") # complicated set of options needed to run podman-in-podman test-system: @@ -218,10 +219,11 @@ test-system: $(CONTAINER_RUNTIME) unshare rm -rf $$DTEMP; # This probably doesn't work with Docker, oh well, better than nothing... \ exit $$rc -# Intended for CI, assumed to already be running in quay.io/libpod/skopeo_cidev container. -test-system-local: bin/skopeo +# Primarily intended for CI. +test-system-local: $(if $(SKOPEO_BINARY),,bin/skopeo) hack/warn-destructive-tests.sh - hack/test-system.sh SKOPEO_LDFLAGS="$(SKOPEO_LDFLAGS)" BUILDTAGS="$(BUILDTAGS)" + @echo "Testing with $(or $(SKOPEO_BINARY),$(eval SKOPEO_BINARY := "bin/skopeo")$(SKOPEO_BINARY)) ..." + bats --tap systemtest test-unit: # Just call (make test unit-local) here instead of worrying about environment differences @@ -234,7 +236,7 @@ validate: test-all-local: validate-local validate-docs test-unit-local .PHONY: validate-local -validate-local: +validate-local: tools hack/validate-git-marks.sh hack/validate-gofmt.sh $(GOBIN)/golangci-lint run --build-tags "${BUILDTAGS}" diff --git a/hack/test-integration.sh b/hack/test-integration.sh deleted file mode 100755 index c050b8ad09..0000000000 --- a/hack/test-integration.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -set -e - -make PREFIX=/usr install - -echo "cd ./integration;" go test "$@" ${BUILDTAGS:+-tags "$BUILDTAGS"} -cd ./integration -go test "$@" ${BUILDTAGS:+-tags "$BUILDTAGS"} diff --git a/hack/test-system.sh b/hack/test-system.sh deleted file mode 100755 index 0f170b4045..0000000000 --- a/hack/test-system.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -set -e - -# These tests can run in/outside of a container. However, -# not all storage drivers are supported in a container -# environment. Detect this and setup storage when -# running in a container. -# -# Paradoxically (FIXME: clean this up), SKOPEO_CONTAINER_TESTS is set -# both inside a container and without a container (in a CI VM); it actually means -# "it is safe to destructively modify the system for tests". -# -# On a CI VM, we can just use Podman as it is already configured; the changes below, -# to use VFS, are necessary only inside a container, because overlay-inside-overlay -# does not work. So, make these changes conditional on both -# SKOPEO_CONTAINER_TESTS (for acceptability to do destructive modification) and !CI -# (for necessity to adjust for in-container operation) -if ((SKOPEO_CONTAINER_TESTS)) && [[ "$CI" != true ]]; then - if [[ -r /etc/containers/storage.conf ]]; then - echo "MODIFYING existing storage.conf" - sed -i \ - -e 's/^driver\s*=.*/driver = "vfs"/' \ - -e 's/^mountopt/#mountopt/' \ - /etc/containers/storage.conf - else - echo "CREATING NEW storage.conf" - cat >> /etc/containers/storage.conf << EOF -[storage] -driver = "vfs" -runroot = "/run/containers/storage" -graphroot = "/var/lib/containers/storage" -EOF - fi - # The logic of finding the relevant storage.conf file is convoluted - # and in effect differs between Skopeo and Podman, at least in some versions; - # explicitly point at the file we want to use to hopefully avoid that. - export CONTAINERS_STORAGE_CONF=/etc/containers/storage.conf -fi - -# Build skopeo, install into /usr/bin -make PREFIX=/usr install "$@" - -# Run tests -SKOPEO_BINARY=/usr/bin/skopeo bats --tap systemtest diff --git a/systemtest/tmt/main.fmf b/systemtest/tmt/main.fmf index fd0b3e665e..de3517e6f7 100644 --- a/systemtest/tmt/main.fmf +++ b/systemtest/tmt/main.fmf @@ -10,5 +10,9 @@ adjust: RELEASE_TESTING: true summary: System test -test: bash ./test.sh +test: | + rpm -q containers-common skopeo skopeo-tests + # If these tests are to be run anywhere else, TMT can fetch + # them using the URL and git ref, so git commands should work. + make -C $(git rev-parse --show-toplevel) test-system-local duration: 60m diff --git a/systemtest/tmt/test.sh b/systemtest/tmt/test.sh deleted file mode 100644 index 7c80eba9ee..0000000000 --- a/systemtest/tmt/test.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -set -exo pipefail - -uname -r - -rpm -q \ - bats \ - containers-common \ - skopeo \ - skopeo-tests \ - -bats /usr/share/skopeo/test/system