Merge "Moves negative tests from test_absolute_limits"
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index e7145e7..f306d8e 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -28,7 +28,7 @@
# format string to use for log messages with context (string
# value)
-#logging_context_format_string=%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user)s %(tenant)s] %(instance)s%(message)s
+#logging_context_format_string=%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s
# format string to use for log messages without context
# (string value)
@@ -43,7 +43,7 @@
#logging_exception_prefix=%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s
# list of logger=LEVEL pairs (list value)
-#default_log_levels=amqplib=WARN,sqlalchemy=WARN,boto=WARN,suds=INFO,keystone=INFO,paramiko=INFO
+#default_log_levels=amqp=WARN,amqplib=WARN,boto=WARN,qpid=WARN,sqlalchemy=WARN,suds=INFO,iso8601=WARN
# publish error events (boolean value)
#publish_errors=false
@@ -59,12 +59,13 @@
# it like this (string value)
#instance_uuid_format="[instance: %(uuid)s] "
-# If this option is specified, the logging configuration file
-# specified is used and overrides any other logging options
-# specified. Please see the Python logging module
-# documentation for details on logging configuration files.
-# (string value)
-#log_config=<None>
+# The name of logging configuration file. It does not disable
+# existing loggers, but just appends specified logging
+# configuration to any other existing logging options. Please
+# see the Python logging module documentation for details on
+# logging configuration files. (string value)
+# Deprecated group/name - [DEFAULT]/log_config
+#log_config_append=<None>
# DEPRECATED. A logging.Formatter log message format string
# which may use any of the available logging.LogRecord
@@ -94,329 +95,50 @@
#syslog_log_facility=LOG_USER
-[image]
+[boto]
#
# Options defined in tempest.config
#
-# Catalog type of the Image service. (string value)
-#catalog_type=image
+# EC2 URL (string value)
+#ec2_url=http://localhost:8773/services/Cloud
-# The image region name to use. If empty, the value of
-# identity.region is used instead. If no such region is found
-# in the service catalog, the first found one is used. (string
-# value)
-#region=
+# S3 URL (string value)
+#s3_url=http://localhost:8080
-# http accessible image (string value)
-#http_image=http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-uec.tar.gz
+# AWS Secret Key (string value)
+#aws_secret=<None>
+# AWS Access Key (string value)
+#aws_access=<None>
-[object-storage]
+# S3 Materials Path (string value)
+#s3_materials_path=/opt/stack/devstack/files/images/s3-materials/cirros-0.3.0
-#
-# Options defined in tempest.config
-#
+# ARI Ramdisk Image manifest (string value)
+#ari_manifest=cirros-0.3.0-x86_64-initrd.manifest.xml
-# Catalog type of the Object-Storage service. (string value)
-#catalog_type=object-store
+# AMI Machine Image manifest (string value)
+#ami_manifest=cirros-0.3.0-x86_64-blank.img.manifest.xml
-# The object-storage region name to use. If empty, the value
-# of identity.region is used instead. If no such region is
-# found in the service catalog, the first found one is used.
-# (string value)
-#region=
+# AKI Kernel Image manifest (string value)
+#aki_manifest=cirros-0.3.0-x86_64-vmlinuz.manifest.xml
-# Number of seconds to time on waiting for a containerto
-# container synchronization complete. (integer value)
-#container_sync_timeout=120
+# Instance type (string value)
+#instance_type=m1.tiny
-# Number of seconds to wait while looping to check thestatus
-# of a container to container synchronization (integer value)
-#container_sync_interval=5
+# boto Http socket timeout (integer value)
+#http_socket_timeout=3
-# Role to add to users created for swift tests to enable
-# creating containers (string value)
-#operator_role=Member
+# boto num_retries on error (integer value)
+#num_retries=1
+# Status Change Timeout (integer value)
+#build_timeout=60
-[network]
-
-#
-# Options defined in tempest.config
-#
-
-# Catalog type of the Neutron service. (string value)
-#catalog_type=network
-
-# The network region name to use. If empty, the value of
-# identity.region is used instead. If no such region is found
-# in the service catalog, the first found one is used. (string
-# value)
-#region=
-
-# The cidr block to allocate tenant networks from (string
-# value)
-#tenant_network_cidr=10.100.0.0/16
-
-# The mask bits for tenant networks (integer value)
-#tenant_network_mask_bits=28
-
-# Whether tenant network connectivity should be evaluated
-# directly (boolean value)
-#tenant_networks_reachable=false
-
-# Id of the public network that provides external connectivity
-# (string value)
-#public_network_id=
-
-# Id of the public router that provides external connectivity
-# (string value)
-#public_router_id=
-
-
-[data_processing]
-
-#
-# Options defined in tempest.config
-#
-
-# Catalog type of the data processing service. (string value)
-#catalog_type=data_processing
-
-
-[object-storage-feature-enabled]
-
-#
-# Options defined in tempest.config
-#
-
-# Set to True if the Container Quota middleware is enabled
-# (boolean value)
-#container_quotas=true
-
-# Set to True if the Account Quota middleware is enabled
-# (boolean value)
-#accounts_quotas=true
-
-# Set to True if the Crossdomain middleware is enabled
-# (boolean value)
-#crossdomain=true
-
-# Set to True if the TempURL middleware is enabled (boolean
-# value)
-#tempurl=true
-
-
-[network-feature-enabled]
-
-#
-# Options defined in tempest.config
-#
-
-# A list of enabled extensions with a special entry all which
-# indicates every extension is enabled (list value)
-#api_extensions=all
-
-
-[volume-feature-enabled]
-
-#
-# Options defined in tempest.config
-#
-
-# Runs Cinder multi-backend test (requires 2 backends)
-# (boolean value)
-#multi_backend=false
-
-# A list of enabled extensions with a special entry all which
-# indicates every extension is enabled (list value)
-#api_extensions=all
-
-# Is the v1 volume API enabled (boolean value)
-#api_v1=true
-
-
-[image-feature-enabled]
-
-#
-# Options defined in tempest.config
-#
-
-# Is the v2 image API enabled (boolean value)
-#api_v2=true
-
-# Is the v1 image API enabled (boolean value)
-#api_v1=true
-
-
-[compute-admin]
-
-#
-# Options defined in tempest.config
-#
-
-# Administrative Username to use for Nova API requests.
-# (string value)
-#username=admin
-
-# Administrative Tenant name to use for Nova API requests.
-# (string value)
-#tenant_name=admin
-
-# API key to use when authenticating as admin. (string value)
-#password=pass
-
-
-[volume]
-
-#
-# Options defined in tempest.config
-#
-
-# Time in seconds between volume availability checks. (integer
-# value)
-#build_interval=10
-
-# Timeout in seconds to wait for a volume to becomeavailable.
-# (integer value)
-#build_timeout=300
-
-# Catalog type of the Volume Service (string value)
-#catalog_type=volume
-
-# The volume region name to use. If empty, the value of
-# identity.region is used instead. If no such region is found
-# in the service catalog, the first found one is used. (string
-# value)
-#region=
-
-# Name of the backend1 (must be declared in cinder.conf)
-# (string value)
-#backend1_name=BACKEND_1
-
-# Name of the backend2 (must be declared in cinder.conf)
-# (string value)
-#backend2_name=BACKEND_2
-
-# Backend protocol to target when creating volume types
-# (string value)
-#storage_protocol=iSCSI
-
-# Backend vendor to target when creating volume types (string
-# value)
-#vendor_name=Open Source
-
-# Disk format to use when copying a volume to image (string
-# value)
-#disk_format=raw
-
-
-[compute-feature-enabled]
-
-#
-# Options defined in tempest.config
-#
-
-# If false, skip all nova v3 tests. (boolean value)
-#api_v3=true
-
-# If false, skip disk config tests (boolean value)
-#disk_config=true
-
-# A list of enabled extensions with a special entry all which
-# indicates every extension is enabled (list value)
-#api_extensions=all
-
-# A list of enabled v3 extensions with a special entry all
-# which indicates every extension is enabled (list value)
-#api_v3_extensions=all
-
-# Does the test environment support changing the admin
-# password? (boolean value)
-#change_password=false
-
-# Does the test environment support snapshots? (boolean value)
-#create_image=false
-
-# Does the test environment support resizing? (boolean value)
-#resize=false
-
-# Does the test environment support live migration available?
-# (boolean value)
-#live_migration=false
-
-# Does the test environment use block devices for live
-# migration (boolean value)
-#block_migration_for_live_migration=false
-
-# Does the test environment block migration support cinder
-# iSCSI volumes (boolean value)
-#block_migrate_cinder_iscsi=false
-
-
-[identity]
-
-#
-# Options defined in tempest.config
-#
-
-# Catalog type of the Identity service. (string value)
-#catalog_type=identity
-
-# Set to True if using self-signed SSL certificates. (boolean
-# value)
-#disable_ssl_certificate_validation=false
-
-# Full URI of the OpenStack Identity API (Keystone), v2
-# (string value)
-#uri=<None>
-
-# Full URI of the OpenStack Identity API (Keystone), v3
-# (string value)
-#uri_v3=<None>
-
-# The identity region name to use. Also used as the other
-# services' region name unless they are set explicitly. If no
-# such region is found in the service catalog, the first found
-# one is used. (string value)
-#region=RegionOne
-
-# Username to use for Nova API requests. (string value)
-#username=demo
-
-# Tenant name to use for Nova API requests. (string value)
-#tenant_name=demo
-
-# Role required to administrate keystone. (string value)
-#admin_role=admin
-
-# API key to use when authenticating. (string value)
-#password=pass
-
-# Username of alternate user to use for Nova API requests.
-# (string value)
-#alt_username=<None>
-
-# Alternate user's Tenant name to use for Nova API requests.
-# (string value)
-#alt_tenant_name=<None>
-
-# API key to use when authenticating as alternate user.
-# (string value)
-#alt_password=<None>
-
-# Administrative Username to use forKeystone API requests.
-# (string value)
-#admin_username=admin
-
-# Administrative Tenant name to use for Keystone API requests.
-# (string value)
-#admin_tenant_name=admin
-
-# API key to use when authenticating as admin. (string value)
-#admin_password=pass
+# Status Change Test Interval (integer value)
+#build_interval=1
[cli]
@@ -436,44 +158,6 @@
#timeout=15
-[stress]
-
-#
-# Options defined in tempest.config
-#
-
-# Directory containing log files on the compute nodes (string
-# value)
-#nova_logdir=<None>
-
-# Maximum number of instances to create during test. (integer
-# value)
-#max_instances=16
-
-# Controller host. (string value)
-#controller=<None>
-
-# Controller host. (string value)
-#target_controller=<None>
-
-# ssh user. (string value)
-#target_ssh_user=<None>
-
-# Path to private key. (string value)
-#target_private_key_path=<None>
-
-# regexp for list of log files. (string value)
-#target_logfiles=<None>
-
-# time (in seconds) between log file error checks. (integer
-# value)
-#log_check_interval=60
-
-# The number of threads created while stress test. (integer
-# value)
-#default_thread_number_per_action=4
-
-
[compute]
#
@@ -584,77 +268,68 @@
# (integer value)
#shelved_offload_time=0
+# Allows test cases to create/destroy tenants and users. This
+# option enables isolated test cases and better parallel
+# execution, but also requires that OpenStack Identity API
+# admin credentials are known. (boolean value)
+#allow_tenant_isolation=false
-[scenario]
+
+[compute-admin]
#
# Options defined in tempest.config
#
-# Directory containing image files (string value)
-#img_dir=/opt/stack/new/devstack/files/images/cirros-0.3.1-x86_64-uec
+# Administrative Username to use for Nova API requests.
+# (string value)
+#username=admin
-# AMI image file name (string value)
-#ami_img_file=cirros-0.3.1-x86_64-blank.img
+# Administrative Tenant name to use for Nova API requests.
+# (string value)
+#tenant_name=admin
-# ARI image file name (string value)
-#ari_img_file=cirros-0.3.1-x86_64-initrd
-
-# AKI image file name (string value)
-#aki_img_file=cirros-0.3.1-x86_64-vmlinuz
-
-# ssh username for the image file (string value)
-#ssh_user=cirros
-
-# specifies how many resources to request at once. Used for
-# large operations testing. (integer value)
-#large_ops_number=0
+# API key to use when authenticating as admin. (string value)
+#password=pass
-[boto]
+[compute-feature-enabled]
#
# Options defined in tempest.config
#
-# EC2 URL (string value)
-#ec2_url=http://localhost:8773/services/Cloud
+# If false, skip all nova v3 tests. (boolean value)
+#api_v3=true
-# S3 URL (string value)
-#s3_url=http://localhost:8080
+# If false, skip disk config tests (boolean value)
+#disk_config=true
-# AWS Secret Key (string value)
-#aws_secret=<None>
+# A list of enabled v3 extensions with a special entry all
+# which indicates every extension is enabled (list value)
+#api_v3_extensions=all
-# AWS Access Key (string value)
-#aws_access=<None>
+# Does the test environment support changing the admin
+# password? (boolean value)
+#change_password=false
-# S3 Materials Path (string value)
-#s3_materials_path=/opt/stack/devstack/files/images/s3-materials/cirros-0.3.0
+# Does the test environment support snapshots? (boolean value)
+#create_image=false
-# ARI Ramdisk Image manifest (string value)
-#ari_manifest=cirros-0.3.0-x86_64-initrd.manifest.xml
+# Does the test environment support resizing? (boolean value)
+#resize=false
-# AMI Machine Image manifest (string value)
-#ami_manifest=cirros-0.3.0-x86_64-blank.img.manifest.xml
+# Does the test environment support live migration available?
+# (boolean value)
+#live_migration=false
-# AKI Kernel Image manifest (string value)
-#aki_manifest=cirros-0.3.0-x86_64-vmlinuz.manifest.xml
+# Does the test environment use block devices for live
+# migration (boolean value)
+#block_migration_for_live_migration=false
-# Instance type (string value)
-#instance_type=m1.tiny
-
-# boto Http socket timeout (integer value)
-#http_socket_timeout=3
-
-# boto num_retries on error (integer value)
-#num_retries=1
-
-# Status Change Timeout (integer value)
-#build_timeout=60
-
-# Status Change Test Interval (integer value)
-#build_interval=1
+# Does the test environment block migration support cinder
+# iSCSI volumes (boolean value)
+#block_migrate_cinder_iscsi=false
[dashboard]
@@ -670,6 +345,226 @@
#login_url=http://localhost/auth/login/
+[data_processing]
+
+#
+# Options defined in tempest.config
+#
+
+# Catalog type of the data processing service. (string value)
+#catalog_type=data_processing
+
+
+[debug]
+
+#
+# Options defined in tempest.config
+#
+
+# Enable diagnostic commands (boolean value)
+#enable=true
+
+
+[identity]
+
+#
+# Options defined in tempest.config
+#
+
+# Catalog type of the Identity service. (string value)
+#catalog_type=identity
+
+# Set to True if using self-signed SSL certificates. (boolean
+# value)
+#disable_ssl_certificate_validation=false
+
+# Full URI of the OpenStack Identity API (Keystone), v2
+# (string value)
+#uri=<None>
+
+# Full URI of the OpenStack Identity API (Keystone), v3
+# (string value)
+#uri_v3=<None>
+
+# The identity region name to use. Also used as the other
+# services' region name unless they are set explicitly. If no
+# such region is found in the service catalog, the first found
+# one is used. (string value)
+#region=RegionOne
+
+# Username to use for Nova API requests. (string value)
+#username=demo
+
+# Tenant name to use for Nova API requests. (string value)
+#tenant_name=demo
+
+# Role required to administrate keystone. (string value)
+#admin_role=admin
+
+# API key to use when authenticating. (string value)
+#password=pass
+
+# Username of alternate user to use for Nova API requests.
+# (string value)
+#alt_username=<None>
+
+# Alternate user's Tenant name to use for Nova API requests.
+# (string value)
+#alt_tenant_name=<None>
+
+# API key to use when authenticating as alternate user.
+# (string value)
+#alt_password=<None>
+
+# Administrative Username to use forKeystone API requests.
+# (string value)
+#admin_username=admin
+
+# Administrative Tenant name to use for Keystone API requests.
+# (string value)
+#admin_tenant_name=admin
+
+# API key to use when authenticating as admin. (string value)
+#admin_password=pass
+
+
+[image]
+
+#
+# Options defined in tempest.config
+#
+
+# Catalog type of the Image service. (string value)
+#catalog_type=image
+
+# The image region name to use. If empty, the value of
+# identity.region is used instead. If no such region is found
+# in the service catalog, the first found one is used. (string
+# value)
+#region=
+
+# http accessible image (string value)
+#http_image=http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-uec.tar.gz
+
+
+[image-feature-enabled]
+
+#
+# Options defined in tempest.config
+#
+
+# Is the v2 image API enabled (boolean value)
+#api_v2=true
+
+# Is the v1 image API enabled (boolean value)
+#api_v1=true
+
+
+[network]
+
+#
+# Options defined in tempest.config
+#
+
+# Catalog type of the Neutron service. (string value)
+#catalog_type=network
+
+# The network region name to use. If empty, the value of
+# identity.region is used instead. If no such region is found
+# in the service catalog, the first found one is used. (string
+# value)
+#region=
+
+# The cidr block to allocate tenant networks from (string
+# value)
+#tenant_network_cidr=10.100.0.0/16
+
+# The mask bits for tenant networks (integer value)
+#tenant_network_mask_bits=28
+
+# Whether tenant network connectivity should be evaluated
+# directly (boolean value)
+#tenant_networks_reachable=false
+
+# Id of the public network that provides external connectivity
+# (string value)
+#public_network_id=
+
+# Id of the public router that provides external connectivity
+# (string value)
+#public_router_id=
+
+
+[network-feature-enabled]
+
+#
+# Options defined in tempest.config
+#
+
+# A list of enabled extensions with a special entry all which
+# indicates every extension is enabled (list value)
+#api_extensions=all
+
+# A list of enabled extensions with a special entry all which
+# indicates every extension is enabled (list value)
+#api_extensions=all
+
+# A list of enabled extensions with a special entry all which
+# indicates every extension is enabled (list value)
+#api_extensions=all
+
+
+[object-storage]
+
+#
+# Options defined in tempest.config
+#
+
+# Catalog type of the Object-Storage service. (string value)
+#catalog_type=object-store
+
+# The object-storage region name to use. If empty, the value
+# of identity.region is used instead. If no such region is
+# found in the service catalog, the first found one is used.
+# (string value)
+#region=
+
+# Number of seconds to time on waiting for a containerto
+# container synchronization complete. (integer value)
+#container_sync_timeout=120
+
+# Number of seconds to wait while looping to check thestatus
+# of a container to container synchronization (integer value)
+#container_sync_interval=5
+
+# Role to add to users created for swift tests to enable
+# creating containers (string value)
+#operator_role=Member
+
+
+[object-storage-feature-enabled]
+
+#
+# Options defined in tempest.config
+#
+
+# Set to True if the Container Quota middleware is enabled
+# (boolean value)
+#container_quotas=true
+
+# Set to True if the Account Quota middleware is enabled
+# (boolean value)
+#accounts_quotas=true
+
+# Set to True if the Crossdomain middleware is enabled
+# (boolean value)
+#crossdomain=true
+
+# Set to True if the TempURL middleware is enabled (boolean
+# value)
+#tempurl=true
+
+
[orchestration]
#
@@ -685,12 +580,6 @@
# value)
#region=
-# Allows test cases to create/destroy tenants and users. This
-# option enables isolated test cases and better parallel
-# execution, but also requires that OpenStack Identity API
-# admin credentials are known. (boolean value)
-#allow_tenant_isolation=false
-
# Time in seconds between build status checks. (integer value)
#build_interval=1
@@ -715,14 +604,30 @@
#max_template_size=524288
-[debug]
+[scenario]
#
# Options defined in tempest.config
#
-# Enable diagnostic commands (boolean value)
-#enable=true
+# Directory containing image files (string value)
+#img_dir=/opt/stack/new/devstack/files/images/cirros-0.3.1-x86_64-uec
+
+# AMI image file name (string value)
+#ami_img_file=cirros-0.3.1-x86_64-blank.img
+
+# ARI image file name (string value)
+#ari_img_file=cirros-0.3.1-x86_64-initrd
+
+# AKI image file name (string value)
+#aki_img_file=cirros-0.3.1-x86_64-vmlinuz
+
+# ssh username for the image file (string value)
+#ssh_user=cirros
+
+# specifies how many resources to request at once. Used for
+# large operations testing. (integer value)
+#large_ops_number=0
[service_available]
@@ -768,3 +673,109 @@
#savanna=false
+[stress]
+
+#
+# Options defined in tempest.config
+#
+
+# Directory containing log files on the compute nodes (string
+# value)
+#nova_logdir=<None>
+
+# Maximum number of instances to create during test. (integer
+# value)
+#max_instances=16
+
+# Controller host. (string value)
+#controller=<None>
+
+# Controller host. (string value)
+#target_controller=<None>
+
+# ssh user. (string value)
+#target_ssh_user=<None>
+
+# Path to private key. (string value)
+#target_private_key_path=<None>
+
+# regexp for list of log files. (string value)
+#target_logfiles=<None>
+
+# time (in seconds) between log file error checks. (integer
+# value)
+#log_check_interval=60
+
+# The number of threads created while stress test. (integer
+# value)
+#default_thread_number_per_action=4
+
+
+[telemetry]
+
+#
+# Options defined in tempest.config
+#
+
+# Catalog type of the Telemetry service. (string value)
+#catalog_type=metering
+
+
+[volume]
+
+#
+# Options defined in tempest.config
+#
+
+# Time in seconds between volume availability checks. (integer
+# value)
+#build_interval=10
+
+# Timeout in seconds to wait for a volume to becomeavailable.
+# (integer value)
+#build_timeout=300
+
+# Catalog type of the Volume Service (string value)
+#catalog_type=volume
+
+# The volume region name to use. If empty, the value of
+# identity.region is used instead. If no such region is found
+# in the service catalog, the first found one is used. (string
+# value)
+#region=
+
+# Name of the backend1 (must be declared in cinder.conf)
+# (string value)
+#backend1_name=BACKEND_1
+
+# Name of the backend2 (must be declared in cinder.conf)
+# (string value)
+#backend2_name=BACKEND_2
+
+# Backend protocol to target when creating volume types
+# (string value)
+#storage_protocol=iSCSI
+
+# Backend vendor to target when creating volume types (string
+# value)
+#vendor_name=Open Source
+
+# Disk format to use when copying a volume to image (string
+# value)
+#disk_format=raw
+
+
+[volume-feature-enabled]
+
+#
+# Options defined in tempest.config
+#
+
+# Runs Cinder multi-backend test (requires 2 backends)
+# (boolean value)
+#multi_backend=false
+
+# Is the v1 volume API enabled (boolean value)
+#api_v1=true
+
+
diff --git a/tempest/api/compute/admin/test_simple_tenant_usage.py b/tempest/api/compute/admin/test_simple_tenant_usage.py
index a599f06..c416ad2 100644
--- a/tempest/api/compute/admin/test_simple_tenant_usage.py
+++ b/tempest/api/compute/admin/test_simple_tenant_usage.py
@@ -18,7 +18,6 @@
import datetime
from tempest.api.compute import base
-from tempest import exceptions
from tempest.test import attr
import time
@@ -83,33 +82,6 @@
self.assertEqual(200, resp.status)
self.assertEqual(len(tenant_usage), 8)
- @attr(type=['negative', 'gate'])
- def test_get_usage_tenant_with_empty_tenant_id(self):
- # Get usage for a specific tenant empty
- params = {'start': self.start,
- 'end': self.end}
- self.assertRaises(exceptions.NotFound,
- self.adm_client.get_tenant_usage,
- '', params)
-
- @attr(type=['negative', 'gate'])
- def test_get_usage_tenant_with_invalid_date(self):
- # Get usage for tenant with invalid date
- params = {'start': self.end,
- 'end': self.start}
- self.assertRaises(exceptions.BadRequest,
- self.adm_client.get_tenant_usage,
- self.tenant_id, params)
-
- @attr(type=['negative', 'gate'])
- def test_list_usage_all_tenants_with_non_admin_user(self):
- # Get usage for all tenants with non admin user
- params = {'start': self.start,
- 'end': self.end,
- 'detailed': int(bool(True))}
- self.assertRaises(exceptions.Unauthorized,
- self.client.list_tenant_usages, params)
-
class TenantUsagesTestXML(TenantUsagesTestJSON):
_interface = 'xml'
diff --git a/tempest/api/compute/admin/test_simple_tenant_usage_negative.py b/tempest/api/compute/admin/test_simple_tenant_usage_negative.py
new file mode 100644
index 0000000..7e5168e
--- /dev/null
+++ b/tempest/api/compute/admin/test_simple_tenant_usage_negative.py
@@ -0,0 +1,76 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 NEC Corporation
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import datetime
+
+from tempest.api.compute import base
+from tempest import exceptions
+from tempest.test import attr
+
+
+class TenantUsagesNegativeTestJSON(base.BaseV2ComputeAdminTest):
+
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(TenantUsagesNegativeTestJSON, cls).setUpClass()
+ cls.adm_client = cls.os_adm.tenant_usages_client
+ cls.client = cls.os.tenant_usages_client
+ cls.identity_client = cls._get_identity_admin_client()
+ now = datetime.datetime.now()
+ cls.start = cls._parse_strtime(now - datetime.timedelta(days=1))
+ cls.end = cls._parse_strtime(now + datetime.timedelta(days=1))
+
+ @classmethod
+ def _parse_strtime(cls, at):
+ # Returns formatted datetime
+ return at.strftime('%Y-%m-%dT%H:%M:%S.%f')
+
+ @attr(type=['negative', 'gate'])
+ def test_get_usage_tenant_with_empty_tenant_id(self):
+ # Get usage for a specific tenant empty
+ params = {'start': self.start,
+ 'end': self.end}
+ self.assertRaises(exceptions.NotFound,
+ self.adm_client.get_tenant_usage,
+ '', params)
+
+ @attr(type=['negative', 'gate'])
+ def test_get_usage_tenant_with_invalid_date(self):
+ # Get usage for tenant with invalid date
+ params = {'start': self.end,
+ 'end': self.start}
+ resp, tenants = self.identity_client.list_tenants()
+ tenant_id = [tnt['id'] for tnt in tenants if tnt['name'] ==
+ self.client.tenant_name][0]
+ self.assertRaises(exceptions.BadRequest,
+ self.adm_client.get_tenant_usage,
+ tenant_id, params)
+
+ @attr(type=['negative', 'gate'])
+ def test_list_usage_all_tenants_with_non_admin_user(self):
+ # Get usage for all tenants with non admin user
+ params = {'start': self.start,
+ 'end': self.end,
+ 'detailed': int(bool(True))}
+ self.assertRaises(exceptions.Unauthorized,
+ self.client.list_tenant_usages, params)
+
+
+class TenantUsagesNegativeTestXML(TenantUsagesNegativeTestJSON):
+ _interface = 'xml'
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index 093754c..b060f15 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -100,9 +100,8 @@
except exceptions.NotFound:
# The image may have already been deleted which is OK.
pass
- except Exception as exc:
- LOG.info('Exception raised deleting image %s', image_id)
- LOG.exception(exc)
+ except Exception:
+ LOG.exception('Exception raised deleting image %s' % image_id)
pass
@classmethod
@@ -214,8 +213,8 @@
try:
cls.servers_client.delete_server(server_id)
cls.servers_client.wait_for_server_termination(server_id)
- except Exception as exc:
- LOG.exception(exc)
+ except Exception:
+ LOG.exception('Failed to delete server %s' % server_id)
pass
resp, server = cls.create_test_server(wait_until='ACTIVE', **kwargs)
cls.password = server['adminPass']
@@ -300,8 +299,8 @@
try:
cls.servers_client.delete_server(server_id)
cls.servers_client.wait_for_server_termination(server_id)
- except Exception as exc:
- LOG.exception(exc)
+ except Exception:
+ LOG.exception('Failed to delete server %s' % server_id)
pass
resp, server = cls.create_test_server(wait_until='ACTIVE', **kwargs)
cls.password = server['admin_password']
diff --git a/tempest/api/compute/floating_ips/test_floating_ips_actions.py b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
index f4ad449..32e7b39 100644
--- a/tempest/api/compute/floating_ips/test_floating_ips_actions.py
+++ b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
@@ -51,17 +51,15 @@
# Positive test:Allocation of a new floating IP to a project
# should be successful
resp, body = self.client.create_floating_ip()
- self.assertEqual(200, resp.status)
floating_ip_id_allocated = body['id']
- try:
- resp, floating_ip_details = \
- self.client.get_floating_ip_details(floating_ip_id_allocated)
- # Checking if the details of allocated IP is in list of floating IP
- resp, body = self.client.list_floating_ips()
- self.assertIn(floating_ip_details, body)
- finally:
- # Deleting the floating IP which is created in this method
- self.client.delete_floating_ip(floating_ip_id_allocated)
+ self.addCleanup(self.client.delete_floating_ip,
+ floating_ip_id_allocated)
+ self.assertEqual(200, resp.status)
+ resp, floating_ip_details = \
+ self.client.get_floating_ip_details(floating_ip_id_allocated)
+ # Checking if the details of allocated IP is in list of floating IP
+ resp, body = self.client.list_floating_ips()
+ self.assertIn(floating_ip_details, body)
@attr(type='gate')
def test_delete_floating_ip(self):
diff --git a/tempest/api/compute/floating_ips/test_list_floating_ips.py b/tempest/api/compute/floating_ips/test_list_floating_ips.py
index e4d03ae..9238994 100644
--- a/tempest/api/compute/floating_ips/test_list_floating_ips.py
+++ b/tempest/api/compute/floating_ips/test_list_floating_ips.py
@@ -54,25 +54,23 @@
def test_get_floating_ip_details(self):
# Positive test:Should be able to GET the details of floatingIP
# Creating a floating IP for which details are to be checked
- try:
- resp, body = self.client.create_floating_ip()
- floating_ip_instance_id = body['instance_id']
- floating_ip_ip = body['ip']
- floating_ip_fixed_ip = body['fixed_ip']
- floating_ip_id = body['id']
- resp, body = \
- self.client.get_floating_ip_details(floating_ip_id)
- self.assertEqual(200, resp.status)
- # Comparing the details of floating IP
- self.assertEqual(floating_ip_instance_id,
- body['instance_id'])
- self.assertEqual(floating_ip_ip, body['ip'])
- self.assertEqual(floating_ip_fixed_ip,
- body['fixed_ip'])
- self.assertEqual(floating_ip_id, body['id'])
- # Deleting the floating IP created in this method
- finally:
- self.client.delete_floating_ip(floating_ip_id)
+ resp, body = self.client.create_floating_ip()
+ floating_ip_id = body['id']
+ self.addCleanup(self.client.delete_floating_ip,
+ floating_ip_id)
+ floating_ip_instance_id = body['instance_id']
+ floating_ip_ip = body['ip']
+ floating_ip_fixed_ip = body['fixed_ip']
+ resp, body = \
+ self.client.get_floating_ip_details(floating_ip_id)
+ self.assertEqual(200, resp.status)
+ # Comparing the details of floating IP
+ self.assertEqual(floating_ip_instance_id,
+ body['instance_id'])
+ self.assertEqual(floating_ip_ip, body['ip'])
+ self.assertEqual(floating_ip_fixed_ip,
+ body['fixed_ip'])
+ self.assertEqual(floating_ip_id, body['id'])
@attr(type='gate')
def test_list_floating_ip_pools(self):
diff --git a/tempest/api/compute/images/test_images_oneserver.py b/tempest/api/compute/images/test_images_oneserver.py
index c711bd5..26cc3f6 100644
--- a/tempest/api/compute/images/test_images_oneserver.py
+++ b/tempest/api/compute/images/test_images_oneserver.py
@@ -46,10 +46,11 @@
try:
self.servers_client.wait_for_server_status(self.server_id,
'ACTIVE')
- except Exception as exc:
- LOG.exception(exc)
+ except Exception:
+ LOG.exception('server %s timed out to become ACTIVE. rebuilding'
+ % self.server_id)
# Rebuild server if cannot reach the ACTIVE state
- # Usually it means the server had a serius accident
+ # Usually it means the server had a serious accident
self.__class__.server_id = self.rebuild_server(self.server_id)
@classmethod
diff --git a/tempest/api/compute/images/test_images_oneserver_negative.py b/tempest/api/compute/images/test_images_oneserver_negative.py
index b8a4304..5e235d1 100644
--- a/tempest/api/compute/images/test_images_oneserver_negative.py
+++ b/tempest/api/compute/images/test_images_oneserver_negative.py
@@ -45,10 +45,11 @@
try:
self.servers_client.wait_for_server_status(self.server_id,
'ACTIVE')
- except Exception as exc:
- LOG.exception(exc)
+ except Exception:
+ LOG.exception('server %s timed out to become ACTIVE. rebuilding'
+ % self.server_id)
# Rebuild server if cannot reach the ACTIVE state
- # Usually it means the server had a serius accident
+ # Usually it means the server had a serious accident
self._reset_server()
def _reset_server(self):
diff --git a/tempest/api/compute/images/test_list_image_filters.py b/tempest/api/compute/images/test_list_image_filters.py
index ac2ecba..bfdd8b2 100644
--- a/tempest/api/compute/images/test_list_image_filters.py
+++ b/tempest/api/compute/images/test_list_image_filters.py
@@ -59,8 +59,8 @@
resp, cls.image2 = cls.create_image_from_server(
cls.server1['id'], wait_until='ACTIVE')
cls.image2_id = cls.image2['id']
- except Exception as exc:
- LOG.exception(exc)
+ except Exception:
+ LOG.exception('setUpClass failed')
cls.tearDownClass()
raise
diff --git a/tempest/api/compute/servers/test_multiple_create.py b/tempest/api/compute/servers/test_multiple_create.py
index 080bd1a..91c350e 100644
--- a/tempest/api/compute/servers/test_multiple_create.py
+++ b/tempest/api/compute/servers/test_multiple_create.py
@@ -17,8 +17,7 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
-from tempest import exceptions
-from tempest.test import attr
+from tempest import test
class MultipleCreateTestJSON(base.BaseV2ComputeTest):
@@ -38,7 +37,7 @@
return resp, body
- @attr(type='gate')
+ @test.attr(type='gate')
def test_multiple_create(self):
resp, body = self._create_multiple_servers(wait_until='ACTIVE',
min_count=1,
@@ -49,39 +48,7 @@
self.assertEqual('202', resp['status'])
self.assertNotIn('reservation_id', body)
- @attr(type=['negative', 'gate'])
- def test_min_count_less_than_one(self):
- invalid_min_count = 0
- self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
- min_count=invalid_min_count)
-
- @attr(type=['negative', 'gate'])
- def test_min_count_non_integer(self):
- invalid_min_count = 2.5
- self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
- min_count=invalid_min_count)
-
- @attr(type=['negative', 'gate'])
- def test_max_count_less_than_one(self):
- invalid_max_count = 0
- self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
- max_count=invalid_max_count)
-
- @attr(type=['negative', 'gate'])
- def test_max_count_non_integer(self):
- invalid_max_count = 2.5
- self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
- max_count=invalid_max_count)
-
- @attr(type=['negative', 'gate'])
- def test_max_count_less_than_min_count(self):
- min_count = 3
- max_count = 2
- self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
- min_count=min_count,
- max_count=max_count)
-
- @attr(type='gate')
+ @test.attr(type='gate')
def test_multiple_create_with_reservation_return(self):
resp, body = self._create_multiple_servers(wait_until='ACTIVE',
min_count=1,
diff --git a/tempest/api/compute/servers/test_multiple_create_negative.py b/tempest/api/compute/servers/test_multiple_create_negative.py
new file mode 100644
index 0000000..a9d9945
--- /dev/null
+++ b/tempest/api/compute/servers/test_multiple_create_negative.py
@@ -0,0 +1,75 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 IBM Corp
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.api.compute import base
+from tempest.common.utils import data_utils
+from tempest import exceptions
+from tempest import test
+
+
+class MultipleCreateNegativeTestJSON(base.BaseV2ComputeTest):
+ _interface = 'json'
+ _name = 'multiple-create-test'
+
+ def _generate_name(self):
+ return data_utils.rand_name(self._name)
+
+ def _create_multiple_servers(self, name=None, wait_until=None, **kwargs):
+ """
+ This is the right way to create_multiple servers and manage to get the
+ created servers into the servers list to be cleaned up after all.
+ """
+ kwargs['name'] = kwargs.get('name', self._generate_name())
+ resp, body = self.create_test_server(**kwargs)
+
+ return resp, body
+
+ @test.attr(type=['negative', 'gate'])
+ def test_min_count_less_than_one(self):
+ invalid_min_count = 0
+ self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
+ min_count=invalid_min_count)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_min_count_non_integer(self):
+ invalid_min_count = 2.5
+ self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
+ min_count=invalid_min_count)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_max_count_less_than_one(self):
+ invalid_max_count = 0
+ self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
+ max_count=invalid_max_count)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_max_count_non_integer(self):
+ invalid_max_count = 2.5
+ self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
+ max_count=invalid_max_count)
+
+ @test.attr(type=['negative', 'gate'])
+ def test_max_count_less_than_min_count(self):
+ min_count = 3
+ max_count = 2
+ self.assertRaises(exceptions.BadRequest, self._create_multiple_servers,
+ min_count=min_count,
+ max_count=max_count)
+
+
+class MultipleCreateNegativeTestXML(MultipleCreateNegativeTestJSON):
+ _interface = 'xml'
diff --git a/tempest/api/compute/servers/test_server_addresses.py b/tempest/api/compute/servers/test_server_addresses.py
index 7ca8a52..1e55afb 100644
--- a/tempest/api/compute/servers/test_server_addresses.py
+++ b/tempest/api/compute/servers/test_server_addresses.py
@@ -16,34 +16,20 @@
# under the License.
from tempest.api.compute import base
-from tempest import exceptions
-from tempest.test import attr
+from tempest import test
-class ServerAddressesTest(base.BaseV2ComputeTest):
+class ServerAddressesTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
def setUpClass(cls):
- super(ServerAddressesTest, cls).setUpClass()
+ super(ServerAddressesTestJSON, cls).setUpClass()
cls.client = cls.servers_client
resp, cls.server = cls.create_test_server(wait_until='ACTIVE')
- @attr(type=['negative', 'gate'])
- def test_list_server_addresses_invalid_server_id(self):
- # List addresses request should fail if server id not in system
- self.assertRaises(exceptions.NotFound, self.client.list_addresses,
- '999')
-
- @attr(type=['negative', 'gate'])
- def test_list_server_addresses_by_network_neg(self):
- # List addresses by network should fail if network name not valid
- self.assertRaises(exceptions.NotFound,
- self.client.list_addresses_by_network,
- self.server['id'], 'invalid')
-
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_list_server_addresses(self):
# All public and private addresses for
# a server should be returned
@@ -60,7 +46,7 @@
self.assertTrue(address['addr'])
self.assertTrue(address['version'])
- @attr(type='smoke')
+ @test.attr(type='smoke')
def test_list_server_addresses_by_network(self):
# Providing a network type should filter
# the addresses return by that type
@@ -80,5 +66,5 @@
self.assertTrue(any([a for a in addr if a == address]))
-class ServerAddressesTestXML(ServerAddressesTest):
+class ServerAddressesTestXML(ServerAddressesTestJSON):
_interface = 'xml'
diff --git a/tempest/api/compute/servers/test_server_addresses_negative.py b/tempest/api/compute/servers/test_server_addresses_negative.py
new file mode 100644
index 0000000..30aa7d1
--- /dev/null
+++ b/tempest/api/compute/servers/test_server_addresses_negative.py
@@ -0,0 +1,48 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2012 OpenStack Foundation
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.api.compute import base
+from tempest import exceptions
+from tempest import test
+
+
+class ServerAddressesNegativeTestJSON(base.BaseV2ComputeTest):
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(ServerAddressesNegativeTestJSON, cls).setUpClass()
+ cls.client = cls.servers_client
+
+ resp, cls.server = cls.create_test_server(wait_until='ACTIVE')
+
+ @test.attr(type=['negative', 'gate'])
+ def test_list_server_addresses_invalid_server_id(self):
+ # List addresses request should fail if server id not in system
+ self.assertRaises(exceptions.NotFound, self.client.list_addresses,
+ '999')
+
+ @test.attr(type=['negative', 'gate'])
+ def test_list_server_addresses_by_network_neg(self):
+ # List addresses by network should fail if network name not valid
+ self.assertRaises(exceptions.NotFound,
+ self.client.list_addresses_by_network,
+ self.server['id'], 'invalid')
+
+
+class ServerAddressesNegativeTestXML(ServerAddressesNegativeTestJSON):
+ _interface = 'xml'
diff --git a/tempest/api/compute/test_auth_token.py b/tempest/api/compute/test_auth_token.py
deleted file mode 100644
index e52c415..0000000
--- a/tempest/api/compute/test_auth_token.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# Copyright 2013 IBM Corp
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-
-import testtools
-
-from tempest.api.compute import base
-import tempest.config as config
-
-CONF = config.CONF
-
-
-class AuthTokenTestJSON(base.BaseV2ComputeTest):
- _interface = 'json'
-
- @classmethod
- def setUpClass(cls):
- super(AuthTokenTestJSON, cls).setUpClass()
-
- cls.servers_v2 = cls.os.servers_client
- cls.servers_v3 = cls.os.servers_client_v3_auth
-
- def test_v2_token(self):
- # Can get a token using v2 of the identity API and use that to perform
- # an operation on the compute service.
-
- # Doesn't matter which compute API is used,
- # picking list_servers because it's easy.
- self.servers_v2.list_servers()
-
- @testtools.skipIf(not CONF.identity.uri_v3,
- 'v3 auth client not configured')
- def test_v3_token(self):
- # Can get a token using v3 of the identity API and use that to perform
- # an operation on the compute service.
-
- # Doesn't matter which compute API is used,
- # picking list_servers because it's easy.
- self.servers_v3.list_servers()
-
-
-class AuthTokenTestXML(AuthTokenTestJSON):
- _interface = 'xml'
diff --git a/tempest/api/compute/v3/admin/test_servers.py b/tempest/api/compute/v3/admin/test_servers.py
new file mode 100644
index 0000000..6fe3186
--- /dev/null
+++ b/tempest/api/compute/v3/admin/test_servers.py
@@ -0,0 +1,146 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.api.compute import base
+from tempest.common.utils import data_utils
+from tempest import exceptions
+from tempest.test import attr
+from tempest.test import skip_because
+
+
+class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
+
+ """
+ Tests Servers API using admin privileges
+ """
+
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(ServersAdminTestJSON, cls).setUpClass()
+ cls.client = cls.os_adm.servers_client
+ cls.non_admin_client = cls.servers_client
+ cls.flavors_client = cls.os_adm.flavors_client
+
+ cls.s1_name = data_utils.rand_name('server')
+ resp, server = cls.create_test_server(name=cls.s1_name,
+ wait_until='ACTIVE')
+ cls.s1_id = server['id']
+
+ cls.s2_name = data_utils.rand_name('server')
+ resp, server = cls.create_test_server(name=cls.s2_name,
+ wait_until='ACTIVE')
+
+ def _get_unused_flavor_id(self):
+ flavor_id = data_utils.rand_int_id(start=1000)
+ while True:
+ try:
+ resp, body = self.flavors_client.get_flavor_details(flavor_id)
+ except exceptions.NotFound:
+ break
+ flavor_id = data_utils.rand_int_id(start=1000)
+ return flavor_id
+
+ @attr(type='gate')
+ def test_list_servers_by_admin(self):
+ # Listing servers by admin user returns empty list by default
+ resp, body = self.client.list_servers_with_detail()
+ servers = body['servers']
+ self.assertEqual('200', resp['status'])
+ self.assertEqual([], servers)
+
+ @attr(type='gate')
+ def test_list_servers_by_admin_with_all_tenants(self):
+ # Listing servers by admin user with all tenants parameter
+ # Here should be listed all servers
+ params = {'all_tenants': ''}
+ resp, body = self.client.list_servers_with_detail(params)
+ servers = body['servers']
+ servers_name = map(lambda x: x['name'], servers)
+
+ self.assertIn(self.s1_name, servers_name)
+ self.assertIn(self.s2_name, servers_name)
+
+ @attr(type='gate')
+ def test_admin_delete_servers_of_others(self):
+ # Administrator can delete servers of others
+ _, server = self.create_test_server()
+ resp, _ = self.client.delete_server(server['id'])
+ self.assertEqual('204', resp['status'])
+ self.servers_client.wait_for_server_termination(server['id'])
+
+ @attr(type='gate')
+ def test_reset_state_server(self):
+ # Reset server's state to 'error'
+ resp, server = self.client.reset_state(self.s1_id)
+ self.assertEqual(202, resp.status)
+
+ # Verify server's state
+ resp, server = self.client.get_server(self.s1_id)
+ self.assertEqual(server['status'], 'ERROR')
+
+ # Reset server's state to 'active'
+ resp, server = self.client.reset_state(self.s1_id, state='active')
+ self.assertEqual(202, resp.status)
+
+ # Verify server's state
+ resp, server = self.client.get_server(self.s1_id)
+ self.assertEqual(server['status'], 'ACTIVE')
+
+ @attr(type='gate')
+ @skip_because(bug="1240043")
+ def test_get_server_diagnostics_by_admin(self):
+ # Retrieve server diagnostics by admin user
+ resp, diagnostic = self.client.get_server_diagnostics(self.s1_id)
+ self.assertEqual(200, resp.status)
+ basic_attrs = ['rx_packets', 'rx_errors', 'rx_drop',
+ 'tx_packets', 'tx_errors', 'tx_drop',
+ 'read_req', 'write_req', 'cpu', 'memory']
+ for key in basic_attrs:
+ self.assertIn(key, str(diagnostic.keys()))
+
+ @attr(type='gate')
+ def test_rebuild_server_in_error_state(self):
+ # The server in error state should be rebuilt using the provided
+ # image and changed to ACTIVE state
+
+ # resetting vm state require admin priviledge
+ resp, server = self.client.reset_state(self.s1_id, state='error')
+ self.assertEqual(202, resp.status)
+ resp, rebuilt_server = self.non_admin_client.rebuild(
+ self.s1_id, self.image_ref_alt)
+ self.addCleanup(self.non_admin_client.wait_for_server_status,
+ self.s1_id, 'ACTIVE')
+ self.addCleanup(self.non_admin_client.rebuild, self.s1_id,
+ self.image_ref)
+
+ # Verify the properties in the initial response are correct
+ self.assertEqual(self.s1_id, rebuilt_server['id'])
+ rebuilt_image_id = rebuilt_server['image']['id']
+ self.assertEqual(self.image_ref_alt, rebuilt_image_id)
+ self.assertEqual(self.flavor_ref, rebuilt_server['flavor']['id'])
+ self.non_admin_client.wait_for_server_status(rebuilt_server['id'],
+ 'ACTIVE',
+ raise_on_error=False)
+ # Verify the server properties after rebuilding
+ resp, server = self.non_admin_client.get_server(rebuilt_server['id'])
+ rebuilt_image_id = server['image']['id']
+ self.assertEqual(self.image_ref_alt, rebuilt_image_id)
+
+
+class ServersAdminTestXML(ServersAdminTestJSON):
+ _interface = 'xml'
diff --git a/tempest/api/compute/v3/admin/test_servers_negative.py b/tempest/api/compute/v3/admin/test_servers_negative.py
new file mode 100644
index 0000000..77d873b
--- /dev/null
+++ b/tempest/api/compute/v3/admin/test_servers_negative.py
@@ -0,0 +1,143 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 Huawei Technologies Co.,LTD.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import uuid
+
+from tempest.api.compute import base
+from tempest.common.utils import data_utils
+from tempest import exceptions
+from tempest.test import attr
+
+
+class ServersAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
+
+ """
+ Tests Servers API using admin privileges
+ """
+
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(ServersAdminNegativeTestJSON, cls).setUpClass()
+ cls.client = cls.os_adm.servers_client
+ cls.non_adm_client = cls.servers_client
+ cls.flavors_client = cls.os_adm.flavors_client
+ cls.identity_client = cls._get_identity_admin_client()
+ tenant = cls.identity_client.get_tenant_by_name(
+ cls.client.tenant_name)
+ cls.tenant_id = tenant['id']
+
+ cls.s1_name = data_utils.rand_name('server')
+ resp, server = cls.create_test_server(name=cls.s1_name,
+ wait_until='ACTIVE')
+ cls.s1_id = server['id']
+
+ def _get_unused_flavor_id(self):
+ flavor_id = data_utils.rand_int_id(start=1000)
+ while True:
+ try:
+ resp, body = self.flavors_client.get_flavor_details(flavor_id)
+ except exceptions.NotFound:
+ break
+ flavor_id = data_utils.rand_int_id(start=1000)
+ return flavor_id
+
+ @attr(type=['negative', 'gate'])
+ def test_resize_server_using_overlimit_ram(self):
+ flavor_name = data_utils.rand_name("flavor-")
+ flavor_id = self._get_unused_flavor_id()
+ resp, quota_set = self.quotas_client.get_default_quota_set(
+ self.tenant_id)
+ ram = int(quota_set['ram']) + 1
+ vcpus = 8
+ disk = 10
+ resp, flavor_ref = self.flavors_client.create_flavor(flavor_name,
+ ram, vcpus, disk,
+ flavor_id)
+ self.addCleanup(self.flavors_client.delete_flavor, flavor_id)
+ self.assertRaises(exceptions.OverLimit,
+ self.client.resize,
+ self.servers[0]['id'],
+ flavor_ref['id'])
+
+ @attr(type=['negative', 'gate'])
+ def test_resize_server_using_overlimit_vcpus(self):
+ flavor_name = data_utils.rand_name("flavor-")
+ flavor_id = self._get_unused_flavor_id()
+ ram = 512
+ resp, quota_set = self.quotas_client.get_default_quota_set(
+ self.tenant_id)
+ vcpus = int(quota_set['cores']) + 1
+ disk = 10
+ resp, flavor_ref = self.flavors_client.create_flavor(flavor_name,
+ ram, vcpus, disk,
+ flavor_id)
+ self.addCleanup(self.flavors_client.delete_flavor, flavor_id)
+ self.assertRaises(exceptions.OverLimit,
+ self.client.resize,
+ self.servers[0]['id'],
+ flavor_ref['id'])
+
+ @attr(type=['negative', 'gate'])
+ def test_reset_state_server_invalid_state(self):
+ self.assertRaises(exceptions.BadRequest,
+ self.client.reset_state, self.s1_id,
+ state='invalid')
+
+ @attr(type=['negative', 'gate'])
+ def test_reset_state_server_invalid_type(self):
+ self.assertRaises(exceptions.BadRequest,
+ self.client.reset_state, self.s1_id,
+ state=1)
+
+ @attr(type=['negative', 'gate'])
+ def test_reset_state_server_nonexistent_server(self):
+ self.assertRaises(exceptions.NotFound,
+ self.client.reset_state, '999')
+
+ @attr(type=['negative', 'gate'])
+ def test_get_server_diagnostics_by_non_admin(self):
+ # Non-admin user can not view server diagnostics according to policy
+ self.assertRaises(exceptions.Unauthorized,
+ self.non_adm_client.get_server_diagnostics,
+ self.s1_id)
+
+ @attr(type=['negative', 'gate'])
+ def test_migrate_non_existent_server(self):
+ # migrate a non existent server
+ self.assertRaises(exceptions.NotFound,
+ self.client.migrate_server,
+ str(uuid.uuid4()))
+
+ @attr(type=['negative', 'gate'])
+ def test_migrate_server_invalid_state(self):
+ # create server.
+ resp, server = self.create_test_server(wait_until='ACTIVE')
+ self.assertEqual(202, resp.status)
+ server_id = server['id']
+ # suspend the server.
+ resp, _ = self.client.suspend_server(server_id)
+ self.assertEqual(202, resp.status)
+ self.client.wait_for_server_status(server_id, 'SUSPENDED')
+ # migrate an suspended server should fail
+ self.assertRaises(exceptions.Conflict,
+ self.client.migrate_server,
+ server_id)
+
+
+class ServersAdminNegativeTestXML(ServersAdminNegativeTestJSON):
+ _interface = 'xml'
diff --git a/tempest/api/compute/v3/admin/test_simple_tenant_usage.py b/tempest/api/compute/v3/admin/test_simple_tenant_usage.py
index 3fc58eb..99f2c52 100644
--- a/tempest/api/compute/v3/admin/test_simple_tenant_usage.py
+++ b/tempest/api/compute/v3/admin/test_simple_tenant_usage.py
@@ -18,7 +18,6 @@
import datetime
from tempest.api.compute import base
-from tempest import exceptions
from tempest.test import attr
import time
@@ -83,33 +82,6 @@
self.assertEqual(200, resp.status)
self.assertEqual(len(tenant_usage), 8)
- @attr(type=['negative', 'gate'])
- def test_get_usage_tenant_with_empty_tenant_id(self):
- # Get usage for a specific tenant empty
- params = {'start': self.start,
- 'end': self.end}
- self.assertRaises(exceptions.NotFound,
- self.adm_client.get_tenant_usage,
- '', params)
-
- @attr(type=['negative', 'gate'])
- def test_get_usage_tenant_with_invalid_date(self):
- # Get usage for tenant with invalid date
- params = {'start': self.end,
- 'end': self.start}
- self.assertRaises(exceptions.BadRequest,
- self.adm_client.get_tenant_usage,
- self.tenant_id, params)
-
- @attr(type=['negative', 'gate'])
- def test_list_usage_all_tenants_with_non_admin_user(self):
- # Get usage for all tenants with non admin user
- params = {'start': self.start,
- 'end': self.end,
- 'detailed': int(bool(True))}
- self.assertRaises(exceptions.Unauthorized,
- self.client.list_tenant_usages, params)
-
class TenantUsagesV3TestXML(TenantUsagesV3TestJSON):
_interface = 'xml'
diff --git a/tempest/api/compute/v3/admin/test_simple_tenant_usage_negative.py b/tempest/api/compute/v3/admin/test_simple_tenant_usage_negative.py
new file mode 100644
index 0000000..ef49ed7
--- /dev/null
+++ b/tempest/api/compute/v3/admin/test_simple_tenant_usage_negative.py
@@ -0,0 +1,76 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 NEC Corporation
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import datetime
+
+from tempest.api.compute import base
+from tempest import exceptions
+from tempest.test import attr
+
+
+class TenantUsagesNegativeV3TestJSON(base.BaseV3ComputeAdminTest):
+
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(TenantUsagesNegativeV3TestJSON, cls).setUpClass()
+ cls.adm_client = cls.os_adm.tenant_usages_client
+ cls.client = cls.os.tenant_usages_client
+ cls.identity_client = cls._get_identity_admin_client()
+ now = datetime.datetime.now()
+ cls.start = cls._parse_strtime(now - datetime.timedelta(days=1))
+ cls.end = cls._parse_strtime(now + datetime.timedelta(days=1))
+
+ @classmethod
+ def _parse_strtime(cls, at):
+ # Returns formatted datetime
+ return at.strftime('%Y-%m-%dT%H:%M:%S.%f')
+
+ @attr(type=['negative', 'gate'])
+ def test_get_usage_tenant_with_empty_tenant_id(self):
+ # Get usage for a specific tenant empty
+ params = {'start': self.start,
+ 'end': self.end}
+ self.assertRaises(exceptions.NotFound,
+ self.adm_client.get_tenant_usage,
+ '', params)
+
+ @attr(type=['negative', 'gate'])
+ def test_get_usage_tenant_with_invalid_date(self):
+ # Get usage for tenant with invalid date
+ params = {'start': self.end,
+ 'end': self.start}
+ resp, tenants = self.identity_client.list_tenants()
+ tenant_id = [tnt['id'] for tnt in tenants if tnt['name'] ==
+ self.client.tenant_name][0]
+ self.assertRaises(exceptions.BadRequest,
+ self.adm_client.get_tenant_usage,
+ tenant_id, params)
+
+ @attr(type=['negative', 'gate'])
+ def test_list_usage_all_tenants_with_non_admin_user(self):
+ # Get usage for all tenants with non admin user
+ params = {'start': self.start,
+ 'end': self.end,
+ 'detailed': int(bool(True))}
+ self.assertRaises(exceptions.Unauthorized,
+ self.client.list_tenant_usages, params)
+
+
+class TenantUsagesNegativeV3TestXML(TenantUsagesNegativeV3TestJSON):
+ _interface = 'xml'
diff --git a/tempest/api/identity/admin/test_services.py b/tempest/api/identity/admin/test_services.py
index 7fe5171..872adb8 100644
--- a/tempest/api/identity/admin/test_services.py
+++ b/tempest/api/identity/admin/test_services.py
@@ -25,47 +25,47 @@
class ServicesTestJSON(base.BaseIdentityAdminTest):
_interface = 'json'
+ def _del_service(self, service_id):
+ # Deleting the service created in this method
+ resp, _ = self.client.delete_service(service_id)
+ self.assertEqual(resp['status'], '204')
+ # Checking whether service is deleted successfully
+ self.assertRaises(exceptions.NotFound, self.client.get_service,
+ service_id)
+
@attr(type='smoke')
def test_create_get_delete_service(self):
# GET Service
- try:
- # Creating a Service
- name = data_utils.rand_name('service-')
- type = data_utils.rand_name('type--')
- description = data_utils.rand_name('description-')
- resp, service_data = self.client.create_service(
- name, type, description=description)
- self.assertTrue(resp['status'].startswith('2'))
- # Verifying response body of create service
- self.assertIn('id', service_data)
- self.assertFalse(service_data['id'] is None)
- self.assertIn('name', service_data)
- self.assertEqual(name, service_data['name'])
- self.assertIn('type', service_data)
- self.assertEqual(type, service_data['type'])
- self.assertIn('description', service_data)
- self.assertEqual(description, service_data['description'])
- # Get service
- resp, fetched_service = self.client.get_service(service_data['id'])
- self.assertTrue(resp['status'].startswith('2'))
- # verifying the existence of service created
- self.assertIn('id', fetched_service)
- self.assertEqual(fetched_service['id'], service_data['id'])
- self.assertIn('name', fetched_service)
- self.assertEqual(fetched_service['name'], service_data['name'])
- self.assertIn('type', fetched_service)
- self.assertEqual(fetched_service['type'], service_data['type'])
- self.assertIn('description', fetched_service)
- self.assertEqual(fetched_service['description'],
- service_data['description'])
- finally:
- if 'service_data' in locals():
- # Deleting the service created in this method
- resp, _ = self.client.delete_service(service_data['id'])
- self.assertEqual(resp['status'], '204')
- # Checking whether service is deleted successfully
- self.assertRaises(exceptions.NotFound, self.client.get_service,
- service_data['id'])
+ # Creating a Service
+ name = data_utils.rand_name('service-')
+ type = data_utils.rand_name('type--')
+ description = data_utils.rand_name('description-')
+ resp, service_data = self.client.create_service(
+ name, type, description=description)
+ self.assertFalse(service_data['id'] is None)
+ self.addCleanup(self._del_service, service_data['id'])
+ self.assertTrue(resp['status'].startswith('2'))
+ # Verifying response body of create service
+ self.assertIn('id', service_data)
+ self.assertIn('name', service_data)
+ self.assertEqual(name, service_data['name'])
+ self.assertIn('type', service_data)
+ self.assertEqual(type, service_data['type'])
+ self.assertIn('description', service_data)
+ self.assertEqual(description, service_data['description'])
+ # Get service
+ resp, fetched_service = self.client.get_service(service_data['id'])
+ self.assertTrue(resp['status'].startswith('2'))
+ # verifying the existence of service created
+ self.assertIn('id', fetched_service)
+ self.assertEqual(fetched_service['id'], service_data['id'])
+ self.assertIn('name', fetched_service)
+ self.assertEqual(fetched_service['name'], service_data['name'])
+ self.assertIn('type', fetched_service)
+ self.assertEqual(fetched_service['type'], service_data['type'])
+ self.assertIn('description', fetched_service)
+ self.assertEqual(fetched_service['description'],
+ service_data['description'])
@attr(type='smoke')
def test_list_services(self):
diff --git a/tempest/api/identity/admin/v3/test_trusts.py b/tempest/api/identity/admin/v3/test_trusts.py
index 5e13a5a..e1d28d7 100644
--- a/tempest/api/identity/admin/v3/test_trusts.py
+++ b/tempest/api/identity/admin/v3/test_trusts.py
@@ -12,10 +12,13 @@
# License for the specific language governing permissions and limitations
# under the License.
+import datetime
+import re
from tempest.api.identity import base
from tempest import clients
from tempest.common.utils.data_utils import rand_name
from tempest import exceptions
+from tempest.openstack.common import timeutils
from tempest.test import attr
@@ -115,7 +118,15 @@
summary=False):
self.assertIsNotNone(trust['id'])
self.assertEqual(impersonate, trust['impersonation'])
- self.assertEqual(expires, trust['expires_at'])
+ # FIXME(shardy): ref bug #1246383 we can't check the
+ # microsecond component of the expiry time, because mysql
+ # <5.6.4 doesn't support microseconds.
+ # expected format 2013-12-20T16:08:36.036987Z
+ if expires is not None:
+ expires_nousec = re.sub(r'\.([0-9]){6}Z', '', expires)
+ self.assertTrue(trust['expires_at'].startswith(expires_nousec))
+ else:
+ self.assertIsNone(trust['expires_at'])
self.assertEqual(self.trustor_user_id, trust['trustor_user_id'])
self.assertEqual(self.trustee_user_id, trust['trustee_user_id'])
self.assertIn('v3/OS-TRUST/trusts', trust['links']['self'])
@@ -212,6 +223,24 @@
self.delete_trust()
@attr(type='smoke')
+ def test_trust_expire(self):
+ # Test case to check we can create, get and delete a trust
+ # with an expiry specified
+ expires_at = timeutils.utcnow() + datetime.timedelta(hours=1)
+ expires_str = timeutils.isotime(at=expires_at, subsecond=True)
+
+ trust = self.create_trust(expires=expires_str)
+ self.validate_trust(trust, expires=expires_str)
+
+ trust_get = self.get_trust()
+
+ self.validate_trust(trust_get, expires=expires_str)
+
+ self.check_trust_roles()
+
+ self.delete_trust()
+
+ @attr(type='smoke')
def test_trust_expire_invalid(self):
# Test case to check we can check an invlaid expiry time
# is rejected with the correct error
@@ -220,3 +249,22 @@
self.assertRaises(exceptions.BadRequest,
self.create_trust,
expires=expires_str)
+
+ @attr(type='smoke')
+ def test_get_trusts_query(self):
+ self.create_trust()
+ resp, trusts_get = self.trustor_v3_client.get_trusts(
+ trustor_user_id=self.trustor_user_id)
+ self.assertEqual('200', resp['status'])
+ self.assertEqual(1, len(trusts_get))
+ self.validate_trust(trusts_get[0], summary=True)
+
+ @attr(type='smoke')
+ def test_get_trusts_all(self):
+ self.create_trust()
+ resp, trusts_get = self.v3_client.get_trusts()
+ self.assertEqual('200', resp['status'])
+ trusts = [t for t in trusts_get
+ if t['id'] == self.trust_id]
+ self.assertEqual(1, len(trusts))
+ self.validate_trust(trusts[0], summary=True)
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index 318d891..dcad101 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -66,6 +66,7 @@
cls.health_monitors = []
cls.vpnservices = []
cls.ikepolicies = []
+ cls.floating_ips = []
@classmethod
def tearDownClass(cls):
@@ -75,6 +76,9 @@
# Clean up vpn services
for vpnservice in cls.vpnservices:
cls.client.delete_vpnservice(vpnservice['id'])
+ # Clean up floating IPs
+ for floating_ip in cls.floating_ips:
+ cls.client.delete_floating_ip(floating_ip['id'])
# Clean up routers
for router in cls.routers:
resp, body = cls.client.list_router_interfaces(router['id'])
@@ -167,6 +171,16 @@
return router
@classmethod
+ def create_floating_ip(cls, external_network_id, **kwargs):
+ """Wrapper utility that returns a test floating IP."""
+ resp, body = cls.client.create_floating_ip(
+ external_network_id,
+ **kwargs)
+ fip = body['floatingip']
+ cls.floating_ips.append(fip)
+ return fip
+
+ @classmethod
def create_pool(cls, name, lb_method, protocol, subnet):
"""Wrapper utility that returns a test pool."""
resp, body = cls.client.create_pool(
diff --git a/tempest/api/network/base_routers.py b/tempest/api/network/base_routers.py
new file mode 100644
index 0000000..9baef04
--- /dev/null
+++ b/tempest/api/network/base_routers.py
@@ -0,0 +1,50 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 OpenStack Foundation
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.api.network import base
+
+
+class BaseRouterTest(base.BaseAdminNetworkTest):
+ # NOTE(salv-orlando): This class inherits from BaseAdminNetworkTest
+ # as some router operations, such as enabling or disabling SNAT
+ # require admin credentials by default
+
+ @classmethod
+ def setUpClass(cls):
+ super(BaseRouterTest, cls).setUpClass()
+
+ def _delete_router(self, router_id):
+ resp, _ = self.client.delete_router(router_id)
+ self.assertEqual(204, resp.status)
+ # Asserting that the router is not found in the list
+ # after deletion
+ resp, list_body = self.client.list_routers()
+ self.assertEqual('200', resp['status'])
+ routers_list = list()
+ for router in list_body['routers']:
+ routers_list.append(router['id'])
+ self.assertNotIn(router_id, routers_list)
+
+ def _remove_router_interface_with_subnet_id(self, router_id, subnet_id):
+ resp, _ = self.client.remove_router_interface_with_subnet_id(
+ router_id, subnet_id)
+ self.assertEqual('200', resp['status'])
+
+ def _remove_router_interface_with_port_id(self, router_id, port_id):
+ resp, _ = self.client.remove_router_interface_with_port_id(
+ router_id, port_id)
+ self.assertEqual('200', resp['status'])
diff --git a/tempest/api/network/test_floating_ips.py b/tempest/api/network/test_floating_ips.py
index 7ce8ca6..6f3fa4b 100644
--- a/tempest/api/network/test_floating_ips.py
+++ b/tempest/api/network/test_floating_ips.py
@@ -32,6 +32,9 @@
Delete a Floating IP
List all Floating IPs
Show Floating IP details
+ Associate a Floating IP with a port and then delete that port
+ Associate a Floating IP with a port and then with a port on another
+ router
v2.0 of the Neutron API is assumed. It is also assumed that the following
options are defined in the [network] section of etc/tempest.conf:
@@ -55,31 +58,17 @@
for i in range(2):
cls.create_port(cls.network)
- def _delete_floating_ip(self, floating_ip_id):
- # Deletes a floating IP and verifies if it is deleted or not
- resp, _ = self.client.delete_floatingip(floating_ip_id)
- self.assertEqual(204, resp.status)
- # Asserting that the floating_ip is not found in list after deletion
- resp, floating_ips = self.client.list_floatingips()
- floatingip_id_list = list()
- for f in floating_ips['floatingips']:
- floatingip_id_list.append(f['id'])
- self.assertNotIn(floating_ip_id, floatingip_id_list)
-
@attr(type='smoke')
def test_create_list_show_update_delete_floating_ip(self):
# Creates a floating IP
- resp, floating_ip = self.client.create_floating_ip(
+ created_floating_ip = self.create_floating_ip(
self.ext_net_id, port_id=self.ports[0]['id'])
- self.assertEqual('201', resp['status'])
- created_floating_ip = floating_ip['floatingip']
self.assertIsNotNone(created_floating_ip['id'])
self.assertIsNotNone(created_floating_ip['tenant_id'])
self.assertIsNotNone(created_floating_ip['floating_ip_address'])
self.assertEqual(created_floating_ip['port_id'], self.ports[0]['id'])
self.assertEqual(created_floating_ip['floating_network_id'],
self.ext_net_id)
- self.addCleanup(self._delete_floating_ip, created_floating_ip['id'])
# Verifies the details of a floating_ip
resp, floating_ip = self.client.show_floating_ip(
created_floating_ip['id'])
@@ -120,6 +109,51 @@
self.assertIsNone(updated_floating_ip['fixed_ip_address'])
self.assertIsNone(updated_floating_ip['router_id'])
+ @attr(type='smoke')
+ def test_floating_ip_delete_port(self):
+ # Create a floating IP
+ created_floating_ip = self.create_floating_ip(self.ext_net_id)
+ # Create a port
+ resp, port = self.client.create_port(self.network['id'])
+ created_port = port['port']
+ resp, floating_ip = self.client.update_floating_ip(
+ created_floating_ip['id'], port_id=created_port['id'])
+ self.assertEqual('200', resp['status'])
+ # Delete port
+ self.client.delete_port(created_port['id'])
+ # Verifies the details of the floating_ip
+ resp, floating_ip = self.client.show_floating_ip(
+ created_floating_ip['id'])
+ self.assertEqual('200', resp['status'])
+ shown_floating_ip = floating_ip['floatingip']
+ # Confirm the fields are back to None
+ self.assertEqual(shown_floating_ip['id'], created_floating_ip['id'])
+ self.assertIsNone(shown_floating_ip['port_id'])
+ self.assertIsNone(shown_floating_ip['fixed_ip_address'])
+ self.assertIsNone(shown_floating_ip['router_id'])
+
+ @attr(type='smoke')
+ def test_floating_ip_update_different_router(self):
+ # Associate a floating IP to a port on a router
+ created_floating_ip = self.create_floating_ip(
+ self.ext_net_id, port_id=self.ports[1]['id'])
+ self.assertEqual(created_floating_ip['router_id'], self.router['id'])
+ network2 = self.create_network()
+ subnet2 = self.create_subnet(network2)
+ router2 = self.create_router(data_utils.rand_name('router-'),
+ external_network_id=self.ext_net_id)
+ self.create_router_interface(router2['id'], subnet2['id'])
+ port_other_router = self.create_port(network2)
+ # Associate floating IP to the other port on another router
+ resp, floating_ip = self.client.update_floating_ip(
+ created_floating_ip['id'], port_id=port_other_router['id'])
+ self.assertEqual('200', resp['status'])
+ updated_floating_ip = floating_ip['floatingip']
+ self.assertEqual(updated_floating_ip['router_id'], router2['id'])
+ self.assertEqual(updated_floating_ip['port_id'],
+ port_other_router['id'])
+ self.assertIsNotNone(updated_floating_ip['fixed_ip_address'])
+
class FloatingIPTestXML(FloatingIPTestJSON):
_interface = 'xml'
diff --git a/tempest/api/network/test_routers.py b/tempest/api/network/test_routers.py
index 21934f2..b6022e8 100644
--- a/tempest/api/network/test_routers.py
+++ b/tempest/api/network/test_routers.py
@@ -17,43 +17,18 @@
import netaddr
-from tempest.api.network import base
+from tempest.api.network import base_routers as base
from tempest.common.utils import data_utils
from tempest import test
-class RoutersTest(base.BaseAdminNetworkTest):
- # NOTE(salv-orlando): This class inherits from BaseAdminNetworkTest
- # as some router operations, such as enabling or disabling SNAT
- # require admin credentials by default
+class RoutersTest(base.BaseRouterTest):
_interface = 'json'
@classmethod
def setUpClass(cls):
super(RoutersTest, cls).setUpClass()
- def _delete_router(self, router_id):
- resp, _ = self.client.delete_router(router_id)
- self.assertEqual(204, resp.status)
- # Asserting that the router is not found in the list
- # after deletion
- resp, list_body = self.client.list_routers()
- self.assertEqual('200', resp['status'])
- routers_list = list()
- for router in list_body['routers']:
- routers_list.append(router['id'])
- self.assertNotIn(router_id, routers_list)
-
- def _remove_router_interface_with_subnet_id(self, router_id, subnet_id):
- resp, _ = self.client.remove_router_interface_with_subnet_id(
- router_id, subnet_id)
- self.assertEqual('200', resp['status'])
-
- def _remove_router_interface_with_port_id(self, router_id, port_id):
- resp, _ = self.client.remove_router_interface_with_port_id(
- router_id, port_id)
- self.assertEqual('200', resp['status'])
-
@test.attr(type='smoke')
def test_create_show_list_update_delete_router(self):
# Create a router
diff --git a/tempest/api/network/test_routers_negative.py b/tempest/api/network/test_routers_negative.py
new file mode 100644
index 0000000..520a612
--- /dev/null
+++ b/tempest/api/network/test_routers_negative.py
@@ -0,0 +1,57 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 OpenStack Foundation
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.api.network import base_routers as base
+from tempest.common.utils import data_utils
+from tempest import exceptions
+from tempest.test import attr
+
+
+class RoutersNegativeTest(base.BaseRouterTest):
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(RoutersNegativeTest, cls).setUpClass()
+ cls.router = cls.create_router(data_utils.rand_name('router-'))
+ cls.network = cls.create_network()
+ cls.subnet = cls.create_subnet(cls.network)
+
+ @attr(type=['negative', 'smoke'])
+ def test_router_add_gateway_invalid_network_returns_404(self):
+ self.assertRaises(exceptions.NotFound,
+ self.client.update_router,
+ self.router['id'],
+ external_gateway_info={
+ 'network_id': self.router['id']})
+
+ @attr(type=['negative', 'smoke'])
+ def test_router_add_gateway_net_not_external_returns_400(self):
+ self.create_subnet(self.network)
+ self.assertRaises(exceptions.BadRequest,
+ self.client.update_router,
+ self.router['id'],
+ external_gateway_info={
+ 'network_id': self.network['id']})
+
+ @attr(type=['negative', 'smoke'])
+ def test_router_remove_interface_in_use_returns_409(self):
+ self.client.add_router_interface_with_subnet_id(
+ self.router['id'], self.subnet['id'])
+ self.assertRaises(exceptions.Conflict,
+ self.client.delete_router,
+ self.router['id'])
diff --git a/tempest/api/object_storage/test_object_temp_url.py b/tempest/api/object_storage/test_object_temp_url.py
index 9d5a1c0..d0e5353 100644
--- a/tempest/api/object_storage/test_object_temp_url.py
+++ b/tempest/api/object_storage/test_object_temp_url.py
@@ -39,27 +39,36 @@
def setUpClass(cls):
super(ObjectTempUrlTest, cls).setUpClass()
- # skip this test if CORS isn't enabled in the conf file.
+ # skip this test if TempUrl isn't enabled in the conf file.
if not cls.tempurl_available:
skip_msg = ("%s skipped as TempUrl middleware not available"
% cls.__name__)
raise cls.skipException(skip_msg)
+ # create a container
cls.container_name = data_utils.rand_name(name='TestContainer')
cls.container_client.create_container(cls.container_name)
cls.containers = [cls.container_name]
# update account metadata
cls.key = 'Meta'
+ cls.metadatas = []
cls.metadata = {'Temp-URL-Key': cls.key}
+ cls.metadatas.append(cls.metadata)
cls.account_client.create_account_metadata(metadata=cls.metadata)
- cls.account_client_metadata, _ = \
- cls.account_client.list_account_metadata()
+
+ # create an object
+ cls.object_name = data_utils.rand_name(name='ObjectTemp')
+ cls.content = data_utils.arbitrary_string(size=len(cls.object_name),
+ base_text=cls.object_name)
+ cls.object_client.create_object(cls.container_name,
+ cls.object_name, cls.content)
@classmethod
def tearDownClass(cls):
- resp, _ = cls.account_client.delete_account_metadata(
- metadata=cls.metadata)
+ for metadata in cls.metadata:
+ cls.account_client.delete_account_metadata(
+ metadata=metadata)
cls.delete_containers(cls.containers)
@@ -69,21 +78,16 @@
def setUp(self):
super(ObjectTempUrlTest, self).setUp()
+
# make sure the metadata has been set
+ account_client_metadata, _ = \
+ self.account_client.list_account_metadata()
self.assertIn('x-account-meta-temp-url-key',
- self.account_client_metadata)
-
+ account_client_metadata)
self.assertEqual(
- self.account_client_metadata['x-account-meta-temp-url-key'],
+ account_client_metadata['x-account-meta-temp-url-key'],
self.key)
- # create object
- self.object_name = data_utils.rand_name(name='ObjectTemp')
- self.data = data_utils.arbitrary_string(size=len(self.object_name),
- base_text=self.object_name)
- self.object_client.create_object(self.container_name,
- self.object_name, self.data)
-
def _get_expiry_date(self, expiration_time=1000):
return int(time.time() + expiration_time)
@@ -114,10 +118,10 @@
expires, self.key)
# trying to get object using temp url within expiry time
- resp, body = self.object_client.get_object_using_temp_url(url)
+ resp, body = self.object_client.get(url)
self.assertIn(int(resp['status']), HTTP_SUCCESS)
self.assertHeaders(resp, 'Object', 'GET')
- self.assertEqual(body, self.data)
+ self.assertEqual(body, self.content)
# Testing a HEAD on this Temp URL
resp, body = self.object_client.head(url)
@@ -129,23 +133,27 @@
key2 = 'Meta2-'
metadata = {'Temp-URL-Key-2': key2}
self.account_client.create_account_metadata(metadata=metadata)
+ self.metadatas.append(metadata)
- self.account_client_metadata, _ = \
+ # make sure the metadata has been set
+ account_client_metadata, _ = \
self.account_client.list_account_metadata()
self.assertIn('x-account-meta-temp-url-key-2',
- self.account_client_metadata)
+ account_client_metadata)
+ self.assertEqual(
+ account_client_metadata['x-account-meta-temp-url-key-2'],
+ key2)
expires = self._get_expiry_date()
url = self._get_temp_url(self.container_name,
self.object_name, "GET",
expires, key2)
- resp, body = self.object_client.get_object_using_temp_url(url)
+ resp, body = self.object_client.get(url)
self.assertIn(int(resp['status']), HTTP_SUCCESS)
- self.assertEqual(body, self.data)
+ self.assertEqual(body, self.content)
@attr(type='gate')
def test_put_object_using_temp_url(self):
- # make sure the metadata has been set
new_data = data_utils.arbitrary_string(
size=len(self.object_name),
base_text=data_utils.rand_name(name="random"))
@@ -156,9 +164,7 @@
expires, self.key)
# trying to put random data in the object using temp url
- resp, body = self.object_client.put_object_using_temp_url(
- url, new_data)
-
+ resp, body = self.object_client.put(url, new_data, None)
self.assertIn(int(resp['status']), HTTP_SUCCESS)
self.assertHeaders(resp, 'Object', 'PUT')
@@ -172,9 +178,23 @@
self.object_name, "GET",
expires, self.key)
- _, body = self.object_client.get_object_using_temp_url(url)
+ _, body = self.object_client.get(url)
self.assertEqual(body, new_data)
+ @attr(type='gate')
+ def test_head_object_using_temp_url(self):
+ expires = self._get_expiry_date()
+
+ # get a temp URL for the created object
+ url = self._get_temp_url(self.container_name,
+ self.object_name, "HEAD",
+ expires, self.key)
+
+ # Testing a HEAD on this Temp URL
+ resp, body = self.object_client.head(url)
+ self.assertIn(int(resp['status']), HTTP_SUCCESS)
+ self.assertHeaders(resp, 'Object', 'HEAD')
+
@attr(type=['gate', 'negative'])
def test_get_object_after_expiration_time(self):
@@ -188,5 +208,4 @@
time.sleep(2)
self.assertRaises(exceptions.Unauthorized,
- self.object_client.get_object_using_temp_url,
- url)
+ self.object_client.get, url)
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index 643d021..9c841cc 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -16,6 +16,7 @@
# under the License.
from tempest import clients
+from tempest.common.utils import data_utils
from tempest.openstack.common import log as logging
import tempest.test
@@ -71,7 +72,10 @@
@classmethod
def create_volume(cls, size=1, **kwargs):
"""Wrapper utility that returns a test volume."""
- resp, volume = cls.volumes_client.create_volume(size, **kwargs)
+ vol_name = data_utils.rand_name('Volume')
+ resp, volume = cls.volumes_client.create_volume(size,
+ display_name=vol_name,
+ **kwargs)
assert 200 == resp.status
cls.volumes.append(volume)
cls.volumes_client.wait_for_volume_status(volume['id'], 'available')
diff --git a/tempest/api/volume/test_volume_transfers.py b/tempest/api/volume/test_volume_transfers.py
index 71e9f85..34eab00 100644
--- a/tempest/api/volume/test_volume_transfers.py
+++ b/tempest/api/volume/test_volume_transfers.py
@@ -17,7 +17,6 @@
from tempest.api.volume import base
from tempest import clients
-from tempest.common.utils.data_utils import rand_name
from tempest.test import attr
@@ -61,10 +60,7 @@
@attr(type='gate')
def test_create_get_list_accept_volume_transfer(self):
# Create a volume first
- vol_name = rand_name('-Volume-')
- _, volume = self.client.create_volume(size=1, display_name=vol_name)
- self.addCleanup(self.adm_client.delete_volume, volume['id'])
- self.client.wait_for_volume_status(volume['id'], 'available')
+ volume = self.create_volume()
# Create a volume transfer
resp, transfer = self.client.create_volume_transfer(volume['id'])
@@ -93,10 +89,7 @@
def test_create_list_delete_volume_transfer(self):
# Create a volume first
- vol_name = rand_name('-Volume-')
- _, volume = self.client.create_volume(size=1, display_name=vol_name)
- self.addCleanup(self.adm_client.delete_volume, volume['id'])
- self.client.wait_for_volume_status(volume['id'], 'available')
+ volume = self.create_volume()
# Create a volume transfer
resp, body = self.client.create_volume_transfer(volume['id'])
diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py
index 61f1bda..7a7ead6 100644
--- a/tempest/api/volume/test_volumes_actions.py
+++ b/tempest/api/volume/test_volumes_actions.py
@@ -31,24 +31,19 @@
cls.client = cls.volumes_client
cls.image_client = cls.os.image_client
- # Create a test shared instance and volume for attach/detach tests
+ # Create a test shared instance
srv_name = data_utils.rand_name(cls.__name__ + '-Instance-')
- vol_name = data_utils.rand_name(cls.__name__ + '-Volume-')
resp, cls.server = cls.servers_client.create_server(srv_name,
cls.image_ref,
cls.flavor_ref)
cls.servers_client.wait_for_server_status(cls.server['id'], 'ACTIVE')
- resp, cls.volume = cls.client.create_volume(size=1,
- display_name=vol_name)
- cls.client.wait_for_volume_status(cls.volume['id'], 'available')
+ # Create a test shared volume for attach/detach tests
+ cls.volume = cls.create_volume()
@classmethod
def tearDownClass(cls):
- # Delete the test instance and volume
- cls.client.delete_volume(cls.volume['id'])
- cls.client.wait_for_resource_deletion(cls.volume['id'])
-
+ # Delete the test instance
cls.servers_client.delete_server(cls.server['id'])
cls.client.wait_for_resource_deletion(cls.server['id'])
diff --git a/tempest/api/volume/test_volumes_get.py b/tempest/api/volume/test_volumes_get.py
index 6d1c25a..e342563 100644
--- a/tempest/api/volume/test_volumes_get.py
+++ b/tempest/api/volume/test_volumes_get.py
@@ -117,17 +117,10 @@
@attr(type='gate')
def test_volume_get_metadata_none(self):
# Create a volume without passing metadata, get details, and delete
- volume = {}
- v_name = data_utils.rand_name('Volume-')
+
# Create a volume without metadata
- resp, volume = self.client.create_volume(size=1,
- display_name=v_name,
- metadata={})
- self.assertEqual(200, resp.status)
- self.assertIn('id', volume)
- self.addCleanup(self._delete_volume, volume['id'])
- self.assertIn('display_name', volume)
- self.client.wait_for_volume_status(volume['id'], 'available')
+ volume = self.create_volume(metadata={})
+
# GET Volume
resp, fetched_volume = self.client.get_volume(volume['id'])
self.assertEqual(200, resp.status)
@@ -145,8 +138,7 @@
@attr(type='gate')
def test_volume_create_get_update_delete_as_clone(self):
- origin = self.create_volume(size=1,
- display_name="Volume Origin")
+ origin = self.create_volume()
self._volume_create_get_update_delete(source_volid=origin['id'])
diff --git a/tempest/api/volume/test_volumes_list.py b/tempest/api/volume/test_volumes_list.py
index c624a3a..49a2f74 100644
--- a/tempest/api/volume/test_volumes_list.py
+++ b/tempest/api/volume/test_volumes_list.py
@@ -66,17 +66,15 @@
cls.volume_id_list = []
cls.metadata = {'Type': 'work'}
for i in range(3):
- v_name = data_utils.rand_name('volume')
try:
- resp, volume = cls.client.create_volume(size=1,
- display_name=v_name,
- metadata=cls.metadata)
- cls.client.wait_for_volume_status(volume['id'], 'available')
+ volume = cls.create_volume(metadata=cls.metadata)
+
resp, volume = cls.client.get_volume(volume['id'])
cls.volume_list.append(volume)
cls.volume_id_list.append(volume['id'])
- except Exception as exc:
- LOG.exception(exc)
+ except Exception:
+ LOG.exception('Failed to create volume. %d volumes were '
+ 'created' % len(cls.volume_id_list))
if cls.volume_list:
# We could not create all the volumes, though we were able
# to create *some* of the volumes. This is typically
@@ -85,7 +83,7 @@
for volid in cls.volume_id_list:
cls.client.delete_volume(volid)
cls.client.wait_for_resource_deletion(volid)
- raise exc
+ raise
@classmethod
def tearDownClass(cls):
diff --git a/tempest/api/volume/test_volumes_negative.py b/tempest/api/volume/test_volumes_negative.py
index 869aedb..f14cfdc 100644
--- a/tempest/api/volume/test_volumes_negative.py
+++ b/tempest/api/volume/test_volumes_negative.py
@@ -32,10 +32,7 @@
cls.client = cls.volumes_client
# Create a test shared instance and volume for attach/detach tests
- vol_name = data_utils.rand_name('Volume-')
-
- cls.volume = cls.create_volume(size=1, display_name=vol_name)
- cls.client.wait_for_volume_status(cls.volume['id'], 'available')
+ cls.volume = cls.create_volume()
cls.mountpoint = "/dev/vdc"
@attr(type=['negative', 'gate'])
diff --git a/tempest/config.py b/tempest/config.py
index bf45b4b..d42edc9 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -473,6 +473,16 @@
]
+telemetry_group = cfg.OptGroup(name='telemetry',
+ title='Telemetry Service Options')
+
+TelemetryGroup = [
+ cfg.StrOpt('catalog_type',
+ default='metering',
+ help="Catalog type of the Telemetry service."),
+]
+
+
dashboard_group = cfg.OptGroup(name="dashboard",
title="Dashboard options")
@@ -700,6 +710,7 @@
register_opt_group(cfg.CONF, object_storage_feature_group,
ObjectStoreFeaturesGroup)
register_opt_group(cfg.CONF, orchestration_group, OrchestrationGroup)
+ register_opt_group(cfg.CONF, telemetry_group, TelemetryGroup)
register_opt_group(cfg.CONF, dashboard_group, DashboardGroup)
register_opt_group(cfg.CONF, data_processing_group,
DataProcessingGroup)
@@ -723,6 +734,7 @@
self.object_storage_feature_enabled = cfg.CONF[
'object-storage-feature-enabled']
self.orchestration = cfg.CONF.orchestration
+ self.telemetry = cfg.CONF.telemetry
self.dashboard = cfg.CONF.dashboard
self.data_processing = cfg.CONF.data_processing
self.boto = cfg.CONF.boto
diff --git a/tempest/openstack/common/config/generator.py b/tempest/openstack/common/config/generator.py
index 373f9a6..eeb5a32 100644
--- a/tempest/openstack/common/config/generator.py
+++ b/tempest/openstack/common/config/generator.py
@@ -1,5 +1,3 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
# Copyright 2012 SINA Corporation
# All Rights Reserved.
#
@@ -28,6 +26,7 @@
import textwrap
from oslo.config import cfg
+import six
from tempest.openstack.common import gettextutils
from tempest.openstack.common import importutils
@@ -78,12 +77,15 @@
# The options list is a list of (module, options) tuples
opts_by_group = {'DEFAULT': []}
- for module_name in os.getenv(
- "OSLO_CONFIG_GENERATOR_EXTRA_MODULES", "").split(','):
- module = _import_module(module_name)
- if module:
- for group, opts in _list_opts(module):
- opts_by_group.setdefault(group, []).append((module_name, opts))
+ extra_modules = os.getenv("TEMPEST_CONFIG_GENERATOR_EXTRA_MODULES", "")
+ if extra_modules:
+ for module_name in extra_modules.split(','):
+ module_name = module_name.strip()
+ module = _import_module(module_name)
+ if module:
+ for group, opts in _list_opts(module):
+ opts_by_group.setdefault(group, []).append((module_name,
+ opts))
for pkg_name in pkg_names:
mods = mods_by_pkg.get(pkg_name)
@@ -100,8 +102,8 @@
opts_by_group.setdefault(group, []).append((mod_str, opts))
print_group_opts('DEFAULT', opts_by_group.pop('DEFAULT', []))
- for group, opts in opts_by_group.items():
- print_group_opts(group, opts)
+ for group in sorted(opts_by_group.keys()):
+ print_group_opts(group, opts_by_group[group])
def _import_module(mod_str):
@@ -111,17 +113,17 @@
return sys.modules[mod_str[4:]]
else:
return importutils.import_module(mod_str)
- except ImportError as ie:
- sys.stderr.write("%s\n" % str(ie))
- return None
- except Exception:
+ except Exception as e:
+ sys.stderr.write("Error importing module %s: %s\n" % (mod_str, str(e)))
return None
def _is_in_group(opt, group):
"Check if opt is in group."
for key, value in group._opts.items():
- if value['opt'] == opt:
+ # NOTE(llu): Temporary workaround for bug #1262148, wait until
+ # newly released oslo.config support '==' operator.
+ if not(value['opt'] != opt):
return True
return False
@@ -233,7 +235,7 @@
if opt_default is None:
print('#%s=<None>' % opt_name)
elif opt_type == STROPT:
- assert(isinstance(opt_default, basestring))
+ assert(isinstance(opt_default, six.string_types))
print('#%s=%s' % (opt_name, _sanitize_default(opt_name,
opt_default)))
elif opt_type == BOOLOPT:
diff --git a/tempest/openstack/common/excutils.py b/tempest/openstack/common/excutils.py
index c7bce72..dc365da 100644
--- a/tempest/openstack/common/excutils.py
+++ b/tempest/openstack/common/excutils.py
@@ -1,5 +1,3 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
# Copyright 2011 OpenStack Foundation.
# Copyright 2012, Red Hat, Inc.
#
@@ -26,7 +24,7 @@
import six
-from tempest.openstack.common.gettextutils import _ # noqa
+from tempest.openstack.common.gettextutils import _
class save_and_reraise_exception(object):
@@ -44,13 +42,13 @@
In some cases the caller may not want to re-raise the exception, and
for those circumstances this context provides a reraise flag that
- can be used to suppress the exception. For example:
+ can be used to suppress the exception. For example::
- except Exception:
- with save_and_reraise_exception() as ctxt:
- decide_if_need_reraise()
- if not should_be_reraised:
- ctxt.reraise = False
+ except Exception:
+ with save_and_reraise_exception() as ctxt:
+ decide_if_need_reraise()
+ if not should_be_reraised:
+ ctxt.reraise = False
"""
def __init__(self):
self.reraise = True
diff --git a/tempest/openstack/common/fileutils.py b/tempest/openstack/common/fileutils.py
index 15530af..1845ed2 100644
--- a/tempest/openstack/common/fileutils.py
+++ b/tempest/openstack/common/fileutils.py
@@ -1,5 +1,3 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
# Copyright 2011 OpenStack Foundation.
# All Rights Reserved.
#
@@ -22,7 +20,7 @@
import tempfile
from tempest.openstack.common import excutils
-from tempest.openstack.common.gettextutils import _ # noqa
+from tempest.openstack.common.gettextutils import _
from tempest.openstack.common import log as logging
LOG = logging.getLogger(__name__)
diff --git a/tempest/openstack/common/fixture/config.py b/tempest/openstack/common/fixture/config.py
index 7b044ef..0bf90ff 100644
--- a/tempest/openstack/common/fixture/config.py
+++ b/tempest/openstack/common/fixture/config.py
@@ -1,4 +1,3 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 Mirantis, Inc.
# Copyright 2013 OpenStack Foundation
@@ -30,7 +29,7 @@
the specified configuration option group.
All overrides are automatically cleared at the end of the current
- test by the reset() method, which is registred by addCleanup().
+ test by the reset() method, which is registered by addCleanup().
"""
def __init__(self, conf=cfg.CONF):
diff --git a/tempest/openstack/common/fixture/lockutils.py b/tempest/openstack/common/fixture/lockutils.py
index 21b4a48..5936687 100644
--- a/tempest/openstack/common/fixture/lockutils.py
+++ b/tempest/openstack/common/fixture/lockutils.py
@@ -1,5 +1,3 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
# Copyright 2011 OpenStack Foundation.
# All Rights Reserved.
#
@@ -17,7 +15,7 @@
import fixtures
-from tempest.openstack.common.lockutils import lock
+from tempest.openstack.common import lockutils
class LockFixture(fixtures.Fixture):
@@ -45,7 +43,7 @@
test method exits. (either by completing or raising an exception)
"""
def __init__(self, name, lock_file_prefix=None):
- self.mgr = lock(name, lock_file_prefix, True)
+ self.mgr = lockutils.lock(name, lock_file_prefix, True)
def setUp(self):
super(LockFixture, self).setUp()
diff --git a/tempest/openstack/common/fixture/mockpatch.py b/tempest/openstack/common/fixture/mockpatch.py
index cd0d6ca..858e77c 100644
--- a/tempest/openstack/common/fixture/mockpatch.py
+++ b/tempest/openstack/common/fixture/mockpatch.py
@@ -1,5 +1,3 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2013 Hewlett-Packard Development Company, L.P.
diff --git a/tempest/openstack/common/fixture/moxstubout.py b/tempest/openstack/common/fixture/moxstubout.py
index a0e74fd..e8c031f 100644
--- a/tempest/openstack/common/fixture/moxstubout.py
+++ b/tempest/openstack/common/fixture/moxstubout.py
@@ -1,5 +1,3 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2013 Hewlett-Packard Development Company, L.P.
diff --git a/tempest/openstack/common/gettextutils.py b/tempest/openstack/common/gettextutils.py
index 2939ed9..825c2e0 100644
--- a/tempest/openstack/common/gettextutils.py
+++ b/tempest/openstack/common/gettextutils.py
@@ -1,5 +1,3 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
# Copyright 2012 Red Hat, Inc.
# Copyright 2013 IBM Corp.
# All Rights Reserved.
@@ -317,7 +315,7 @@
# NOTE(luisg): Babel <1.0 used a function called list(), which was
# renamed to locale_identifiers() in >=1.0, the requirements master list
# requires >=0.9.6, uncapped, so defensively work with both. We can remove
- # this check when the master list updates to >=1.0, and all projects udpate
+ # this check when the master list updates to >=1.0, and update all projects
list_identifiers = (getattr(localedata, 'list', None) or
getattr(localedata, 'locale_identifiers'))
locale_identifiers = list_identifiers()
diff --git a/tempest/openstack/common/importutils.py b/tempest/openstack/common/importutils.py
index 7a303f9..4fd9ae2 100644
--- a/tempest/openstack/common/importutils.py
+++ b/tempest/openstack/common/importutils.py
@@ -1,5 +1,3 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
# Copyright 2011 OpenStack Foundation.
# All Rights Reserved.
#
diff --git a/tempest/openstack/common/jsonutils.py b/tempest/openstack/common/jsonutils.py
index b589545..53c0ad4 100644
--- a/tempest/openstack/common/jsonutils.py
+++ b/tempest/openstack/common/jsonutils.py
@@ -1,5 +1,3 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
@@ -41,8 +39,12 @@
try:
import xmlrpclib
except ImportError:
- # NOTE(jd): xmlrpclib is not shipped with Python 3
- xmlrpclib = None
+ # NOTE(jaypipes): xmlrpclib was renamed to xmlrpc.client in Python3
+ # however the function and object call signatures
+ # remained the same. This whole try/except block should
+ # be removed and replaced with a call to six.moves once
+ # six 1.4.2 is released. See http://bit.ly/1bqrVzu
+ import xmlrpc.client as xmlrpclib
import six
@@ -124,14 +126,14 @@
level=level,
max_depth=max_depth)
if isinstance(value, dict):
- return dict((k, recursive(v)) for k, v in value.iteritems())
+ return dict((k, recursive(v)) for k, v in six.iteritems(value))
elif isinstance(value, (list, tuple)):
return [recursive(lv) for lv in value]
# It's not clear why xmlrpclib created their own DateTime type, but
# for our purposes, make it a datetime type which is explicitly
# handled
- if xmlrpclib and isinstance(value, xmlrpclib.DateTime):
+ if isinstance(value, xmlrpclib.DateTime):
value = datetime.datetime(*tuple(value.timetuple())[:6])
if convert_datetime and isinstance(value, datetime.datetime):
diff --git a/tempest/openstack/common/local.py b/tempest/openstack/common/local.py
index e82f17d..0819d5b 100644
--- a/tempest/openstack/common/local.py
+++ b/tempest/openstack/common/local.py
@@ -1,5 +1,3 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
# Copyright 2011 OpenStack Foundation.
# All Rights Reserved.
#
diff --git a/tempest/openstack/common/lockutils.py b/tempest/openstack/common/lockutils.py
index 65f3548..53cada1 100644
--- a/tempest/openstack/common/lockutils.py
+++ b/tempest/openstack/common/lockutils.py
@@ -1,5 +1,3 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
# Copyright 2011 OpenStack Foundation.
# All Rights Reserved.
#
@@ -31,7 +29,7 @@
from oslo.config import cfg
from tempest.openstack.common import fileutils
-from tempest.openstack.common.gettextutils import _ # noqa
+from tempest.openstack.common.gettextutils import _
from tempest.openstack.common import local
from tempest.openstack.common import log as logging
@@ -148,16 +146,16 @@
True, in which case, it'll yield an InterProcessLock instance.
:param lock_file_prefix: The lock_file_prefix argument is used to provide
- lock files on disk with a meaningful prefix.
+ lock files on disk with a meaningful prefix.
:param external: The external keyword argument denotes whether this lock
- should work across multiple processes. This means that if two different
- workers both run a a method decorated with @synchronized('mylock',
- external=True), only one of them will execute at a time.
+ should work across multiple processes. This means that if two different
+ workers both run a a method decorated with @synchronized('mylock',
+ external=True), only one of them will execute at a time.
:param lock_path: The lock_path keyword argument is used to specify a
- special location for external lock files to live. If nothing is set, then
- CONF.lock_path is used as a default.
+ special location for external lock files to live. If nothing is set, then
+ CONF.lock_path is used as a default.
"""
with _semaphores_lock:
try:
diff --git a/tempest/openstack/common/log.py b/tempest/openstack/common/log.py
index abb44ef..7bebfdb 100644
--- a/tempest/openstack/common/log.py
+++ b/tempest/openstack/common/log.py
@@ -1,5 +1,3 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
# Copyright 2011 OpenStack Foundation.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
@@ -35,6 +33,7 @@
import logging.config
import logging.handlers
import os
+import re
import sys
import traceback
@@ -42,7 +41,7 @@
import six
from six import moves
-from tempest.openstack.common.gettextutils import _ # noqa
+from tempest.openstack.common.gettextutils import _
from tempest.openstack.common import importutils
from tempest.openstack.common import jsonutils
from tempest.openstack.common import local
@@ -50,6 +49,24 @@
_DEFAULT_LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
+_SANITIZE_KEYS = ['adminPass', 'admin_pass', 'password', 'admin_password']
+
+# NOTE(ldbragst): Let's build a list of regex objects using the list of
+# _SANITIZE_KEYS we already have. This way, we only have to add the new key
+# to the list of _SANITIZE_KEYS and we can generate regular expressions
+# for XML and JSON automatically.
+_SANITIZE_PATTERNS = []
+_FORMAT_PATTERNS = [r'(%(key)s\s*[=]\s*[\"\']).*?([\"\'])',
+ r'(<%(key)s>).*?(</%(key)s>)',
+ r'([\"\']%(key)s[\"\']\s*:\s*[\"\']).*?([\"\'])',
+ r'([\'"].*?%(key)s[\'"]\s*:\s*u?[\'"]).*?([\'"])']
+
+for key in _SANITIZE_KEYS:
+ for pattern in _FORMAT_PATTERNS:
+ reg_ex = re.compile(pattern % {'key': key}, re.DOTALL)
+ _SANITIZE_PATTERNS.append(reg_ex)
+
+
common_cli_opts = [
cfg.BoolOpt('debug',
short='d',
@@ -64,11 +81,13 @@
]
logging_cli_opts = [
- cfg.StrOpt('log-config',
+ cfg.StrOpt('log-config-append',
metavar='PATH',
- help='If this option is specified, the logging configuration '
- 'file specified is used and overrides any other logging '
- 'options specified. Please see the Python logging module '
+ deprecated_name='log-config',
+ help='The name of logging configuration file. It does not '
+ 'disable existing loggers, but just appends specified '
+ 'logging configuration to any other existing logging '
+ 'options. Please see the Python logging module '
'documentation for details on logging configuration '
'files.'),
cfg.StrOpt('log-format',
@@ -111,7 +130,7 @@
log_opts = [
cfg.StrOpt('logging_context_format_string',
default='%(asctime)s.%(msecs)03d %(process)d %(levelname)s '
- '%(name)s [%(request_id)s %(user)s %(tenant)s] '
+ '%(name)s [%(request_id)s %(user_identity)s] '
'%(instance)s%(message)s',
help='format string to use for log messages with context'),
cfg.StrOpt('logging_default_format_string',
@@ -127,12 +146,13 @@
help='prefix each line of exception output with this format'),
cfg.ListOpt('default_log_levels',
default=[
+ 'amqp=WARN',
'amqplib=WARN',
- 'sqlalchemy=WARN',
'boto=WARN',
+ 'qpid=WARN',
+ 'sqlalchemy=WARN',
'suds=INFO',
- 'keystone=INFO',
- 'paramiko=INFO'
+ 'iso8601=WARN',
],
help='list of logger=LEVEL pairs'),
cfg.BoolOpt('publish_errors',
@@ -211,6 +231,40 @@
return None
+def mask_password(message, secret="***"):
+ """Replace password with 'secret' in message.
+
+ :param message: The string which includes security information.
+ :param secret: value with which to replace passwords.
+ :returns: The unicode value of message with the password fields masked.
+
+ For example:
+
+ >>> mask_password("'adminPass' : 'aaaaa'")
+ "'adminPass' : '***'"
+ >>> mask_password("'admin_pass' : 'aaaaa'")
+ "'admin_pass' : '***'"
+ >>> mask_password('"password" : "aaaaa"')
+ '"password" : "***"'
+ >>> mask_password("'original_password' : 'aaaaa'")
+ "'original_password' : '***'"
+ >>> mask_password("u'original_password' : u'aaaaa'")
+ "u'original_password' : u'***'"
+ """
+ message = six.text_type(message)
+
+ # NOTE(ldbragst): Check to see if anything in message contains any key
+ # specified in _SANITIZE_KEYS, if not then just return the message since
+ # we don't have to mask any passwords.
+ if not any(key in message for key in _SANITIZE_KEYS):
+ return message
+
+ secret = r'\g<1>' + secret + r'\g<2>'
+ for pattern in _SANITIZE_PATTERNS:
+ message = re.sub(pattern, secret, message)
+ return message
+
+
class BaseLoggerAdapter(logging.LoggerAdapter):
def audit(self, msg, *args, **kwargs):
@@ -278,10 +332,12 @@
elif instance_uuid:
instance_extra = (CONF.instance_uuid_format
% {'uuid': instance_uuid})
- extra.update({'instance': instance_extra})
+ extra['instance'] = instance_extra
- extra.update({"project": self.project})
- extra.update({"version": self.version})
+ extra.setdefault('user_identity', kwargs.pop('user_identity', None))
+
+ extra['project'] = self.project
+ extra['version'] = self.version
extra['extra'] = extra.copy()
return msg, kwargs
@@ -295,7 +351,7 @@
def formatException(self, ei, strip_newlines=True):
lines = traceback.format_exception(*ei)
if strip_newlines:
- lines = [itertools.ifilter(
+ lines = [moves.filter(
lambda x: x,
line.rstrip().splitlines()) for line in lines]
lines = list(itertools.chain(*lines))
@@ -333,10 +389,10 @@
def _create_logging_excepthook(product_name):
- def logging_excepthook(type, value, tb):
+ def logging_excepthook(exc_type, value, tb):
extra = {}
if CONF.verbose:
- extra['exc_info'] = (type, value, tb)
+ extra['exc_info'] = (exc_type, value, tb)
getLogger(product_name).critical(str(value), **extra)
return logging_excepthook
@@ -354,17 +410,18 @@
err_msg=self.err_msg)
-def _load_log_config(log_config):
+def _load_log_config(log_config_append):
try:
- logging.config.fileConfig(log_config)
+ logging.config.fileConfig(log_config_append,
+ disable_existing_loggers=False)
except moves.configparser.Error as exc:
- raise LogConfigError(log_config, str(exc))
+ raise LogConfigError(log_config_append, str(exc))
def setup(product_name):
"""Setup logging."""
- if CONF.log_config:
- _load_log_config(CONF.log_config)
+ if CONF.log_config_append:
+ _load_log_config(CONF.log_config_append)
else:
_setup_logging_from_conf()
sys.excepthook = _create_logging_excepthook(product_name)
@@ -420,7 +477,7 @@
streamlog = ColorHandler()
log_root.addHandler(streamlog)
- elif not CONF.log_file:
+ elif not logpath:
# pass sys.stdout as a positional argument
# python2.6 calls the argument strm, in 2.7 it's stream
streamlog = logging.StreamHandler(sys.stdout)
diff --git a/tempest/openstack/common/timeutils.py b/tempest/openstack/common/timeutils.py
index 98d877d..d5ed81d 100644
--- a/tempest/openstack/common/timeutils.py
+++ b/tempest/openstack/common/timeutils.py
@@ -1,5 +1,3 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
# Copyright 2011 OpenStack Foundation.
# All Rights Reserved.
#
@@ -50,9 +48,9 @@
try:
return iso8601.parse_date(timestr)
except iso8601.ParseError as e:
- raise ValueError(unicode(e))
+ raise ValueError(six.text_type(e))
except TypeError as e:
- raise ValueError(unicode(e))
+ raise ValueError(six.text_type(e))
def strtime(at=None, fmt=PERFECT_TIME_FORMAT):
@@ -79,6 +77,9 @@
"""Return True if before is older than seconds."""
if isinstance(before, six.string_types):
before = parse_strtime(before).replace(tzinfo=None)
+ else:
+ before = before.replace(tzinfo=None)
+
return utcnow() - before > datetime.timedelta(seconds=seconds)
@@ -86,6 +87,9 @@
"""Return True if after is newer than seconds."""
if isinstance(after, six.string_types):
after = parse_strtime(after).replace(tzinfo=None)
+ else:
+ after = after.replace(tzinfo=None)
+
return after - utcnow() > datetime.timedelta(seconds=seconds)
@@ -178,6 +182,15 @@
datetime objects (as a float, to microsecond resolution).
"""
delta = after - before
+ return total_seconds(delta)
+
+
+def total_seconds(delta):
+ """Return the total seconds of datetime.timedelta object.
+
+ Compute total seconds of datetime.timedelta, datetime.timedelta
+ doesn't have method total_seconds in Python2.6, calculate it manually.
+ """
try:
return delta.total_seconds()
except AttributeError:
@@ -188,8 +201,8 @@
def is_soon(dt, window):
"""Determines if time is going to happen in the next window seconds.
- :params dt: the time
- :params window: minimum seconds to remain to consider the time not soon
+ :param dt: the time
+ :param window: minimum seconds to remain to consider the time not soon
:return: True if expiration is within the given duration
"""
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index 33dd6c0..3618a14 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -227,10 +227,10 @@
for ip_address in ip_addresses:
self._check_vm_connectivity(ip_address, ssh_login,
key.private_key)
- except Exception as exc:
- LOG.exception(exc)
+ except Exception:
+ LOG.exception('Tenant connectivity check failed')
debug.log_ip_ns()
- raise exc
+ raise
def _wait_for_floating_ip_association(self):
ip_tracker = FloatingIPCheckTracker(self.compute_client,
@@ -263,10 +263,10 @@
ssh_login,
private_key,
should_connect=should_connect)
- except Exception as exc:
- LOG.exception(exc)
+ except Exception:
+ LOG.exception('Public network connectivity check failed')
debug.log_ip_ns()
- raise exc
+ raise
def _disassociate_floating_ips(self):
for floating_ip, server in self.floating_ips.iteritems():
diff --git a/tempest/services/object_storage/object_client.py b/tempest/services/object_storage/object_client.py
index 9e0adff..5c86d1f 100644
--- a/tempest/services/object_storage/object_client.py
+++ b/tempest/services/object_storage/object_client.py
@@ -134,14 +134,6 @@
resp, body = self.put(url, data, self.headers)
return resp, body
- def get_object_using_temp_url(self, url):
- """Retrieve object's data using temp URL."""
- return self.get(url)
-
- def put_object_using_temp_url(self, url, data):
- """Put data in an object using temp URL."""
- return self.put(url, data, None)
-
class ObjectClientCustomizedHeader(RestClient):
diff --git a/tempest/thirdparty/boto/test.py b/tempest/thirdparty/boto/test.py
index 2f7a650..2ce5cce 100644
--- a/tempest/thirdparty/boto/test.py
+++ b/tempest/thirdparty/boto/test.py
@@ -245,20 +245,20 @@
@classmethod
def tearDownClass(cls):
"""Calls the callables added by addResourceCleanUp,
- when you overwire this function dont't forget to call this too.
+ when you overwrite this function don't forget to call this too.
"""
fail_count = 0
trash_keys = sorted(cls._resource_trash_bin, reverse=True)
for key in trash_keys:
(function, pos_args, kw_args) = cls._resource_trash_bin[key]
try:
- LOG.debug("Cleaning up: %s" %
- friendly_function_call_str(function, *pos_args,
- **kw_args))
+ func_name = friendly_function_call_str(function, *pos_args,
+ **kw_args)
+ LOG.debug("Cleaning up: %s" % func_name)
function(*pos_args, **kw_args)
- except BaseException as exc:
+ except BaseException:
fail_count += 1
- LOG.exception(exc)
+ LOG.exception("Cleanup failed %s" % func_name)
finally:
del cls._resource_trash_bin[key]
super(BotoTestCase, cls).tearDownClass()
@@ -428,12 +428,12 @@
try:
bucket.delete_key(obj.key)
obj.close()
- except BaseException as exc:
- LOG.exception(exc)
+ except BaseException:
+ LOG.exception("Failed to delete key %s " % obj.key)
exc_num += 1
conn.delete_bucket(bucket)
- except BaseException as exc:
- LOG.exception(exc)
+ except BaseException:
+ LOG.exception("Failed to destroy bucket %s " % bucket)
exc_num += 1
if exc_num:
raise exceptions.TearDownException(num=exc_num)
@@ -463,8 +463,8 @@
try:
instance.terminate()
re_search_wait(_instance_state, "_GONE")
- except BaseException as exc:
- LOG.exception(exc)
+ except BaseException:
+ LOG.exception("Failed to terminate instance %s " % instance)
exc_num += 1
if exc_num:
raise exceptions.TearDownException(num=exc_num)
@@ -497,8 +497,8 @@
try:
if volume.status != "available":
volume.detach(force=True)
- except BaseException as exc:
- LOG.exception(exc)
+ except BaseException:
+ LOG.exception("Failed to detach volume %s" % volume)
# exc_num += 1 "nonlocal" not in python2
return volume.status
@@ -506,8 +506,8 @@
re_search_wait(_volume_state, "available") # not validates status
LOG.info(_volume_state())
volume.delete()
- except BaseException as exc:
- LOG.exception(exc)
+ except BaseException:
+ LOG.exception("Failed to delete volume %s" % volume)
exc_num += 1
if exc_num:
raise exceptions.TearDownException(num=exc_num)
diff --git a/tools/config/generate_sample.sh b/tools/config/generate_sample.sh
index b86e0c2..607fecb 100755
--- a/tools/config/generate_sample.sh
+++ b/tools/config/generate_sample.sh
@@ -91,3 +91,9 @@
MODULEPATH=${MODULEPATH:-$DEFAULT_MODULEPATH}
OUTPUTFILE=$OUTPUTDIR/$PACKAGENAME.conf.sample
python -m $MODULEPATH $FILES > $OUTPUTFILE
+
+# Hook to allow projects to append custom config file snippets
+CONCAT_FILES=$(ls $BASEDIR/tools/config/*.conf.sample 2>/dev/null)
+for CONCAT_FILE in $CONCAT_FILES; do
+ cat $CONCAT_FILE >> $OUTPUTFILE
+done
diff --git a/tools/install_venv_common.py b/tools/install_venv_common.py
index 1bab88a..46822e3 100644
--- a/tools/install_venv_common.py
+++ b/tools/install_venv_common.py
@@ -1,5 +1,3 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
# Copyright 2013 OpenStack Foundation
# Copyright 2013 IBM Corp.
#