Skip to content

Commit

Permalink
Merge pull request #1868 from mtrmac/developer-system-tests
Browse files Browse the repository at this point in the history
Fix `make test-system` when run as an unprivileged user (containerized)
  • Loading branch information
rhatdan authored Jan 23, 2023
2 parents e0a5df2 + 9f04dfd commit 4791952
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ test-integration-local: bin/skopeo
hack/make.sh test-integration

# complicated set of options needed to run podman-in-podman
# TODO: The $(RM) command will likely fail w/o `podman unshare`
test-system:
DTEMP=$(shell mktemp -d --tmpdir=/var/tmp podman-tmp.XXXXXX); \
$(CONTAINER_CMD) --privileged \
Expand All @@ -218,7 +217,7 @@ test-system:
"$(SKOPEO_CIDEV_CONTAINER_FQIN)" \
$(MAKE) test-system-local; \
rc=$$?; \
-$(RM) -rf $$DTEMP; \
$(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.
Expand Down
14 changes: 8 additions & 6 deletions systemtest/040-local-registry-auth.bats
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ load helpers
function setup() {
standard_setup

# Remove old/stale cred file
_cred_dir=$TESTDIR/credentials
export XDG_RUNTIME_DIR=$_cred_dir
mkdir -p $_cred_dir/containers
rm -f $_cred_dir/containers/auth.json

# Start authenticated registry with random password
testuser=testuser
testpassword=$(random_string 15)

start_registry --testuser=$testuser --testpassword=$testpassword --enable-delete=true reg

_cred_dir=$TESTDIR/credentials
# It is important to change XDG_RUNTIME_DIR only after we start the registry, otherwise it affects the path of $XDG_RUNTIME_DIR/netns maintained by Podman,
# making it imposible to clean up after ourselves.
export XDG_RUNTIME_DIR=$_cred_dir
mkdir -p $_cred_dir/containers
# Remove old/stale cred file
rm -f $_cred_dir/containers/auth.json
}

@test "auth: credentials on command line" {
Expand Down

0 comments on commit 4791952

Please sign in to comment.