diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/ci/load_images.sh | 44 | ||||
-rwxr-xr-x | tests/ci/yardstick-verify | 9 | ||||
-rw-r--r-- | tests/unit/dispatcher/test_influxdb.py | 14 |
3 files changed, 42 insertions, 25 deletions
diff --git a/tests/ci/load_images.sh b/tests/ci/load_images.sh index 6f950ec72..e5a7ae034 100755 --- a/tests/ci/load_images.sh +++ b/tests/ci/load_images.sh @@ -15,6 +15,12 @@ set -e YARD_IMG_ARCH=amd64 export YARD_IMG_ARCH +HW_FW_TYPE="" +if [ "${YARD_IMG_ARCH}" = "arm64" ]; then + HW_FW_TYPE=uefi +fi +export HW_FW_TYPE + if ! grep -q "Defaults env_keep += \"YARD_IMG_ARCH\"" "/etc/sudoers"; then sudo echo "Defaults env_keep += \"YARD_IMG_ARCH YARDSTICK_REPO_DIR\"" >> /etc/sudoers fi @@ -25,10 +31,10 @@ if [ "$INSTALLER_TYPE" == "fuel" ]; then fi UCA_HOST="cloud-images.ubuntu.com" -if [ $YARD_IMG_ARCH = "arm64" ]; then - export VIVID_IMG_URL="http://${UCA_HOST}/vivid/current/vivid-server-cloudimg-arm64.tar.gz" - if ! grep -q "Defaults env_keep += \"VIVID_IMG_URL\"" "/etc/sudoers"; then - sudo echo "Defaults env_keep += \"VIVID_IMG_URL\"" >> /etc/sudoers +if [ "${YARD_IMG_ARCH}"= "arm64" ]; then + export CLOUD_IMG_URL="http://${UCA_HOST}/${release}/current/${release}-server-cloudimg-${YARD_IMG_ARCH}.tar.gz" + if ! grep -q "Defaults env_keep += \"CLOUD_IMG_URL\"" "/etc/sudoers"; then + sudo echo "Defaults env_keep += \"CLOUD_IMG_URL\"" >> /etc/sudoers fi fi @@ -65,24 +71,24 @@ load_yardstick_image() echo echo "========== Loading yardstick cloud image ==========" EXTRA_PARAMS="" - if [ $YARD_IMG_ARCH = "arm64" ]; then - VIVID_IMAGE="/tmp/vivid-server-cloudimg-arm64.tar.gz" - VIVID_KERNEL="/tmp/vivid-server-cloudimg-arm64-vmlinuz-generic" + if [[ "${YARD_IMG_ARCH}" = "arm64" && "${YARD_IMG_AKI}" = "true" ]]; then + CLOUD_IMAGE="/tmp/${release}-server-cloudimg-${YARD_IMG_ARCH}.tar.gz" + CLOUD_KERNEL="/tmp/${release}-server-cloudimg-${YARD_IMG_ARCH}-vmlinuz-generic" cd /tmp - if [ ! -f $VIVID_IMAGE ]; then - wget $VIVID_IMG_URL + if [ ! -f "${CLOUD_IMAGE}" ]; then + wget $CLOUD_IMG_URL fi - if [ ! -f $VIVID_KERNEL ]; then - tar zxf $VIVID_IMAGE $(basename $VIVID_KERNEL) + if [ ! -f "${CLOUD_KERNEL}" ]; then + tar zxf $CLOUD_IMAGE $(basename $CLOUD_KERNEL) fi - create_vivid_kernel=$(openstack image create \ + create_kernel=$(openstack image create \ --public \ --disk-format qcow2 \ --container-format bare \ - --file $VIVID_KERNEL \ - yardstick-vivid-kernel) + --file $CLOUD_KERNEL \ + yardstick-${release}-kernel) - GLANCE_KERNEL_ID=$(echo "$create_vivid_kernel" | grep " id " | awk '{print $(NF-1)}') + GLANCE_KERNEL_ID=$(echo "$create_kernel" | grep " id " | awk '{print $(NF-1)}') if [ -z "$GLANCE_KERNEL_ID" ]; then echo 'Failed uploading kernel to cloud'. exit 1 @@ -92,7 +98,7 @@ load_yardstick_image() EXTRA_PARAMS="--property kernel_id=$GLANCE_KERNEL_ID --property os_command_line=\"$command_line\"" - rm -f $VIVID_KERNEL $VIVID_IMAGE + rm -f $CLOUD_KERNEL $CLOUD_IMAGE cd $YARDSTICK_REPO_DIR fi @@ -101,6 +107,10 @@ load_yardstick_image() EXTRA_PARAMS=$EXTRA_PARAMS" --property hw_mem_page_size=large" fi + if [[ -n "${HW_FW_TYPE}" ]]; then + EXTRA_PARAMS=$EXTRA_PARAMS" --property hw_firmware_type=${HW_FW_TYPE}" + fi + if [[ "$DEPLOY_SCENARIO" == *"-lxd-"* ]]; then output=$(eval openstack image create \ --public \ @@ -223,7 +233,7 @@ main() build_yardstick_image load_yardstick_image - if [ $YARD_IMG_ARCH = "arm64" ]; then + if [ "${YARD_IMG_ARCH}" = "arm64" ]; then sed -i 's/image: cirros-0.3.3/image: TestVM/g' tests/opnfv/test_cases/opnfv_yardstick_tc002.yaml \ samples/ping.yaml #We have overlapping IP with the real network diff --git a/tests/ci/yardstick-verify b/tests/ci/yardstick-verify index 575bdc821..2986c9f2f 100755 --- a/tests/ci/yardstick-verify +++ b/tests/ci/yardstick-verify @@ -34,6 +34,7 @@ OPTIONS: -h Show this message -r Http target (example: -r 213.77.62.197/results) -i Influxdb target (example: -i 127.0.0.1:8086) + -m Reporting target (example: -m 213.77.62.197/results) Default target is dump to file ($DISPATCHER_FILE_NAME) @@ -44,8 +45,9 @@ DISPATCHER_TYPE=file DISPATCHER_FILE_NAME="/tmp/yardstick.out" DISPATCHER_HTTP_TARGET="http://testresults.opnfv.org/test/api/v1/results" DISPATCHER_INFLUXDB_TARGET= +REPORTING_TARGET="${DISPATCHER_HTTP_TARGET}" -while getopts "r:i:h" OPTION; do +while getopts "r:i:m:h" OPTION; do case $OPTION in h) usage @@ -61,6 +63,9 @@ while getopts "r:i:h" OPTION; do DISPATCHER_INFLUXDB_TARGET=http://${OPTARG} DISPATCHER_FILE_NAME= ;; + m) + REPORTING_TARGET=http://${OPTARG} + ;; *) echo "${OPTION} is not a valid argument" exit 1 @@ -150,7 +155,7 @@ report(){ \"start_date\":\"${2}\", \"stop_date\":\"${3}\", \"details\":\"\"}" \ - "${DISPATCHER_HTTP_TARGET}" + "${REPORTING_TARGET}" } run_test() diff --git a/tests/unit/dispatcher/test_influxdb.py b/tests/unit/dispatcher/test_influxdb.py index b84389e7e..0c7b58135 100644 --- a/tests/unit/dispatcher/test_influxdb.py +++ b/tests/unit/dispatcher/test_influxdb.py @@ -90,19 +90,21 @@ class InfluxdbDispatcherTestCase(unittest.TestCase): } } + self.yardstick_conf = {'yardstick': {}} + def test_record_result_data_no_target(self): - influxdb = InfluxdbDispatcher(None) + influxdb = InfluxdbDispatcher(None, self.yardstick_conf) influxdb.target = '' self.assertEqual(influxdb.record_result_data(self.data1), -1) def test_record_result_data_no_case_name(self): - influxdb = InfluxdbDispatcher(None) + influxdb = InfluxdbDispatcher(None, self.yardstick_conf) self.assertEqual(influxdb.record_result_data(self.data2), -1) @mock.patch('yardstick.dispatcher.influxdb.requests') def test_record_result_data(self, mock_requests): type(mock_requests.post.return_value).status_code = 204 - influxdb = InfluxdbDispatcher(None) + influxdb = InfluxdbDispatcher(None, self.yardstick_conf) self.assertEqual(influxdb.record_result_data(self.data1), 0) self.assertEqual(influxdb.record_result_data(self.data2), 0) self.assertEqual(influxdb.flush_result_data(), 0) @@ -112,7 +114,7 @@ class InfluxdbDispatcherTestCase(unittest.TestCase): 'mpstat.cpu0.%idle=99.00,mpstat.cpu0.%sys=0.00' # need to sort for assert to work line = ",".join(sorted(line.split(','))) - influxdb = InfluxdbDispatcher(None) + influxdb = InfluxdbDispatcher(None, self.yardstick_conf) flattened_data = influxdb._dict_key_flatten( self.data3['benchmark']['data']) result = ",".join( @@ -120,7 +122,7 @@ class InfluxdbDispatcherTestCase(unittest.TestCase): self.assertEqual(result, line) def test__get_nano_timestamp(self): - influxdb = InfluxdbDispatcher(None) + influxdb = InfluxdbDispatcher(None, self.yardstick_conf) results = {'benchmark': {'timestamp': '1451461248.925574'}} self.assertEqual(influxdb._get_nano_timestamp(results), '1451461248925574144') @@ -128,7 +130,7 @@ class InfluxdbDispatcherTestCase(unittest.TestCase): @mock.patch('yardstick.dispatcher.influxdb.time') def test__get_nano_timestamp_except(self, mock_time): results = {} - influxdb = InfluxdbDispatcher(None) + influxdb = InfluxdbDispatcher(None, self.yardstick_conf) mock_time.time.return_value = 1451461248.925574 self.assertEqual(influxdb._get_nano_timestamp(results), '1451461248925574144') |