Use devstack gate to run tempest tests
In before, we run tempest tests manually at post_test_hook.sh, which is suboptimal and hard to maintain. This incurs challenges on splitting tempest tests as well. Most projects use devstack gate to run tempest tests. It is done by setting DEVSTACK_GATE_TEMPEST_REGEX to point to the right set of tests. Let's switch to this approach. Change-Id: If29151755fb958d308ec3759b5d1a2a1200ccfc5
This commit is contained in:
@@ -25,6 +25,9 @@ export DEVSTACK_LOCAL_CONFIG+=$'\n'"enable_plugin kuryr-libnetwork https://git.o
|
||||
export DEVSTACK_LOCAL_CONFIG+=$'\n'"enable_plugin devstack-plugin-container https://git.openstack.org/openstack/devstack-plugin-container"
|
||||
export DEVSTACK_LOCAL_CONFIG+=$'\n'"ZUN_USE_UWSGI=True"
|
||||
export DEVSTACK_LOCAL_CONFIG+=$'\n'"KURYR_CONFIG_DIR=/etc/kuryr-libnetwork"
|
||||
export DEVSTACK_GATE_TEMPEST=1
|
||||
export DEVSTACK_GATE_TEMPEST_ALL_PLUGINS=1
|
||||
export DEVSTACK_GATE_TEMPEST_REGEX="zun.tests.tempest.api"
|
||||
|
||||
if [ "$driver" = "docker" ]; then
|
||||
export DEVSTACK_LOCAL_CONFIG+=$'\n'"ZUN_DRIVER=docker"
|
||||
|
||||
@@ -14,59 +14,12 @@
|
||||
|
||||
# This script is executed inside post_test_hook function in devstack gate.
|
||||
|
||||
# Sleep some time until all services are starting
|
||||
sleep 5
|
||||
|
||||
# Check if a function already exists
|
||||
function function_exists {
|
||||
declare -f -F $1 > /dev/null
|
||||
}
|
||||
|
||||
if ! function_exists echo_summary; then
|
||||
function echo_summary {
|
||||
echo $@
|
||||
}
|
||||
fi
|
||||
|
||||
# Save trace setting
|
||||
XTRACE=$(set +o | grep xtrace)
|
||||
set -o xtrace
|
||||
|
||||
echo_summary "Zun's post_test_hook.sh was called..."
|
||||
(set -o posix; set)
|
||||
|
||||
# source it to make sure to get REQUIREMENTS_DIR
|
||||
source $BASE/new/devstack/stackrc
|
||||
source $BASE/new/devstack/accrc/admin/admin
|
||||
|
||||
constraints="-c $REQUIREMENTS_DIR/upper-constraints.txt"
|
||||
sudo -H pip install $constraints -U -r requirements.txt -r test-requirements.txt
|
||||
|
||||
export ZUN_DIR="$BASE/new/zun"
|
||||
sudo chown -R jenkins:stack $ZUN_DIR
|
||||
|
||||
# Use tempest to test zun api service
|
||||
|
||||
# Import devstack functions 'iniset', 'iniget' and 'trueorfalse'
|
||||
source $BASE/new/devstack/functions
|
||||
echo "TEMPEST_SERVICES+=,zun" >> $localrc_path
|
||||
pushd $BASE/new/tempest
|
||||
sudo chown -R jenkins:stack $BASE/new/tempest
|
||||
|
||||
# Missing tempest.conf ??
|
||||
# show tempest config
|
||||
cat etc/tempest.conf
|
||||
|
||||
sudo -E tox -eall-plugin -- zun.tests.tempest.api
|
||||
|
||||
EXIT_CODE=$?
|
||||
|
||||
# Copy over docker systemd unit journals.
|
||||
mkdir -p $WORKSPACE/logs
|
||||
sudo journalctl -o short-precise --unit docker | sudo tee $WORKSPACE/logs/docker.txt > /dev/null
|
||||
|
||||
popd
|
||||
|
||||
|
||||
$XTRACE
|
||||
exit $EXIT_CODE
|
||||
|
||||
@@ -106,13 +106,16 @@ class TestContainer(base.BaseZunTest):
|
||||
def test_run_container_with_image_driver_glance(self):
|
||||
image = None
|
||||
try:
|
||||
self.docker_client.pull_image('cirros')
|
||||
image_data = self.docker_client.get_image('cirros')
|
||||
docker_base_url = self._get_docker_url()
|
||||
self.docker_client.pull_image(
|
||||
'cirros', docker_auth_url=docker_base_url)
|
||||
image_data = self.docker_client.get_image(
|
||||
'cirros', docker_base_url)
|
||||
image = self.images_client.create_image(
|
||||
name='cirros', disk_format='raw', container_format='docker')
|
||||
self.images_client.store_image_file(image['id'], image_data)
|
||||
# delete the local image that was previously pulled down
|
||||
self.docker_client.delete_image('cirros')
|
||||
self.docker_client.delete_image('cirros', docker_base_url)
|
||||
|
||||
_, model = self._run_container(
|
||||
image='cirros', image_driver='glance')
|
||||
@@ -488,7 +491,7 @@ class TestContainer(base.BaseZunTest):
|
||||
|
||||
return sg_names
|
||||
|
||||
def _get_docker_url(self, host, protocol='tcp', port='2375'):
|
||||
def _get_docker_url(self, host='localhost', protocol='tcp', port='2375'):
|
||||
# NOTE(kiennt): By default, devstack-plugin-container will
|
||||
# set docker_api_url = {
|
||||
# "unix://$DOCKER_ENGINE_SOCKET_FILE",
|
||||
|
||||
Reference in New Issue
Block a user