Allow overriding $CLI outside test scripts
this will allow you to test against installed RPM like so: # export CLI="/usr/bin/composer-cli" # make test_images If you already have lorax-composer running then you can directly execute test scripts: # ./tests/cli/test_build_and_deploy_aws.sh
This commit is contained in:
parent
e39d2aec22
commit
85dfbd7911
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
. /usr/share/beakerlib/beakerlib.sh
|
. /usr/share/beakerlib/beakerlib.sh
|
||||||
|
|
||||||
CLI="./src/bin/composer-cli"
|
CLI="${CLI:-./src/bin/composer-cli}"
|
||||||
|
|
||||||
|
|
||||||
rlJournalStart
|
rlJournalStart
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
. /usr/share/beakerlib/beakerlib.sh
|
. /usr/share/beakerlib/beakerlib.sh
|
||||||
|
|
||||||
CLI="./src/bin/composer-cli"
|
CLI="${CLI:-./src/bin/composer-cli}"
|
||||||
|
|
||||||
|
|
||||||
rlJournalStart
|
rlJournalStart
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
. /usr/share/beakerlib/beakerlib.sh
|
. /usr/share/beakerlib/beakerlib.sh
|
||||||
|
|
||||||
CLI="./src/bin/composer-cli"
|
CLI="${CLI:-./src/bin/composer-cli}"
|
||||||
|
|
||||||
|
|
||||||
rlJournalStart
|
rlJournalStart
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
. /usr/share/beakerlib/beakerlib.sh
|
. /usr/share/beakerlib/beakerlib.sh
|
||||||
|
|
||||||
CLI="./src/bin/composer-cli"
|
CLI="${CLI:-./src/bin/composer-cli}"
|
||||||
|
|
||||||
|
|
||||||
rlJournalStart
|
rlJournalStart
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
. /usr/share/beakerlib/beakerlib.sh
|
. /usr/share/beakerlib/beakerlib.sh
|
||||||
|
|
||||||
CLI="./src/bin/composer-cli"
|
CLI="${CLI:-./src/bin/composer-cli}"
|
||||||
|
|
||||||
|
|
||||||
rlJournalStart
|
rlJournalStart
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
. /usr/share/beakerlib/beakerlib.sh
|
. /usr/share/beakerlib/beakerlib.sh
|
||||||
|
|
||||||
CLI="./src/bin/composer-cli"
|
CLI="${CLI:-./src/bin/composer-cli}"
|
||||||
|
|
||||||
|
|
||||||
rlJournalStart
|
rlJournalStart
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
. /usr/share/beakerlib/beakerlib.sh
|
. /usr/share/beakerlib/beakerlib.sh
|
||||||
|
|
||||||
CLI="./src/bin/composer-cli"
|
CLI="${CLI:-./src/bin/composer-cli}"
|
||||||
QEMU="/usr/bin/qemu-kvm"
|
QEMU="/usr/bin/qemu-kvm"
|
||||||
|
|
||||||
rlJournalStart
|
rlJournalStart
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
. /usr/share/beakerlib/beakerlib.sh
|
. /usr/share/beakerlib/beakerlib.sh
|
||||||
|
|
||||||
CLI="./src/bin/composer-cli"
|
CLI="${CLI:-./src/bin/composer-cli}"
|
||||||
|
|
||||||
|
|
||||||
rlJournalStart
|
rlJournalStart
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
. /usr/share/beakerlib/beakerlib.sh
|
. /usr/share/beakerlib/beakerlib.sh
|
||||||
|
|
||||||
CLI="./src/bin/composer-cli"
|
CLI="${CLI:-./src/bin/composer-cli}"
|
||||||
QEMU="/usr/bin/qemu-kvm"
|
QEMU="/usr/bin/qemu-kvm"
|
||||||
|
|
||||||
rlJournalStart
|
rlJournalStart
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
. /usr/share/beakerlib/beakerlib.sh
|
. /usr/share/beakerlib/beakerlib.sh
|
||||||
|
|
||||||
CLI="./src/bin/composer-cli"
|
CLI="${CLI:-./src/bin/composer-cli}"
|
||||||
|
|
||||||
|
|
||||||
rlJournalStart
|
rlJournalStart
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
. /usr/share/beakerlib/beakerlib.sh
|
. /usr/share/beakerlib/beakerlib.sh
|
||||||
|
|
||||||
CLI="./src/bin/composer-cli"
|
CLI="${CLI:-./src/bin/composer-cli}"
|
||||||
|
|
||||||
|
|
||||||
rlJournalStart
|
rlJournalStart
|
||||||
|
@ -3,22 +3,37 @@
|
|||||||
|
|
||||||
# setup
|
# setup
|
||||||
rm -rf /var/tmp/beakerlib-*/
|
rm -rf /var/tmp/beakerlib-*/
|
||||||
export top_srcdir=`pwd`
|
|
||||||
. ./tests/testenv.sh
|
|
||||||
|
|
||||||
BLUEPRINTS_DIR=`mktemp -d '/tmp/composer-blueprints.XXXXX'`
|
function setup_tests {
|
||||||
cp ./tests/pylorax/blueprints/*.toml $BLUEPRINTS_DIR
|
# explicitly enable sshd for live-iso b/c it is disabled by default
|
||||||
|
# due to security concerns (no root password required)
|
||||||
|
sed -i.orig 's/^services.*/services --disabled="network" --enabled="NetworkManager,sshd"/' $1/composer/live-iso.ks
|
||||||
|
}
|
||||||
|
|
||||||
SHARE_DIR=`mktemp -d '/tmp/composer-share.XXXXX'`
|
function teardown_tests {
|
||||||
cp -R ./share/* $SHARE_DIR
|
mv $1/composer/live-iso.ks.orig $1/composer/live-iso.ks
|
||||||
chmod a+rx -R $SHARE_DIR
|
}
|
||||||
|
|
||||||
# explicitly enable sshd for live-iso b/c it is disabled by default
|
if [ -z "$CLI" ]; then
|
||||||
# due to security concerns (no root password required)
|
export top_srcdir=`pwd`
|
||||||
sed -i 's/^services.*/services --disabled="network" --enabled="NetworkManager,sshd"/' $SHARE_DIR/composer/live-iso.ks
|
. ./tests/testenv.sh
|
||||||
|
|
||||||
|
BLUEPRINTS_DIR=`mktemp -d '/tmp/composer-blueprints.XXXXX'`
|
||||||
|
cp ./tests/pylorax/blueprints/*.toml $BLUEPRINTS_DIR
|
||||||
|
|
||||||
|
SHARE_DIR=`mktemp -d '/tmp/composer-share.XXXXX'`
|
||||||
|
cp -R ./share/* $SHARE_DIR
|
||||||
|
chmod a+rx -R $SHARE_DIR
|
||||||
|
|
||||||
|
setup_tests $SHARE_DIR
|
||||||
|
# start the lorax-composer daemon
|
||||||
|
./src/sbin/lorax-composer --sharedir $SHARE_DIR $BLUEPRINTS_DIR &
|
||||||
|
else
|
||||||
|
SHARE_DIR="/usr/share/lorax"
|
||||||
|
setup_tests $SHARE_DIR
|
||||||
|
systemctl restart lorax-composer
|
||||||
|
fi
|
||||||
|
|
||||||
# start the lorax-composer daemon
|
|
||||||
./src/sbin/lorax-composer --sharedir $SHARE_DIR $BLUEPRINTS_DIR &
|
|
||||||
|
|
||||||
# wait for the backend to become ready
|
# wait for the backend to become ready
|
||||||
tries=0
|
tries=0
|
||||||
@ -45,9 +60,19 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Stop lorax-composer and remove /run/weldr/api.socket
|
if [ -z "$CLI" ]; then
|
||||||
pkill -9 lorax-composer
|
# stop lorax-composer and remove /run/weldr/api.socket
|
||||||
rm -f /run/weldr/api.socket
|
# only if running against source
|
||||||
|
pkill -9 lorax-composer
|
||||||
|
rm -f /run/weldr/api.socket
|
||||||
|
teardown_tests $SHARE_DIR
|
||||||
|
else
|
||||||
|
systemctl stop lorax-composer
|
||||||
|
teardown_tests $SHARE_DIR
|
||||||
|
# start lorax-composer again so we can continue with manual or other kinds
|
||||||
|
# of testing on the same system
|
||||||
|
systemctl start lorax-composer
|
||||||
|
fi
|
||||||
|
|
||||||
# look for failures
|
# look for failures
|
||||||
grep RESULT_STRING /var/tmp/beakerlib-*/TestResults | grep -v PASS && exit 1
|
grep RESULT_STRING /var/tmp/beakerlib-*/TestResults | grep -v PASS && exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user