blob: 18bef8b3b5d6f60121f9c5c8989ca6894a7da399 [file] [log] [blame]
John Griffith4debfe22013-11-01 00:00:40 +00001#!/usr/bin/env bash
2
3# **cinder_cert.sh**
4
5CERT_DIR=$(cd $(dirname "$0") && pwd)
6TOP_DIR=$(cd $CERT_DIR/..; pwd)
7
8source $TOP_DIR/functions
9source $TOP_DIR/stackrc
10source $TOP_DIR/openrc
11source $TOP_DIR/lib/tempest
12source $TOP_DIR/lib/cinder
13
14TEMPFILE=`mktemp`
15RECLONE=True
16
17function log_message() {
18 MESSAGE=$1
19 STEP_HEADER=$2
20 if [[ "$STEP_HEADER" = "True" ]]; then
21 echo -e "\n========================================================" | tee -a $TEMPFILE
22 fi
23 echo -e `date +%m/%d/%y/%T:`"${MESSAGE}" | tee -a $TEMPFILE
24 if [[ "$STEP_HEADER" = "True" ]]; then
25 echo -e "========================================================" | tee -a $TEMPFILE
26 fi
27}
28
29if [[ "$OFFLINE" = "True" ]]; then
30 echo "ERROR: Driver cert requires fresh clone/pull from ${CINDER_BRANCH}"
31 echo " Please set OFFLINE=False and retry."
32 exit 1
33fi
34
35log_message "RUNNING CINDER DRIVER CERTIFICATION CHECK", True
36log_message "Output is being logged to: $TEMPFILE"
37
38cd $CINDER_DIR
39log_message "Cloning to ${CINDER_REPO}...", True
40install_cinder
41
42log_message "Pull a fresh Clone of cinder repo...", True
43git status | tee -a $TEMPFILE
44git log --pretty=oneline -n 1 | tee -a $TEMPFILE
45
46log_message "Gathering copy of cinder.conf file (passwords will be scrubbed)...", True
47cat /etc/cinder/cinder.conf | egrep -v "(^#.*|^$)" | tee -a $TEMPFILE
48sed -i "s/\(.*password.*=\).*$/\1 xxx/i" $TEMPFILE
49log_message "End of cinder.conf.", True
50
51cd $TOP_DIR
52# Verify tempest is installed/enabled
53if ! is_service_enabled tempest; then
54 log_message "ERROR!!! Cert requires tempest in enabled_services!", True
55 log_message" Please add tempest to enabled_services and retry."
56 exit 1
57fi
58
59cd $TEMPEST_DIR
60install_tempest
61
62log_message "Verify tempest is current....", True
63git status | tee -a $TEMPFILE
64log_message "Check status and get latest commit..."
65git log --pretty=oneline -n 1 | tee -a $TEMPFILE
66
67
68#stop and restart cinder services
69log_message "Restart Cinder services...", True
70stop_cinder
71sleep 1
72start_cinder
73sleep 5
74
75# run tempest api/volume/test_*
76log_message "Run the actual tempest volume tests (run_tests.sh -N tempest.api.volume.test_*)...", True
77exec 2> >(tee -a $TEMPFILE)
78`./run_tests.sh -N tempest.api.volume.test_*`
79if [[ $? = 0 ]]; then
80 log_message "CONGRATULATIONS!!! Device driver PASSED!", True
81 log_message "Submit output: ($TEMPFILE)"
82 exit 0
83else
84 log_message "SORRY!!! Device driver FAILED!", True
85 log_message "Check output in $TEMPFILE"
86 exit 1
87fi