Added a bit to the redstack script to run the integration tests.

Added a mechanism to the test code to determine if its acceptable to import internal nova and reddwarf code.
This commit is contained in:
Tim Simpson 2012-03-08 10:29:28 -06:00
parent 609ee9a548
commit 43d284352e
54 changed files with 99 additions and 32 deletions

49
scripts/conf/test.conf Normal file
View File

@ -0,0 +1,49 @@
{
"white_box":false,
"use_venv":false,
"dbaas_url":"http://localhost:8775/v1.0/dbaas",
"version_url":"http://localhost:8775/",
"glance_code_root":"/glance",
"glance_api_conf":"/vagrant/conf/glance-api.conf",
"glance_reg_conf":"/vagrant/conf/glance-reg.conf",
"glance_images_directory": "/glance_images",
"glance_image": "debian-squeeze-x86_64-openvz.tar.gz",
"nova_url":"http://localhost:8774/v1.1",
"nova_auth_url":"http://localhost:5000/v2.0",
"reddwarf_auth_url":"http://localhost:5000/v1.1",
"report_directory":"/vagrant/report",
"nova_code_root":"/src",
"nova_conf":"/home/vagrant/nova.conf",
"keystone_conf":"/etc/keystone/keystone.conf",
"users": [
{ "auth_user":"admin",
"auth_key":"admin",
"tenant":"dbaas",
"requirements": {
"is_admin":true
}
},
{ "auth_user":"boss",
"auth_key":"admin",
"tenant":"dbaas",
"requirements": {
"is_admin":true
}
},
{ "auth_user":"chunk",
"auth_key":"chunk",
"tenant":"dbaas",
"requirements": {
"is_admin":false
}
},
{ "auth_user":"daffy",
"auth_key":"daffy",
"tenant":"daffy",
"requirements": {
"is_admin":false
}
}
],
"dbaas_image": 1
}

View File

@ -418,11 +418,15 @@ cmd_stop() {
# Run Integration Tests
###############################################################################
cmd_unit_tests() {
cmd_int_tests() {
exclaim "Running Reddwarf Integration Tests..."
export PYTHONPATH=$PYTHONPATH:$PATH_REDDWARF:$PATH_REDDWARF_INT_TESTS
python $INT_TEST_OPTIONS -B $PATH_REDDWARF_INT_TESTS/int_tests.py --verbose --verbose $*
$PATH_REDDWARF/run_tests.sh -N
export NEMESIS_CONF=/integration/scripts/conf/test.conf
NEW_PATH=$PYTHONPATH:$PATH_REDDWARF:$PATH_REDDWARF_INT_TESTS/nemesis
echo "Python path : $NEW_PATH"
export PYTHONPATH=$NEW_PATH
args="$INT_TEST_OPTIONS -B $PATH_REDDWARF_INT_TESTS/nemesis/int_tests.py --verbose --verbose $@"
echo "python $args"
python $args
}
@ -454,6 +458,7 @@ print_usage() {
start-deps - Start or resume daemons Reddwarf depends on.
stop-deps - Kill daemons Reddwarf depends on.
start - Start or resume daemons Reddwarf depends on.
int-tests - Runs the integration tests (requires all daemons).
stop - Kill daemons Reddwarf depends on.
"
exit 1
@ -474,6 +479,7 @@ case "$1" in
"stop-deps" ) cmd_stop_deps;;
"start" ) cmd_start;;
"stop" ) cmd_stop;;
"int-tests" ) cmd_int_tests $@;;
* )
echo "'$1' not a valid command"
exit 1

View File

@ -29,3 +29,11 @@ DBAAS_API = "dbaas.api"
PRE_INSTANCES = "dbaas.api.pre_instances"
INSTANCES = "dbaas.api.instances"
POST_INSTANCES = "dbaas.api.post_instances"
from proboscis import test
from tests.util.test_config import white_box as WHITE_BOX
def wb_test(*args, **kwargs):
# Decorate as a test only if we're doing white box testing.
if WHITE_BOX:
return test(*args, **kwargs)

View File

@ -21,32 +21,33 @@ they will create the domain if its not found (see below for details).
import os
import time
import unittest
from nova import utils
from reddwarf.dns.rsdns.driver import create_client_with_flag_values
from nova import flags
from proboscis import test
from proboscis import before_class
from proboscis.asserts import assert_equal
from proboscis.asserts import assert_not_equal
from proboscis.decorators import expect_exception
from proboscis.decorators import time_out
import rsdns
from reddwarf.dns.driver import DnsEntry
from reddwarf.dns.rsdns.driver import RsDnsInstanceEntryFactory
from reddwarf.dns.rsdns.driver import RsDnsDriver
from reddwarf.dns.rsdns.driver import RsDnsZone
from reddwarf.utils import poll_until
from tests import wb_test
from tests import WHITE_BOX
from tests.util import should_run_rsdns_tests
FLAGS = flags.FLAGS
TEST_CONTENT="126.1.1.1"
TEST_NAME="hiwassup.%s" % FLAGS.dns_domain_name
DNS_DOMAIN_ID=None
if WHITE_BOX:
from nova import utils
from nova import flags
import rsdns
from reddwarf.dns.rsdns.driver import create_client_with_flag_values
from reddwarf.dns.driver import DnsEntry
from reddwarf.dns.rsdns.driver import RsDnsInstanceEntryFactory
from reddwarf.dns.rsdns.driver import RsDnsDriver
from reddwarf.dns.rsdns.driver import RsDnsZone
from reddwarf.utils import poll_until
FLAGS = flags.FLAGS
TEST_CONTENT="126.1.1.1"
TEST_NAME="hiwassup.%s" % FLAGS.dns_domain_name
DNS_DOMAIN_ID=None
@test(groups=["rsdns.domains", "rsdns.show_entries"])
@wb_test(groups=["rsdns.domains", "rsdns.show_entries"])
class ClientTests(object):
@before_class
@ -65,8 +66,8 @@ class ClientTests(object):
print(domains)
@test(groups=["rsdns.domains"], depends_on=[ClientTests],
enabled=should_run_rsdns_tests())
@wb_test(groups=["rsdns.domains"], depends_on=[ClientTests],
enabled=should_run_rsdns_tests())
class RsDnsDriverTests(object):
"""Tests the RS DNS Driver."""

View File

@ -34,25 +34,26 @@ from novaclient.v1_1.client import Client
from sqlalchemy import create_engine
from sqlalchemy.exc import OperationalError
from nova import flags
from nova import utils
from proboscis import test
from proboscis.asserts import assert_false
from proboscis.asserts import assert_raises
from proboscis.asserts import assert_true
from proboscis.asserts import fail
from proboscis.asserts import ASSERTION_ERROR
from reddwarf import dns # import for flag values
from reddwarf.notifier import logfile_notifier # This is here so flags are loaded
from reddwarf import exception
from reddwarf.utils import poll_until
from reddwarfclient import Dbaas
from tests.util import test_config
from tests.util.client import TestClient as TestClient
from tests.util.topics import hosts_up
FLAGS = flags.FLAGS
if test_config.white_box:
from nova import flags
from nova import utils
from reddwarf import dns # import for flag values
from reddwarf.notifier import logfile_notifier # Here so flags are loaded
from reddwarf import exception
from reddwarf.utils import poll_until
FLAGS = flags.FLAGS
def assert_mysql_failure_msg_was_permissions_issue(msg):
@ -97,8 +98,6 @@ def get_dns_entry_factory():
_dns_entry_factory = utils.import_object(class_name)
return _dns_entry_factory
entry_factory = utils.import_object(FLAGS.dns_instance_entry_factory)
def check_database(instance_id, dbname):
"""Checks if the name appears in an instance's list of databases."""

View File

@ -36,7 +36,8 @@ __all__ = [
"use_venv",
"values",
"volume_service",
"keystone_service"
"keystone_service",
"whitebox"
]
@ -119,6 +120,7 @@ def _setup():
global volume_service
global keystone_service
global glance_image
global white_box
values = load_configuration()
use_venv = values.get("use_venv", True)
nova_auth_url = str(values.get("nova_auth_url", "http://localhost:5000/v2.0"))
@ -155,5 +157,7 @@ def _setup():
dbaas_image = values.get("dbaas_image", None)
typical_nova_image_name = values.get("typical_nova_image_name", None)
# If true, we import certain classes and test using internal code.
white_box = values.get("white_box", False)
_setup()