3
bats_require_minimum_version 1.8.0
7
load ../system/helpers.registry
8
load ../system/helpers.network
10
function setup_suite(){
11
if [[ -z "$ROOTLESS_USER" ]]; then
12
if ! is_rootless; then
13
die "Cannot run as root with no \$ROOTLESS_USER defined"
15
export ROOTLESS_USER=$(id -un)
18
sshdir=/home/$ROOTLESS_USER/.ssh
20
if [[ ! -e $sshkey ]]; then
21
ssh-keygen -t rsa -N "" -f $sshkey
22
cat ${sshkey}.pub >> $sshdir/authorized_keys
26
ssh -T -o 'BatchMode yes' -o 'StrictHostKeyChecking no' localhost true
31
type -P podman || die "No 'podman' in \$PATH"
33
export FARMNAME="test-farm-$(random_string 5)"
36
run_podman system connection add --identity $sshkey test-node $ROOTLESS_USER@localhost
37
run_podman farm create $FARMNAME test-node
39
export PODMAN_LOGIN_WORKDIR=$(mktemp -d --tmpdir=${BATS_TMPDIR:-${TMPDIR:-/tmp}} podman-bats-registry.XXXXXX)
41
export PODMAN_LOGIN_USER="user$(random_string 4)"
42
export PODMAN_LOGIN_PASS="pw$(random_string 15)"
46
export PODMAN_LOGIN_REGISTRY_PORT=$(random_free_port 42000-42999)
49
export REGISTRY=localhost:${PODMAN_LOGIN_REGISTRY_PORT}
50
export AUTHFILE=$FARM_TMPDIR/authfile.json
52
run_podman login --authfile=$AUTHFILE \
54
--username ${PODMAN_LOGIN_USER} \
55
--password ${PODMAN_LOGIN_PASS} \
59
function teardown_suite(){
61
run_podman farm rm --all