Add grenade tests

Change-Id: I427d4b91cc5da9e9b2ffdb4239a5256ab44a1e06
This commit is contained in:
Pedro Henrique 2024-02-11 13:51:23 -03:00 committed by Pierre Riteau
parent f2c103535e
commit 3114c3f979
5 changed files with 210 additions and 0 deletions

View File

@ -31,6 +31,38 @@
USE_PYTHON3: True
TEMPEST_PLUGINS: /opt/stack/cloudkitty-tempest-plugin
- job:
name: cloudkitty-grenade-job
parent: grenade
description: |
Grenade job to test release upgrades
required-projects:
- opendev.org/openstack/grenade
- opendev.org/openstack/cloudkitty
- opendev.org/openstack/cloudkitty-tempest-plugin
- opendev.org/openstack/python-cloudkittyclient
irrelevant-files: *base_irrelevant_files
vars:
devstack_plugins:
cloudkitty: https://opendev.org/openstack/cloudkitty.git
cloudkitty-tempest-plugin: https://opendev.org/openstack/cloudkitty-tempest-plugin.git
devstack_services:
ck-api: true
ck-proc: true
tempest_concurrency: 1
tempest_plugins:
- cloudkitty-tempest-plugin
tempest_test_regex: cloudkitty_tempest_plugin.*
tox_envlist: all
grenade_from_branch: master
grenade_devstack_localrc:
shared:
TARGET_BRANCH: master
BASE_DEVSTACK_BRANCH: master
CLOUDKITTY_USE_MOD_WSGI: false
CLOUDKITTY_FETCHER: keystone
USE_PYTHON3: True
- job:
name: base-cloudkitty-v1-api-tempest-job
parent: base-cloudkitty-tempest-job
@ -161,9 +193,11 @@
- cloudkitty-tempest-full-ipv6-only
- cloudkitty-tox-bandit:
voting: false
- cloudkitty-grenade-job
gate:
jobs:
- cloudkitty-tempest-full-v2-storage-influxdb
- cloudkitty-tempest-full-v2-storage-influxdb-v2
- cloudkitty-tempest-full-v1-storage-sqlalchemy
- cloudkitty-tempest-full-ipv6-only
- cloudkitty-grenade-job

76
devstack/upgrade/resources.sh Executable file
View File

@ -0,0 +1,76 @@
#!/bin/bash
set -o errexit
source $GRENADE_DIR/grenaderc
source $GRENADE_DIR/functions
source $TOP_DIR/openrc admin
set -o xtrace
CLOUDKITTY_GRENADE_DIR=$(dirname $0)
CK_SERVICE_NAME='test_service'
CK_FIELD_NAME='test_field'
CK_MAPPING_VALUE='test_value'
function create {
CK_SERVICE_ID=$(openstack rating hashmap service create $CK_SERVICE_NAME -c 'Service ID' -f value)
CK_FIELD_ID=$(openstack rating hashmap field create $CK_SERVICE_ID $CK_FIELD_NAME -c 'Field ID' -f value)
openstack rating hashmap mapping create --field-id $CK_FIELD_ID --value $CK_MAPPING_VALUE 3
echo "CloudKitty create: SUCCESS"
}
function verify {
CK_SERVICE_NAME_VERIFY=$(openstack rating hashmap service list -c 'Name' -f value)
if [ $CK_SERVICE_NAME_VERIFY != $CK_SERVICE_NAME ]; then
echo "CloudKitty verify invalid service name. Expected $CK_SERVICE_NAME got $CK_SERVICE_NAME_VERIFY."
errexit
fi
CK_SERVICE_ID=$(openstack rating hashmap service list -c 'Service ID' -f value)
CK_FIELD_NAME_VERIFY=$(openstack rating hashmap field list $CK_SERVICE_ID -c 'Name' -f value)
if [ $CK_FIELD_NAME_VERIFY != $CK_FIELD_NAME ]; then
echo "CloudKitty verify invalid field name. Expected $CK_FIELD_NAME got $CK_FIELD_NAME_VERIFY."
errexit
fi
CK_FIELD_ID=$(openstack rating hashmap field list $CK_SERVICE_ID -c 'Field ID' -f value)
CK_MAPPING_VALUE_VERIFY=$(openstack rating hashmap mapping list --field-id $CK_FIELD_ID -c 'Value' -f value)
if [ $CK_MAPPING_VALUE_VERIFY != $CK_MAPPING_VALUE ]; then
echo "CloudKitty verify invalid mapping value. Expected $CK_MAPPING_VALUE got $CK_MAPPING_VALUE_VERIFY."
errexit
fi
echo "CloudKitty verify: SUCCESS"
}
function verify_noapi {
echo "CloudKitty verify_noapi: SUCCESS"
}
function destroy {
CK_SERVICE_ID=$(openstack rating hashmap service list -c 'Service ID' -f value)
openstack rating hashmap service delete $CK_SERVICE_ID
echo "CloudKitty destroy: SUCCESS"
}
# Dispatcher
case $1 in
"create")
create
;;
"verify_noapi")
verify_noapi
;;
"verify")
verify
;;
"destroy")
destroy
;;
"force_destroy")
set +o errexit
destroy
;;
esac

View File

@ -0,0 +1,2 @@
register_project_for_upgrade cloudkitty
register_db_to_save cloudkitty

27
devstack/upgrade/shutdown.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
#
#
set -o errexit
source $GRENADE_DIR/grenaderc
source $GRENADE_DIR/functions
source $BASE_DEVSTACK_DIR/functions
source $BASE_DEVSTACK_DIR/stackrc # needed for status directory
source $BASE_DEVSTACK_DIR/lib/tls
source $BASE_DEVSTACK_DIR/lib/apache
# Locate the cloudkitty plugin and get its functions
CLOUDKITTY_DEVSTACK_DIR=$(dirname $(dirname $0))
source $CLOUDKITTY_DEVSTACK_DIR/plugin.sh
set -o xtrace
stop_cloudkitty
# ensure everything is stopped
SERVICES_DOWN="ck-api ck-proc"
ensure_services_stopped $SERVICES_DOWN

71
devstack/upgrade/upgrade.sh Executable file
View File

@ -0,0 +1,71 @@
#!/usr/bin/env bash
# ``upgrade-cloudkitty``
echo "*********************************************************************"
echo "Begin $0"
echo "*********************************************************************"
# Clean up any resources that may be in use
cleanup() {
set +o errexit
echo "********************************************************************"
echo "ERROR: Abort $0"
echo "********************************************************************"
# Kill ourselves to signal any calling process
trap 2; kill -2 $$
}
trap cleanup SIGHUP SIGINT SIGTERM
# Keep track of the grenade directory
RUN_DIR=$(cd $(dirname "$0") && pwd)
# Source params
source $GRENADE_DIR/grenaderc
# Import common functions
source $GRENADE_DIR/functions
# This script exits on an error so that errors don't compound and you see
# only the first error that occurred.
set -o errexit
# Upgrade cloudkitty
# ==================
# Get functions from current DevStack
source $TARGET_DEVSTACK_DIR/stackrc
source $TARGET_DEVSTACK_DIR/lib/apache
source $TARGET_DEVSTACK_DIR/lib/tls
source $(dirname $(dirname $BASH_SOURCE))/settings
source $(dirname $(dirname $BASH_SOURCE))/plugin.sh
# Print the commands being run so that we can see the command that triggers
# an error. It is also useful for following allowing as the install occurs.
set -o xtrace
# Save current config files for posterity
[[ -d $SAVE_DIR/etc.cloudkitty ]] || cp -pr $CLOUDKITTY_CONF_DIR $SAVE_DIR/etc.cloudkitty
# Install the target cloudkitty
FILES=/tmp
install_cloudkitty
# calls upgrade-cloudkitty for specific release
upgrade_project cloudkitty $RUN_DIR $BASE_DEVSTACK_BRANCH $TARGET_DEVSTACK_BRANCH
# Migrate the database
upgrade_cloudkitty_database || die $LINO "ERROR in database migration"
start_cloudkitty
# Don't succeed unless the services come up
ensure_services_started ck-api ck-proc
set +o xtrace
echo "*********************************************************************"
echo "SUCCESS: End $0"
echo "*********************************************************************"