2019-08-23 15:20:06 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Note: execute this file from the project root directory
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
. /usr/share/beakerlib/beakerlib.sh
|
|
|
|
. $(dirname $0)/lib/lib.sh
|
|
|
|
|
|
|
|
CLI="${CLI:-./src/bin/composer-cli}"
|
|
|
|
|
|
|
|
rlJournalStart
|
|
|
|
rlPhaseStartSetup
|
2020-05-05 12:09:19 +00:00
|
|
|
# as opposed to RHEL-8, the system repos aren't copied over to lorax-composes repos.d,
|
|
|
|
# directory, so handling of those files was removed in RHEL-7 test (see rhbz#1830897)
|
2019-08-23 15:20:06 +00:00
|
|
|
composer_stop
|
|
|
|
rlPhaseEnd
|
|
|
|
|
|
|
|
rlPhaseStartTest "Run lorax-composer with --no-system-repos option and empty repos.d"
|
|
|
|
composer_start --no-system-repos
|
|
|
|
|
|
|
|
# check that there are no composer repos available
|
|
|
|
rlRun -t -c "$CLI sources list | grep -v '^$' | wc -l | grep '^0$'"
|
|
|
|
present_repos=$(ls /var/lib/lorax/composer/repos.d)
|
|
|
|
if [ -z "$present_repos" ]; then
|
|
|
|
rlPass "No repos found in repos.d"
|
|
|
|
else
|
|
|
|
rlFail "The following repos were found in repos.d: $present_repos"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# starting a compose without available repos should fail due to a depsolving error
|
|
|
|
rlRun -t -c "tmp_output='$($CLI compose start example-http-server partitioned-disk 2>&1)'"
|
|
|
|
rlRun -t -c "echo '$tmp_output' | grep -q 'Problem depsolving example-http-server:'"
|
|
|
|
MANUAL=1 composer_stop
|
|
|
|
rlPhaseEnd
|
|
|
|
|
|
|
|
rlPhaseStartTest "Run lorax-composer with --no-system-repos and manually created content in repos.d"
|
2020-04-28 11:41:53 +00:00
|
|
|
RHEL_VERSION=$(. /etc/os-release; echo $VERSION_ID)
|
2020-04-29 10:09:14 +00:00
|
|
|
if grep -qE "https?://.*/nightly/" /etc/yum.repos.d/*; then
|
|
|
|
RELEASE_TYPE="nightly"
|
|
|
|
# there are only -latest symlinks with major version for nightlies
|
|
|
|
RHEL_VERSION=7
|
|
|
|
else
|
|
|
|
RELEASE_TYPE="rel-eng"
|
|
|
|
fi
|
|
|
|
|
2020-04-28 11:41:53 +00:00
|
|
|
echo "[server]
|
2019-08-23 15:20:06 +00:00
|
|
|
name=Server
|
2020-04-29 10:09:14 +00:00
|
|
|
baseurl=http://download.devel.redhat.com/rhel-7/$RELEASE_TYPE/RHEL-7/latest-RHEL-$RHEL_VERSION/compose/Server/\$basearch/os/
|
2019-08-23 15:20:06 +00:00
|
|
|
enabled=1
|
|
|
|
gpgcheck=0
|
|
|
|
|
|
|
|
[server-optional]
|
|
|
|
name=Server-optional
|
2020-04-29 10:09:14 +00:00
|
|
|
baseurl=http://download.devel.redhat.com/rhel-7/$RELEASE_TYPE/RHEL-7/latest-RHEL-$RHEL_VERSION/compose/Server-optional/\$basearch/os/
|
2019-08-23 15:20:06 +00:00
|
|
|
enabled=1
|
|
|
|
gpgcheck=0
|
|
|
|
|
2020-04-28 11:41:53 +00:00
|
|
|
" > /var/lib/lorax/composer/repos.d/test.repo
|
2019-08-23 15:20:06 +00:00
|
|
|
|
|
|
|
composer_start --no-system-repos
|
|
|
|
present_repos=$(ls /var/lib/lorax/composer/repos.d/)
|
|
|
|
rlAssertEquals "Only test.repo found in repos.d" "$present_repos" "test.repo"
|
|
|
|
|
|
|
|
UUID=$(composer-cli compose start example-http-server partitioned-disk)
|
|
|
|
rlAssertEquals "exit code should be zero" $? 0
|
|
|
|
UUID=$(echo $UUID | cut -f 2 -d' ')
|
|
|
|
|
|
|
|
wait_for_compose $UUID
|
|
|
|
rlPhaseEnd
|
|
|
|
|
|
|
|
rlPhaseStartCleanup
|
|
|
|
$CLI compose delete $UUID
|
|
|
|
MANUAL=1 composer_stop
|
2020-05-05 12:09:19 +00:00
|
|
|
rlRun -t -c "rm -rf /var/lib/lorax/composer/repos.d/*"
|
2019-08-23 15:20:06 +00:00
|
|
|
composer_start
|
|
|
|
rlPhaseEnd
|
|
|
|
rlJournalEnd
|
|
|
|
rlJournalPrintText
|