Browse code

Merge "Tempest: configure exact set of extensions to test"

Jenkins authored on 2014/12/11 01:33:28
Showing 1 changed files
... ...
@@ -79,6 +79,18 @@ IPV6_SUBNET_ATTRIBUTES_ENABLED=$(trueorfalse True $IPV6_SUBNET_ATTRIBUTES_ENABLE
79 79
 # Functions
80 80
 # ---------
81 81
 
82
+# remove_disabled_extension - removes disabled extensions from the list of extensions
83
+# to test for a given service
84
+function remove_disabled_extensions {
85
+    local extensions_list=$1
86
+    shift
87
+    local disabled_exts=$*
88
+    for ext_to_remove in ${disabled_exts//,/ } ; do
89
+        extensions_list=${extensions_list/$ext_to_remove","}
90
+    done
91
+    echo $extensions_list
92
+}
93
+
82 94
 # configure_tempest() - Set config files, create data dirs, etc
83 95
 function configure_tempest {
84 96
     setup_develop $TEMPEST_DIR
... ...
@@ -300,12 +312,24 @@ function configure_tempest {
300 300
     iniset $TEMPEST_CONFIG compute ssh_connect_method $ssh_connect_method
301 301
 
302 302
     # Compute Features
303
+    # Run verify_tempest_config -ur to retrieve enabled extensions on API endpoints
304
+    # NOTE(mtreinish): This must be done after auth settings are added to the tempest config
305
+    local tmp_cfg_file=$(mktemp)
306
+    $TEMPEST_DIR/tempest/cmd/verify_tempest_config.py -uro $tmp_cfg_file
307
+
308
+    local compute_api_extensions=${COMPUTE_API_EXTENSIONS:-"all"}
309
+    if [[ ! -z "$DISABLE_COMPUTE_API_EXTENSIONS" ]]; then
310
+        # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
311
+        compute_api_extensions=${COMPUTE_API_EXTENSIONS:-$(iniget $tmp_cfg_file compute-feature-enabled api_extensions | tr -d " ")}
312
+        # Remove disabled extensions
313
+        compute_api_extensions=$(remove_disabled_extensions $compute_api_extensions $DISABLE_COMPUTE_API_EXTENSIONS)
314
+    fi
315
+
303 316
     iniset $TEMPEST_CONFIG compute-feature-enabled resize True
304 317
     iniset $TEMPEST_CONFIG compute-feature-enabled live_migration ${LIVE_MIGRATION_AVAILABLE:-False}
305 318
     iniset $TEMPEST_CONFIG compute-feature-enabled change_password False
306 319
     iniset $TEMPEST_CONFIG compute-feature-enabled block_migration_for_live_migration ${USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION:-False}
307
-    iniset $TEMPEST_CONFIG compute-feature-enabled api_extensions ${COMPUTE_API_EXTENSIONS:-"all"}
308
-    iniset $TEMPEST_CONFIG compute-feature-disabled api_extensions ${DISABLE_COMPUTE_API_EXTENSIONS}
320
+    iniset $TEMPEST_CONFIG compute-feature-enabled api_extensions $compute_api_extensions
309 321
 
310 322
     # Compute admin
311 323
     iniset $TEMPEST_CONFIG "compute-admin" username $ADMIN_USERNAME
... ...
@@ -320,8 +344,15 @@ function configure_tempest {
320 320
     iniset $TEMPEST_CONFIG network default_network "$FIXED_RANGE"
321 321
     iniset $TEMPEST_CONFIG network-feature-enabled ipv6 "$IPV6_ENABLED"
322 322
     iniset $TEMPEST_CONFIG network-feature-enabled ipv6_subnet_attributes "$IPV6_SUBNET_ATTRIBUTES_ENABLED"
323
-    iniset $TEMPEST_CONFIG network-feature-enabled api_extensions ${NETWORK_API_EXTENSIONS:-"all"}
324
-    iniset $TEMPEST_CONFIG network-feature-disabled api_extensions ${DISABLE_NETWORK_API_EXTENSIONS}
323
+
324
+    local network_api_extensions=${NETWORK_API_EXTENSIONS:-"all"}
325
+    if [[ ! -z "$DISABLE_NETWORK_API_EXTENSIONS" ]]; then
326
+        # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
327
+        network_api_extensions=${NETWORK_API_EXTENSIONS:-$(iniget $tmp_cfg_file network-feature-enabled api_extensions | tr -d " ")}
328
+        # Remove disabled extensions
329
+        network_api_extensions=$(remove_disabled_extensions $network_api_extensions $DISABLE_NETWORK_API_EXTENSIONS)
330
+    fi
331
+    iniset $TEMPEST_CONFIG network-feature-enabled api_extensions $network_api_extensions
325 332
 
326 333
     # boto
327 334
     iniset $TEMPEST_CONFIG boto ec2_url "$EC2_SERVICE_PROTOCOL://$SERVICE_HOST:8773/services/Cloud"
... ...
@@ -363,12 +394,25 @@ function configure_tempest {
363 363
     iniset $TEMPEST_CONFIG telemetry too_slow_to_test "False"
364 364
 
365 365
     # Object storage
366
-    iniset $TEMPEST_CONFIG object-storage-feature-enabled discoverable_apis ${OBJECT_STORAGE_API_EXTENSIONS:-"all"}
367
-    iniset $TEMPEST_CONFIG object-storage-feature-disabled discoverable_apis ${OBJECT_STORAGE_DISABLE_API_EXTENSIONS}
366
+    local object_storage_api_extensions=${OBJECT_STORAGE_API_EXTENSIONS:-"all"}
367
+    if [[ ! -z "$DISABLE_OBJECT_STORAGE_API_EXTENSIONS" ]]; then
368
+        # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
369
+        object_storage_api_extensions=${OBJECT_STORAGE_API_EXTENSIONS:-$(iniget $tmp_cfg_file object-storage-feature-enabled discoverable_apis | tr -d " ")}
370
+        # Remove disabled extensions
371
+        object_storage_api_extensions=$(remove_disabled_extensions $object_storage_api_extensions $DISABLE_STORAGE_API_EXTENSIONS)
372
+    fi
373
+    iniset $TEMPEST_CONFIG object-storage-feature-enabled discoverable_apis $object_storage_api_extensions
368 374
 
369 375
     # Volume
370
-    iniset $TEMPEST_CONFIG volume-feature-enabled api_extensions ${VOLUME_API_EXTENSIONS:-"all"}
371
-    iniset $TEMPEST_CONFIG volume-feature-disabled api_extensions ${DISABLE_VOLUME_API_EXTENSIONS}
376
+    local volume_api_extensions=${VOLUME_API_EXTENSIONS:-"all"}
377
+    if [[ ! -z "$DISABLE_VOLUME_API_EXTENSIONS" ]]; then
378
+        # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
379
+        volume_api_extensions=${VOLUME_API_EXTENSIONS:-$(iniget $tmp_cfg_file volume-feature-enabled api_extensions | tr -d " ")}
380
+        # Remove disabled extensions
381
+        volume_api_extensions=$(remove_disabled_extensions $volume_api_extensions $DISABLE_VOLUME_API_EXTENSIONS)
382
+    fi
383
+    iniset $TEMPEST_CONFIG volume-feature-enabled api_extensions $volume_api_extensions
384
+
372 385
     if ! is_service_enabled c-bak; then
373 386
         iniset $TEMPEST_CONFIG volume-feature-enabled backup False
374 387
     fi