Browse Source

Add scripts to run on fullstack CI job

These scripts are going to be used on the fullstack
networking-l2gw job.

Change-Id: I8961c3d940857d90c31cd14475ec3f71a739b213
stable/ocata
Gal Sagie 6 years ago
parent
commit
26182448cc
  1. 17
      devstack/devstackgaterc
  2. 10
      networking_l2gw/tests/contrib/gate_hook.sh
  3. 61
      networking_l2gw/tests/contrib/post_test_hook.sh

17
devstack/devstackgaterc

@ -0,0 +1,17 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# This script is executed in the OpenStack CI jobs located here:
# http://git.openstack.org/cgit/openstack-infra/project-config/tree/jenkins/jobs/networking-l2gw.yaml
#
export OVERRIDE_ENABLED_SERVICES=key,n-api,n-cpu,n-cond,n-sch,n-crt,n-cauth,n-obj,g-api,g-reg,c-sch,c-api,c-vol,q-meta,q-dhcp,rabbit,mysql,dstat,l2gw-plugin,l2gw-agent,q-svc,q-l3,q-agt

10
networking_l2gw/tests/contrib/gate_hook.sh

@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -ex
VENV=${1:-"fullstack"}
GATE_DEST=$BASE/new
DEVSTACK_PATH=$GATE_DEST/devstack
$BASE/new/devstack-gate/devstack-vm-gate.sh

61
networking_l2gw/tests/contrib/post_test_hook.sh

@ -0,0 +1,61 @@
#!/usr/bin/env bash
set -xe
NETWORKING_L2GW_DIR="$BASE/new/networking-l2gw"
TEMPEST_DIR="$BASE/new/tempest"
SCRIPTS_DIR="/usr/os-testr-env/bin/"
venv=${1:-"fullstack"}
function generate_test_logs {
local path="$1"
# Compress all $path/*.txt files and move the directories holding those
# files to /opt/stack/logs. Files with .log suffix have their
# suffix changed to .txt (so browsers will know to open the compressed
# files and not download them).
if [[ -d "$path" ]] ; then
sudo find "$path" -iname "*.log" -type f -exec mv {} {}.txt \; -exec gzip -9 {}.txt \;
sudo mv "$path/*" /opt/stack/logs/
fi
}
function generate_testr_results {
# Give job user rights to access tox logs
sudo -H -u "$owner" chmod o+rw .
sudo -H -u "$owner" chmod o+rw -R .testrepository
if [[ -f ".testrepository/0" ]] ; then
".tox/$venv/bin/subunit-1to2" < .testrepository/0 > ./testrepository.subunit
$SCRIPTS_DIR/subunit2html ./testrepository.subunit testr_results.html
gzip -9 ./testrepository.subunit
gzip -9 ./testr_results.html
sudo mv ./*.gz /opt/stack/logs/
fi
if [[ "$venv" == fullstack* ]] ; then
generate_test_logs "/tmp/${venv}-logs"
fi
}
owner=stack
sudo_env=
# virtuelenv 14.0.6 gives a strange error which appears solved in version 15.
# Therefore, we force the newer version.
sudo pip uninstall -y virtualenv
sudo pip install "virtualenv>=15.0.1"
# Set owner permissions according to job's requirements.
cd "$NETWORKING_L2GW_DIR"
sudo chown -R $owner:stack "$NETWORKING_L2GW_DIR"
# Run tests
echo "Running networking-l2gw $venv tests"
set +e
sudo -H -u "$owner" tox -e "$venv"
testr_exit_code=$?
set -e
# Collect and parse results
generate_testr_results
exit $testr_exit_code
Loading…
Cancel
Save