Fix regex expresion error in integration test

1.What is the problem
Multiline regex does not work in ostestr which is executed
in the integration job. This makes the test_volume_get test
cases not being executed currently in the check and gate test.

After regex issue is fixed, then
test_volume_create_get_update_delete_from_image
test case failed due to no image_ref is configured in the
tempest.conf, so the tempest configuration is moved to
the post_test_hook.sh, and correct the image_ref configuration.

2.What's need to be fixed:
If we want to add more and more tempest test cases to the
integration job, we have to add the filter of them to the
regex in the same line, so a string variable is used to
concat these filters for the tempest test cases.

And need to add image_ref configuration in tempest.conf.

And fix the bug for Pecan can not handle the last '/' in the
request url, which will lead to the tempest test case
test_volume_create_get_update_delete_from_image failure
in the check and gate test.

3.What is the purpose of this patch set:
To make the integration job work well, we have to fix the
regex part of the ostestr in the integration job, and fix
the configuration issue in tempest.conf, and Pecan bug.

Change-Id: I63e8e5e6372719f68051a486951b32d479607eff
Signed-off-by: Chaoyi Huang <joehuang@huawei.com>
This commit is contained in:
Chaoyi Huang 2016-07-18 17:11:34 +08:00 committed by zhiyuan_cai
parent 9adc57e57f
commit d5e6d330ce
5 changed files with 65 additions and 36 deletions

View File

@ -25,6 +25,8 @@ FIXED_NETWORK_SIZE=256
FLOATING_RANGE=10.100.100.160/24 FLOATING_RANGE=10.100.100.160/24
Q_FLOATING_ALLOCATION_POOL=start=10.100.100.160,end=10.100.100.192 Q_FLOATING_ALLOCATION_POOL=start=10.100.100.160,end=10.100.100.192
NEUTRON_CREATE_INITIAL_NETWORKS=False
PUBLIC_NETWORK_GATEWAY=10.100.100.3 PUBLIC_NETWORK_GATEWAY=10.100.100.3
Q_USE_SECGROUP=False Q_USE_SECGROUP=False
@ -54,5 +56,5 @@ enable_service c-api
enable_service c-vol enable_service c-vol
enable_service c-sch enable_service c-sch
disable_service c-bak disable_service c-bak
disable_service tempest # disable_service tempest
disable_service horizon disable_service horizon

View File

@ -140,6 +140,8 @@ class ImageController(rest.RestController):
@expose(generic=True, template='json') @expose(generic=True, template='json')
def get_one(self, _id): def get_one(self, _id):
context = t_context.extract_context_from_environ() context = t_context.extract_context_from_environ()
if _id == 'detail':
return self.get_all()
image = self.client.get_images(context, _id) image = self.client.get_images(context, _id)
if not image: if not image:
return utils.format_nova_error(404, _('Image not found')) return utils.format_nova_error(404, _('Image not found'))

View File

@ -125,7 +125,17 @@ class V21Controller(object):
if project_id == 'testrpc': if project_id == 'testrpc':
return TestRPCController(), remainder return TestRPCController(), remainder
else: else:
return self._get_resource_controller(project_id, remainder) # If the last charater of the url path is '/', then
# last remainder element is ''. Since pecan can't
# handle the url properly, '' element must be removed.
# Otherwise pecan will crashed for routing the request
# with incorrect parameter
num = len(remainder)
if num >= 1 and remainder[num - 1] == '':
new_remainder = remainder[:num - 1]
else:
new_remainder = remainder
return self._get_resource_controller(project_id, new_remainder)
@pecan.expose(generic=True, template='json') @pecan.expose(generic=True, template='json')
def index(self): def index(self):

View File

@ -15,13 +15,15 @@
# This script is executed inside post_test_hook function in devstack gate. # This script is executed inside post_test_hook function in devstack gate.
export DEST=$BASE/new export DEST=$BASE/new
export DEVSTACK_DIR=$DEST/tricircle/devstack export DEVSTACK_DIR=$DEST/devstack
export TRICIRCLE_DIR=$DEST/tricircle export TRICIRCLE_DIR=$DEST/tricircle
export TRICIRCLE_DEVSTACK_PLUGIN_DIR=$TRICIRCLE_DIR/devstack
export TRICIRCLE_TEMPEST_PLUGIN_DIR=$TRICIRCLE_DIR/tricircle/tempestplugin export TRICIRCLE_TEMPEST_PLUGIN_DIR=$TRICIRCLE_DIR/tricircle/tempestplugin
export TEMPEST_DIR=$DEST/tempest export TEMPEST_DIR=$DEST/tempest
export TEMPEST_CONF=$TEMPEST_DIR/etc/tempest.conf
# use admin role to create Tricircle top Pod and Pod1 # use admin role to create Tricircle top Pod and Pod1
source $BASE/new/devstack/openrc admin admin source $DEVSTACK_DIR/openrc admin admin
token=$(openstack token issue | awk 'NR==5 {print $4}') token=$(openstack token issue | awk 'NR==5 {print $4}')
echo $token echo $token
@ -35,24 +37,57 @@ curl -X POST http://127.0.0.1:19999/v1.0/pods \
-H "X-Auth-Token: $token" \ -H "X-Auth-Token: $token" \
-d '{"pod": {"pod_name": "Pod1", "az_name": "az1"}}' -d '{"pod": {"pod_name": "Pod1", "az_name": "az1"}}'
# the usage of "nova flavor-create":
# nova flavor-create [--ephemeral <ephemeral>] [--swap <swap>]
# [--rxtx-factor <factor>] [--is-public <is-public>]
# <name> <id> <ram> <disk> <vcpus>
# the following command is to create a flavor wih name='test',
# id=1, ram=1024MB, disk=10GB, vcpu=1
nova flavor-create test 1 1024 10 1
image_id=$(openstack image list | awk 'NR==4 {print $2}')
# preparation for the tests # preparation for the tests
cd $TEMPEST_DIR cd $TEMPEST_DIR
if [ -d .testrepository ]; then if [ -d .testrepository ]; then
sudo rm -r .testrepository sudo rm -r .testrepository
fi fi
# sudo -H -u jenkins testr init
sudo chown -R jenkins:stack $DEST/tempest
# sudo chown -R jenkins:stack $BASE/data/tempest
# change the tempest configruation to test Tricircle
env | grep OS_
# import functions needed for the below workaround
source $DEVSTACK_DIR/functions
# designate is a good example how to config TEMPEST_CONF
iniset $TEMPEST_CONF auth admin_username ${ADMIN_USERNAME:-"admin"}
iniset $TEMPEST_CONF auth admin_project_name admin
iniset $TEMPEST_CONF auth admin_password $OS_PASSWORD
iniset $TEMPEST_CONF identity uri $OS_AUTH_URL
iniset $TEMPEST_CONF identity-feature-enabled api_v3 false
iniset $TEMPEST_CONF compute region RegionOne
iniset $TEMPEST_CONF compute image_ref $image_id
iniset $TEMPEST_CONF compute image_ref_alt $image_id
iniset $TEMPEST_CONF volume region RegionOne
iniset $TEMPEST_CONF volume catalog_type volumev2
iniset $TEMPEST_CONF volume endpoint_type publicURL
iniset $TEMPEST_CONF volume-feature-enabled api_v1 false
# Run the Compute Tempest tests # Run the Compute Tempest tests
# cd $TRICIRCLE_TEMPEST_PLUGIN_DIR cd $TRICIRCLE_TEMPEST_PLUGIN_DIR
# sudo BASE=$BASE ./tempest_compute.sh sudo BASE=$BASE ./tempest_compute.sh
# Run the Volume Tempest tests # Run the Volume Tempest tests
cd $TRICIRCLE_TEMPEST_PLUGIN_DIR cd $TRICIRCLE_TEMPEST_PLUGIN_DIR
sudo BASE=$BASE ./tempest_volume.sh sudo BASE=$BASE ./tempest_volume.sh
# Run the Network Tempest tests # Run the Network Tempest tests
# cd $TRICIRCLE_TEMPEST_PLUGIN_DIR cd $TRICIRCLE_TEMPEST_PLUGIN_DIR
# sudo BASE=$BASE ./tempest_network.sh sudo BASE=$BASE ./tempest_network.sh
# Run the Scenario Tempest tests # Run the Scenario Tempest tests
# cd $TRICIRCLE_TEMPEST_PLUGIN_DIR # cd $TRICIRCLE_TEMPEST_PLUGIN_DIR

View File

@ -12,45 +12,25 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
export DEST=$BASE/new export DEST=$BASE/new
export DEVSTACK_DIR=$DEST/tricircle/devstack
export TRICIRCLE_DIR=$DEST/tricircle
export TEMPEST_DIR=$DEST/tempest export TEMPEST_DIR=$DEST/tempest
export TEMPEST_CONF=$TEMPEST_DIR/etc/tempest.conf export TEMPEST_CONF=$TEMPEST_DIR/etc/tempest.conf
# preparation for the tests # preparation for the tests
cd $TEMPEST_DIR cd $TEMPEST_DIR
# Import functions needed for the below workaround
source $DEST/devstack/functions
# add account information to configuration
source $BASE/new/devstack/openrc admin admin
env | grep OS_
iniset $TEMPEST_CONF auth admin_username admin
iniset $TEMPEST_CONF auth admin_project_name admin
iniset $TEMPEST_CONF auth admin_password $OS_PASSWORD
iniset $TEMPEST_CONF identity uri $OS_AUTH_URL
iniset $TEMPEST_CONF identity-feature-enabled api_v3 false
# change the configruation to test Tricircle Cinder-APIGW
iniset $TEMPEST_CONF volume region RegionOne
iniset $TEMPEST_CONF volume catalog_type volumev2
iniset $TEMPEST_CONF volume endpoint_type publicURL
iniset $TEMPEST_CONF volume-feature-enabled api_v1 false
# Run functional test # Run functional test
echo "Running Tricircle functional test suite..." echo "Running Tricircle functional test suite..."
# all test cases with following prefix # all test cases with following prefix
ostestr --regex '(tempest.api.volume.test_volumes_list|\ TESTCASES="(tempest.api.volume.test_volumes_list"
tempest.api.volume.test_volumes_get)' TESTCASES="$TESTCASES|tempest.api.volume.test_volumes_get"
# add new test cases like following line for volume_type test
# TESTCASES="$TESTCASES|tempest.api.volume.admin.test_volumes_type"
TESTCASES="$TESTCASES)"
# add test_volume_type like this for volume_type test ostestr --regex $TESTCASES
# ostestr --regex '(tempest.api.volume.test_volumes_list|\
# tempest.api.volume.test_volumes_get|\
# tempest.api.volume.admin.test_volume_type)'
# --------------------- IMPORTANT begin -------------------- # # --------------------- IMPORTANT begin -------------------- #
# all following test cases are from Cinder tempest test cases, # all following test cases are from Cinder tempest test cases,