Merge "Fix functional tests in gate"

This commit is contained in:
Jenkins 2015-05-25 17:29:27 +00:00 committed by Gerrit Code Review
commit 048e763b75
3 changed files with 38 additions and 2 deletions

View File

@ -0,0 +1,8 @@
# Credentials for functional testing
[auth]
uri = http://10.42.0.50:5000/v2.0
[admin]
user = admin
tenant = admin
pass = secrete

View File

@ -10,6 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import ConfigParser
import os
from tempest_lib.cli import base
@ -30,10 +31,24 @@ class ClientTestBase(base.ClientTestBase):
def __init__(self, *args, **kwargs):
super(ClientTestBase, self).__init__(*args, **kwargs)
# Collecting of credentials:
#
# Support the existence of a functional_creds.conf for
# testing. This makes it possible to use a config file.
self.username = os.environ.get('OS_USERNAME')
self.password = os.environ.get('OS_PASSWORD')
self.tenant_name = os.environ.get('OS_TENANT_NAME')
self.uri = os.environ.get('OS_AUTH_URL')
config = ConfigParser.RawConfigParser()
if config.read('functional_creds.conf'):
# the OR pattern means the environment is preferred for
# override
self.username = self.username or config.get('admin', 'user')
self.password = self.password or config.get('admin', 'pass')
self.tenant_name = self.tenant_name or config.get('admin',
'tenant')
self.uri = self.uri or config.get('auth', 'uri')
def _get_clients(self):
cli_dir = os.environ.get(

View File

@ -28,15 +28,28 @@ function generate_testr_results {
export GLANCECLIENT_DIR="$BASE/new/python-glanceclient"
sudo chown -R jenkins:stack $GLANCECLIENT_DIR
# Get admin credentials
cd $BASE/new/devstack
source openrc admin admin
# pass the appropriate variables via a config file
CREDS_FILE=$GLANCECLIENT_DIR/functional_creds.conf
cat <<EOF > $CREDS_FILE
# Credentials for functional testing
[auth]
uri = $OS_AUTH_URL
[admin]
user = $OS_USERNAME
tenant = $OS_TENANT_NAME
pass = $OS_PASSWORD
EOF
# Go to the glanceclient dir
cd $GLANCECLIENT_DIR
sudo chown -R jenkins:stack $GLANCECLIENT_DIR
# Run tests
echo "Running glanceclient functional test suite"
set +e