Merge "test_verify_multiple_nics_order failing in gate"
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 78215db..949302f 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -33,28 +33,25 @@
# Deprecated group/name - [DEFAULT]/log_config
#log_config_append = <None>
-# Format string for %%(asctime)s in log records. Default: %(default)s
-# . (string value)
-#log_date_format = %Y-%m-%d %H:%M:%S
-
-# (Optional) The base directory used for relative --log-file paths.
-# (string value)
-# Deprecated group/name - [DEFAULT]/logdir
-#log_dir = <None>
-
-# (Optional) Name of log file to output to. If no default is set,
-# logging will go to stdout. (string value)
-# Deprecated group/name - [DEFAULT]/logfile
-#log_file = <None>
-
# DEPRECATED. A logging.Formatter log message format string which may
# use any of the available logging.LogRecord attributes. This option
# is deprecated. Please use logging_context_format_string and
# logging_default_format_string instead. (string value)
#log_format = <None>
-# Syslog facility to receive log lines. (string value)
-#syslog_log_facility = LOG_USER
+# Format string for %%(asctime)s in log records. Default: %(default)s
+# . (string value)
+#log_date_format = %Y-%m-%d %H:%M:%S
+
+# (Optional) Name of log file to output to. If no default is set,
+# logging will go to stdout. (string value)
+# Deprecated group/name - [DEFAULT]/logfile
+#log_file = <None>
+
+# (Optional) The base directory used for relative --log-file paths.
+# (string value)
+# Deprecated group/name - [DEFAULT]/logdir
+#log_dir = <None>
# Use syslog for logging. Existing syslog format is DEPRECATED during
# I, and will change in J to honor RFC5424. (boolean value)
@@ -66,6 +63,9 @@
# will be removed in J. (boolean value)
#use_syslog_rfc_format = false
+# Syslog facility to receive log lines. (string value)
+#syslog_log_facility = LOG_USER
+
#
# From tempest.config
#
@@ -77,9 +77,26 @@
# From tempest.config
#
+# 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_identity)s] %(instance)s%(message)s
+
+# Format string to use for log messages without context. (string
+# value)
+#logging_default_format_string = %(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s
+
+# Data to append to log format when level is DEBUG. (string value)
+#logging_debug_format_suffix = %(funcName)s %(pathname)s:%(lineno)d
+
+# Prefix each line of exception output with this format. (string
+# value)
+#logging_exception_prefix = %(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s
+
# List of logger=LEVEL pairs. (list value)
#default_log_levels = amqp=WARN,amqplib=WARN,boto=WARN,qpid=WARN,sqlalchemy=WARN,suds=INFO,oslo.messaging=INFO,iso8601=WARN,requests.packages.urllib3.connectionpool=WARN,urllib3.connectionpool=WARN,websocket=WARN,keystonemiddleware=WARN,routes.middleware=WARN,stevedore=WARN
+# Enables or disables publication of error events. (boolean value)
+#publish_errors = false
+
# Enables or disables fatal status of deprecations. (boolean value)
#fatal_deprecations = false
@@ -91,23 +108,6 @@
# (string value)
#instance_uuid_format = "[instance: %(uuid)s] "
-# 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_identity)s] %(instance)s%(message)s
-
-# Data to append to log format when level is DEBUG. (string value)
-#logging_debug_format_suffix = %(funcName)s %(pathname)s:%(lineno)d
-
-# Format string to use for log messages without context. (string
-# value)
-#logging_default_format_string = %(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s
-
-# Prefix each line of exception output with this format. (string
-# value)
-#logging_exception_prefix = %(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s
-
-# Enables or disables publication of error events. (boolean value)
-#publish_errors = false
-
[auth]
@@ -115,6 +115,10 @@
# From tempest.config
#
+# Path to the yaml file that contains the list of credentials to use
+# for running tests (string value)
+#test_accounts_file = etc/accounts.yaml
+
# Allows test cases to create/destroy tenants and users. This option
# requires that OpenStack Identity API admin credentials are known. If
# false, isolated test cases and parallel execution, can still be
@@ -131,9 +135,8 @@
# concurrent test processes. (boolean value)
#locking_credentials_provider = false
-# Path to the yaml file that contains the list of credentials to use
-# for running tests (string value)
-#test_accounts_file = etc/accounts.yaml
+# Roles to assign to all users created by tempest (list value)
+#tempest_roles =
[baremetal]
@@ -142,6 +145,19 @@
# From tempest.config
#
+# Catalog type of the baremetal provisioning service (string value)
+#catalog_type = baremetal
+
+# Whether the Ironic nova-compute driver is enabled (boolean value)
+#driver_enabled = false
+
+# Driver name which Ironic uses (string value)
+#driver = fake
+
+# The endpoint type to use for the baremetal provisioning service
+# (string value)
+#endpoint_type = publicURL
+
# Timeout for Ironic node to completely provision (integer value)
#active_timeout = 300
@@ -149,19 +165,6 @@
# value)
#association_timeout = 30
-# Catalog type of the baremetal provisioning service (string value)
-#catalog_type = baremetal
-
-# Driver name which Ironic uses (string value)
-#driver = fake
-
-# Whether the Ironic nova-compute driver is enabled (boolean value)
-#driver_enabled = false
-
-# The endpoint type to use for the baremetal provisioning service
-# (string value)
-#endpoint_type = publicURL
-
# Timeout for Ironic power transitions. (integer value)
#power_timeout = 60
@@ -175,47 +178,47 @@
# From tempest.config
#
-# AKI Kernel Image manifest (string value)
-#aki_manifest = cirros-0.3.0-x86_64-vmlinuz.manifest.xml
+# EC2 URL (string value)
+#ec2_url = http://localhost:8773/services/Cloud
-# AMI Machine Image manifest (string value)
-#ami_manifest = cirros-0.3.0-x86_64-blank.img.manifest.xml
-
-# ARI Ramdisk Image manifest (string value)
-#ari_manifest = cirros-0.3.0-x86_64-initrd.manifest.xml
-
-# AWS Access Key (string value)
-#aws_access = <None>
+# S3 URL (string value)
+#s3_url = http://localhost:8080
# AWS Secret Key (string value)
#aws_secret = <None>
+# AWS Access Key (string value)
+#aws_access = <None>
+
# AWS Zone for EC2 tests (string value)
#aws_zone = nova
-# Status Change Test Interval (integer value)
-#build_interval = 1
-
-# Status Change Timeout (integer value)
-#build_timeout = 60
-
-# EC2 URL (string value)
-#ec2_url = http://localhost:8773/services/Cloud
-
-# boto Http socket timeout (integer value)
-#http_socket_timeout = 3
-
-# Instance type (string value)
-#instance_type = m1.tiny
-
-# boto num_retries on error (integer value)
-#num_retries = 1
-
# S3 Materials Path (string value)
#s3_materials_path = /opt/stack/devstack/files/images/s3-materials/cirros-0.3.0
-# S3 URL (string value)
-#s3_url = http://localhost:8080
+# ARI Ramdisk Image manifest (string value)
+#ari_manifest = cirros-0.3.0-x86_64-initrd.manifest.xml
+
+# AMI Machine Image manifest (string value)
+#ami_manifest = cirros-0.3.0-x86_64-blank.img.manifest.xml
+
+# AKI Kernel Image manifest (string value)
+#aki_manifest = cirros-0.3.0-x86_64-vmlinuz.manifest.xml
+
+# 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
[cli]
@@ -224,12 +227,12 @@
# From tempest.config
#
-# directory where python client binaries are located (string value)
-#cli_dir = /usr/local/bin
-
# enable cli tests (boolean value)
#enabled = true
+# directory where python client binaries are located (string value)
+#cli_dir = /usr/local/bin
+
# Whether the tempest run location has access to the *-manage
# commands. In a pure blackbox environment it will not. (boolean
# value)
@@ -245,43 +248,6 @@
# From tempest.config
#
-# Time in seconds between build status checks. (integer value)
-#build_interval = 1
-
-# Timeout in seconds to wait for an instance to build. Other services
-# that do not define build_timeout will inherit this value, for
-# example the image service. (integer value)
-#build_timeout = 300
-
-# Catalog type of the Compute service. (string value)
-#catalog_type = compute
-
-# The endpoint type to use for the compute service. (string value)
-#endpoint_type = publicURL
-
-# Name of the fixed network that is visible to all test tenants.
-# (string value)
-#fixed_network_name = private
-
-# Valid primary flavor to use in tests. (string value)
-#flavor_ref = 1
-
-# Valid secondary flavor to be used in tests. (string value)
-#flavor_ref_alt = 2
-
-# Unallocated floating IP range, which will be used to test the
-# floating IP bulk feature for CRUD operation. This block must not
-# overlap an existing floating IP pool. (string value)
-#floating_ip_range = 10.0.0.0/29
-
-# Password used to authenticate to an instance using the alternate
-# image. (string value)
-#image_alt_ssh_password = password
-
-# User name used to authenticate to an instance using the alternate
-# image. (string value)
-#image_alt_ssh_user = root
-
# Valid primary image reference to be used in tests. This is a
# required option (string value)
#image_ref = <None>
@@ -291,44 +257,37 @@
# value of image_ref above (string value)
#image_ref_alt = <None>
-# Password used to authenticate to an instance. (string value)
-#image_ssh_password = password
+# Valid primary flavor to use in tests. (string value)
+#flavor_ref = 1
+
+# Valid secondary flavor to be used in tests. (string value)
+#flavor_ref_alt = 2
# User name used to authenticate to an instance. (string value)
#image_ssh_user = root
-# IP version used for SSH connections. (integer value)
-#ip_version_for_ssh = 4
+# Password used to authenticate to an instance. (string value)
+#image_ssh_password = password
-# Network used for SSH connections. Ignored if
-# use_floatingip_for_ssh=true or run_ssh=false. (string value)
-#network_for_ssh = public
+# User name used to authenticate to an instance using the alternate
+# image. (string value)
+#image_alt_ssh_user = root
-# Path to a private key file for SSH access to remote hosts (string
+# Password used to authenticate to an instance using the alternate
+# image. (string value)
+#image_alt_ssh_password = password
+
+# Time in seconds between build status checks. (integer value)
+#build_interval = 1
+
+# Timeout in seconds to wait for an instance to build. Other services
+# that do not define build_timeout will inherit this value. (integer
# value)
-#path_to_private_key = <None>
-
-# Timeout in seconds to wait for ping to succeed. (integer value)
-#ping_timeout = 120
-
-# Additional wait time for clean state, when there is no OS-EXT-STS
-# extension available (integer value)
-#ready_wait = 0
-
-# The compute 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 =
+#build_timeout = 300
# Should the tests ssh to instances? (boolean value)
#run_ssh = false
-# Time in seconds before a shelved instance is eligible for removing
-# from a host. -1 never offload, 0 offload when shelved. This time
-# should be the same as the time of nova.conf, and some tests will run
-# for as long as the time. (integer value)
-#shelved_offload_time = 0
-
# Auth method used for authenticate to the instance. Valid choices
# are: keypair, configured, adminpass. keypair: start the servers with
# an ssh keypair. configured: use the configured user and password.
@@ -336,49 +295,72 @@
# when it is an option. (string value)
#ssh_auth_method = keypair
-# Timeout in seconds to wait for output from ssh channel. (integer
-# value)
-#ssh_channel_timeout = 60
-
# How to connect to the instance? fixed: using the first ip belongs
# the fixed network floating: creating and using a floating ip (string
# value)
#ssh_connect_method = fixed
+# User name used to authenticate to an instance. (string value)
+#ssh_user = root
+
+# Timeout in seconds to wait for ping to succeed. (integer value)
+#ping_timeout = 120
+
# Timeout in seconds to wait for authentication to succeed. (integer
# value)
#ssh_timeout = 300
-# User name used to authenticate to an instance. (string value)
-#ssh_user = root
+# Additional wait time for clean state, when there is no OS-EXT-STS
+# extension available (integer value)
+#ready_wait = 0
+
+# Timeout in seconds to wait for output from ssh channel. (integer
+# value)
+#ssh_channel_timeout = 60
+
+# Name of the fixed network that is visible to all test tenants.
+# (string value)
+#fixed_network_name = private
+
+# Network used for SSH connections. Ignored if
+# use_floatingip_for_ssh=true or run_ssh=false. (string value)
+#network_for_ssh = public
+
+# IP version used for SSH connections. (integer value)
+#ip_version_for_ssh = 4
# Does SSH use Floating IPs? (boolean value)
#use_floatingip_for_ssh = true
+# Catalog type of the Compute service. (string value)
+#catalog_type = compute
+
+# The compute 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 endpoint type to use for the compute service. (string value)
+#endpoint_type = publicURL
+
+# Path to a private key file for SSH access to remote hosts (string
+# value)
+#path_to_private_key = <None>
+
# Expected device name when a volume is attached to an instance
# (string value)
#volume_device_name = vdb
+# Time in seconds before a shelved instance is eligible for removing
+# from a host. -1 never offload, 0 offload when shelved. This time
+# should be the same as the time of nova.conf, and some tests will run
+# for as long as the time. (integer value)
+#shelved_offload_time = 0
-[compute-admin]
-
-#
-# From tempest.config
-#
-
-# Domain name for authentication as admin (Keystone V3).The same
-# domain applies to user and project (string value)
-#domain_name = <None>
-
-# API key to use when authenticating as admin. (string value)
-#password = <None>
-
-# Administrative Tenant name to use for Nova API requests. (string
-# value)
-#tenant_name = <None>
-
-# Administrative Username to use for Nova API requests. (string value)
-#username = <None>
+# Unallocated floating IP range, which will be used to test the
+# floating IP bulk feature for CRUD operation. This block must not
+# overlap an existing floating IP pool. (string value)
+#floating_ip_range = 10.0.0.0/29
[compute-feature-enabled]
@@ -387,20 +369,15 @@
# From tempest.config
#
+# If false, skip disk config tests (boolean value)
+#disk_config = true
+
# A list of enabled compute extensions with a special entry all which
# indicates every extension is enabled. Each extension should be
# specified with alias name. Empty list indicates all extensions are
# disabled (list value)
#api_extensions = all
-# Does the test environment block migration support cinder iSCSI
-# volumes (boolean value)
-#block_migrate_cinder_iscsi = false
-
-# Does the test environment use block devices for live migration
-# (boolean value)
-#block_migration_for_live_migration = false
-
# Does the test environment support changing the admin password?
# (boolean value)
#change_password = false
@@ -409,23 +386,38 @@
# output? (boolean value)
#console_output = true
-# If false, skip disk config tests (boolean value)
-#disk_config = true
+# Does the test environment support resizing? (boolean value)
+#resize = false
-# Enables returning of the instance password by the relevant server
-# API calls such as create, rebuild or rescue. (boolean value)
-#enable_instance_password = true
+# Does the test environment support pausing? (boolean value)
+#pause = true
-# Does the test environment support dynamic network interface
-# attachment? (boolean value)
-#interface_attach = true
+# Does the test environment support shelving/unshelving? (boolean
+# value)
+#shelve = true
+
+# Does the test environment support suspend/resume? (boolean value)
+#suspend = true
# Does the test environment support live migration available? (boolean
# value)
#live_migration = true
-# Does the test environment support pausing? (boolean value)
-#pause = true
+# 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
+
+# Enable VNC console. This configuration value should be same as
+# [nova.vnc]->vnc_enabled in nova.conf (boolean value)
+#vnc_console = false
+
+# Enable Spice console. This configuration value should be same as
+# [nova.spice]->enabled in nova.conf (boolean value)
+#spice_console = false
# Enable RDP console. This configuration value should be same as
# [nova.rdp]->enabled in nova.conf (boolean value)
@@ -435,28 +427,18 @@
# value)
#rescue = true
-# Does the test environment support resizing? (boolean value)
-#resize = false
+# Enables returning of the instance password by the relevant server
+# API calls such as create, rebuild or rescue. (boolean value)
+#enable_instance_password = true
-# Does the test environment support shelving/unshelving? (boolean
-# value)
-#shelve = true
+# Does the test environment support dynamic network interface
+# attachment? (boolean value)
+#interface_attach = true
# Does the test environment support creating snapshot images of
# running instances? (boolean value)
#snapshot = true
-# Enable Spice console. This configuration value should be same as
-# [nova.spice]->enabled in nova.conf (boolean value)
-#spice_console = false
-
-# Does the test environment support suspend/resume? (boolean value)
-#suspend = true
-
-# Enable VNC console. This configuration value should be same as
-# [nova.vnc]->vnc_enabled in nova.conf (boolean value)
-#vnc_console = false
-
[dashboard]
@@ -485,6 +467,16 @@
#endpoint_type = publicURL
+[data_processing-feature-enabled]
+
+#
+# From tempest.config
+#
+
+# List of enabled data processing plugins (list value)
+#plugins = vanilla,hdp
+
+
[database]
#
@@ -494,12 +486,12 @@
# Catalog type of the Database service. (string value)
#catalog_type = database
-# Current database version to use in database tests. (string value)
-#db_current_version = v1.0
-
# Valid primary flavor to use in database tests. (string value)
#db_flavor_ref = 1
+# Current database version to use in database tests. (string value)
+#db_current_version = v1.0
+
[debug]
@@ -528,71 +520,15 @@
# From tempest.config
#
-# Admin domain name for authentication (Keystone V3).The same domain
-# applies to user and project (string value)
-#admin_domain_name = <None>
-
-# API key to use when authenticating as admin. (string value)
-#admin_password = <None>
-
-# Role required to administrate keystone. (string value)
-#admin_role = admin
-
-# Administrative Tenant name to use for Keystone API requests. (string
-# value)
-#admin_tenant_name = <None>
-
-# Administrative Username to use for Keystone API requests. (string
-# value)
-#admin_username = <None>
-
-# Alternate domain name for authentication (Keystone V3).The same
-# domain applies to user and project (string value)
-#alt_domain_name = <None>
-
-# API key to use when authenticating as alternate user. (string value)
-#alt_password = <None>
-
-# Alternate user's Tenant name to use for Nova API requests. (string
-# value)
-#alt_tenant_name = <None>
-
-# Username of alternate user to use for Nova API requests. (string
-# value)
-#alt_username = <None>
-
-# Identity API version to be used for authentication for API tests.
-# (string value)
-#auth_version = v2
-
-# Specify a CA bundle file to use in verifying a TLS (https) server
-# certificate. (string value)
-#ca_certificates_file = <None>
-
# 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
-# Domain name for authentication (Keystone V3).The same domain applies
-# to user and project (string value)
-#domain_name = <None>
-
-# The endpoint type to use for the identity service. (string value)
-#endpoint_type = publicURL
-
-# API key to use when authenticating. (string value)
-#password = <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
-
-# Tenant name to use for Nova API requests. (string value)
-#tenant_name = <None>
+# Specify a CA bundle file to use in verifying a TLS (https) server
+# certificate. (string value)
+#ca_certificates_file = <None>
# Full URI of the OpenStack Identity API (Keystone), v2 (string value)
#uri = <None>
@@ -600,9 +536,65 @@
# Full URI of the OpenStack Identity API (Keystone), v3 (string value)
#uri_v3 = <None>
+# Identity API version to be used for authentication for API tests.
+# (string value)
+#auth_version = v2
+
+# 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
+
+# The endpoint type to use for the identity service. (string value)
+#endpoint_type = publicURL
+
# Username to use for Nova API requests. (string value)
#username = <None>
+# Tenant name to use for Nova API requests. (string value)
+#tenant_name = <None>
+
+# Role required to administrate keystone. (string value)
+#admin_role = admin
+
+# API key to use when authenticating. (string value)
+#password = <None>
+
+# Domain name for authentication (Keystone V3).The same domain applies
+# to user and project (string value)
+#domain_name = <None>
+
+# 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>
+
+# Alternate domain name for authentication (Keystone V3).The same
+# domain applies to user and project (string value)
+#alt_domain_name = <None>
+
+# Administrative Username to use for Keystone API requests. (string
+# value)
+#admin_username = <None>
+
+# Administrative Tenant name to use for Keystone API requests. (string
+# value)
+#admin_tenant_name = <None>
+
+# API key to use when authenticating as admin. (string value)
+#admin_password = <None>
+
+# Admin domain name for authentication (Keystone V3).The same domain
+# applies to user and project (string value)
+#admin_domain_name = <None>
+
[identity-feature-enabled]
@@ -610,16 +602,16 @@
# From tempest.config
#
+# Does the identity service have delegation and impersonation enabled
+# (boolean value)
+#trust = true
+
# Is the v2 identity API enabled (boolean value)
#api_v2 = true
# Is the v3 identity API enabled (boolean value)
#api_v3 = true
-# Does the identity service have delegation and impersonation enabled
-# (boolean value)
-#trust = true
-
[image]
@@ -630,16 +622,24 @@
# 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 =
+
# The endpoint type to use for the image service. (string value)
#endpoint_type = publicURL
# http accessible image (string value)
#http_image = http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-uec.tar.gz
-# 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 =
+# Timeout in seconds to wait for an image to become available.
+# (integer value)
+#build_timeout = 300
+
+# Time in seconds between image operation status checks. (integer
+# value)
+#build_interval = 1
[image-feature-enabled]
@@ -648,12 +648,12 @@
# From tempest.config
#
-# Is the v1 image API enabled (boolean value)
-#api_v1 = true
-
# Is the v2 image API enabled (boolean value)
#api_v2 = true
+# Is the v1 image API enabled (boolean value)
+#api_v1 = true
+
[input-scenario]
@@ -661,12 +661,12 @@
# From tempest.config
#
-# Matching flavors become parameters for scenario tests (string value)
-#flavor_regex = ^m1.nano$
-
# Matching images become parameters for scenario tests (string value)
#image_regex = ^cirros-0.3.1-x86_64-uec$
+# Matching flavors become parameters for scenario tests (string value)
+#flavor_regex = ^m1.nano$
+
# SSH verification in tests is skippedfor matching images (string
# value)
#non_ssh_image_regex = ^.*[Ww]in.*$
@@ -684,31 +684,31 @@
# Catalog type of the Messaging service. (string value)
#catalog_type = messaging
-# The maximum grace period for a claim (integer value)
-#max_claim_grace = 43200
+# The maximum number of queue records per page when listing queues
+# (integer value)
+#max_queues_per_page = 20
-# The maximum ttl for a claim (integer value)
-#max_claim_ttl = 43200
-
-# The maximum size of a message body (integer value)
-#max_message_size = 262144
-
-# The maximum ttl for a message (integer value)
-#max_message_ttl = 1209600
-
-# The maximum number of messages per claim (integer value)
-#max_messages_per_claim = 20
+# The maximum metadata size for a queue (integer value)
+#max_queue_metadata = 65536
# The maximum number of queue message per page when listing (or)
# posting messages (integer value)
#max_messages_per_page = 20
-# The maximum metadata size for a queue (integer value)
-#max_queue_metadata = 65536
+# The maximum size of a message body (integer value)
+#max_message_size = 262144
-# The maximum number of queue records per page when listing queues
-# (integer value)
-#max_queues_per_page = 20
+# The maximum number of messages per claim (integer value)
+#max_messages_per_claim = 20
+
+# The maximum ttl for a message (integer value)
+#max_message_ttl = 1209600
+
+# The maximum ttl for a claim (integer value)
+#max_claim_ttl = 43200
+
+# The maximum grace period for a claim (integer value)
+#max_claim_grace = 43200
[negative]
@@ -727,39 +727,17 @@
# From tempest.config
#
-# Time in seconds between network operation status checks. (integer
-# value)
-#build_interval = 1
-
-# Timeout in seconds to wait for network operation to complete.
-# (integer value)
-#build_timeout = 300
-
# Catalog type of the Neutron service. (string value)
#catalog_type = network
-# List of dns servers which should be used for subnet creation (list
-# value)
-#dns_servers = 8.8.8.8,8.8.4.4
-
-# The endpoint type to use for the network service. (string value)
-#endpoint_type = publicURL
-
-# Id of the public network that provides external connectivity (string
-# value)
-#public_network_id =
-
-# Id of the public router that provides external connectivity. This
-# should only be used when Neutron's 'allow_overlapping_ips' is set to
-# 'False' in neutron.conf. usually not needed past 'Grizzly' release
-# (string value)
-#public_router_id =
-
# 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 endpoint type to use for the network service. (string value)
+#endpoint_type = publicURL
+
# The cidr block to allocate tenant ipv4 subnets from (string value)
#tenant_network_cidr = 10.100.0.0/16
@@ -776,6 +754,28 @@
# (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. This
+# should only be used when Neutron's 'allow_overlapping_ips' is set to
+# 'False' in neutron.conf. usually not needed past 'Grizzly' release
+# (string value)
+#public_router_id =
+
+# Timeout in seconds to wait for network operation to complete.
+# (integer value)
+#build_timeout = 300
+
+# Time in seconds between network operation status checks. (integer
+# value)
+#build_interval = 1
+
+# List of dns servers which should be used for subnet creation (list
+# value)
+#dns_servers = 8.8.8.8,8.8.4.4
+
[network-feature-enabled]
@@ -783,14 +783,14 @@
# From tempest.config
#
+# Allow the execution of IPv6 tests (boolean value)
+#ipv6 = true
+
# A list of enabled network extensions with a special entry all which
# indicates every extension is enabled. Empty list indicates all
# extensions are disabled (list value)
#api_extensions = all
-# Allow the execution of IPv6 tests (boolean value)
-#ipv6 = true
-
# Allow the execution of IPv6 subnet tests that use the extended IPv6
# attributes ipv6_ra_mode and ipv6_address_mode (boolean value)
#ipv6_subnet_attributes = false
@@ -805,30 +805,40 @@
# Catalog type of the Object-Storage service. (string value)
#catalog_type = object-store
-# Number of seconds to wait while looping to check the status of a
-# container to container synchronization (integer value)
-#container_sync_interval = 5
-
-# Number of seconds to time on waiting for a container to container
-# synchronization complete. (integer value)
-#container_sync_timeout = 120
-
-# The endpoint type to use for the object-store service. (string
-# value)
-#endpoint_type = publicURL
-
-# Role to add to users created for swift tests to enable creating
-# containers (string value)
-#operator_role = Member
-
# 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 =
+# The endpoint type to use for the object-store service. (string
+# value)
+#endpoint_type = publicURL
+
+# Number of seconds to time on waiting for a container to container
+# synchronization complete. (integer value)
+#container_sync_timeout = 600
+
+# Number of seconds to wait while looping to check the status 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
+
# User role that has reseller admin (string value)
#reseller_admin_role = ResellerAdmin
+# Name of sync realm. A sync realm is a set of clusters that have
+# agreed to allow container syncing with each other. Set the same
+# realm name as Swift's container-sync-realms.conf (string value)
+#realm_name = realm1
+
+# One name of cluster which is set in the realm whose name is set in
+# 'realm_name' item in this file. Set the same cluster name as Swift's
+# container-sync-realms.conf (string value)
+#cluster_name = name1
+
[object-storage-feature-enabled]
@@ -836,20 +846,20 @@
# From tempest.config
#
-# Execute (old style) container-sync tests (boolean value)
-#container_sync = true
-
-# Execute discoverability tests (boolean value)
-#discoverability = true
-
# A list of the enabled optional discoverable apis. A single entry,
# all, indicates that all of these features are expected to be enabled
# (list value)
#discoverable_apis = all
+# Execute (old style) container-sync tests (boolean value)
+#container_sync = true
+
# Execute object-versioning tests (boolean value)
#object_versioning = true
+# Execute discoverability tests (boolean value)
+#discoverability = true
+
[orchestration]
@@ -857,42 +867,42 @@
# From tempest.config
#
+# Catalog type of the Orchestration service. (string value)
+#catalog_type = orchestration
+
+# The orchestration 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 endpoint type to use for the orchestration service. (string
+# value)
+#endpoint_type = publicURL
+
# Time in seconds between build status checks. (integer value)
#build_interval = 1
# Timeout in seconds to wait for a stack to build. (integer value)
#build_timeout = 1200
-# Catalog type of the Orchestration service. (string value)
-#catalog_type = orchestration
-
-# The endpoint type to use for the orchestration service. (string
-# value)
-#endpoint_type = publicURL
+# Instance type for tests. Needs to be big enough for a full OS plus
+# the test workload (string value)
+#instance_type = m1.micro
# Name of heat-cfntools enabled image to use when launching test
# instances. (string value)
#image_ref = <None>
-# Instance type for tests. Needs to be big enough for a full OS plus
-# the test workload (string value)
-#instance_type = m1.micro
-
# Name of existing keypair to launch servers with. (string value)
#keypair_name = <None>
# Value must match heat configuration of the same name. (integer
# value)
-#max_resources_per_stack = 1000
+#max_template_size = 524288
# Value must match heat configuration of the same name. (integer
# value)
-#max_template_size = 524288
-
-# The orchestration 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 =
+#max_resources_per_stack = 1000
[scenario]
@@ -901,8 +911,18 @@
# From tempest.config
#
-# AKI image file name (string value)
-#aki_img_file = cirros-0.3.1-x86_64-vmlinuz
+# Directory containing image files (string value)
+#img_dir = /opt/stack/new/devstack/files/images/cirros-0.3.1-x86_64-uec
+
+# Image file name (string value)
+# Deprecated group/name - [DEFAULT]/qcow2_img_file
+#img_file = cirros-0.3.1-x86_64-disk.img
+
+# Image disk format (string value)
+#img_disk_format = qcow2
+
+# Image container format (string value)
+#img_container_format = bare
# AMI image file name (string value)
#ami_img_file = cirros-0.3.1-x86_64-blank.img
@@ -910,25 +930,20 @@
# ARI image file name (string value)
#ari_img_file = cirros-0.3.1-x86_64-initrd
-# Image container format (string value)
-#img_container_format = bare
+# AKI image file name (string value)
+#aki_img_file = cirros-0.3.1-x86_64-vmlinuz
-# Directory containing image files (string value)
-#img_dir = /opt/stack/new/devstack/files/images/cirros-0.3.1-x86_64-uec
-
-# Image disk format (string value)
-#img_disk_format = qcow2
-
-# Image file name (string value)
-# Deprecated group/name - [DEFAULT]/qcow2_img_file
-#img_file = cirros-0.3.1-x86_64-disk.img
+# 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
-# ssh username for the image file (string value)
-#ssh_user = cirros
+# DHCP client used by images to renew DCHP lease. If left empty,
+# update operation will be skipped. Supported clients: "udhcpc",
+# "dhclient" (string value)
+#dhcp_client = udhcpc
[service_available]
@@ -937,36 +952,36 @@
# From tempest.config
#
-# Whether or not Ceilometer is expected to be available (boolean
-# value)
-#ceilometer = true
-
# Whether or not cinder is expected to be available (boolean value)
#cinder = true
-# Whether or not glance is expected to be available (boolean value)
-#glance = true
-
-# Whether or not Heat is expected to be available (boolean value)
-#heat = false
-
-# Whether or not Horizon is expected to be available (boolean value)
-#horizon = true
-
-# Whether or not Ironic is expected to be available (boolean value)
-#ironic = false
-
# Whether or not neutron is expected to be available (boolean value)
#neutron = false
+# Whether or not glance is expected to be available (boolean value)
+#glance = true
+
+# Whether or not swift is expected to be available (boolean value)
+#swift = true
+
# Whether or not nova is expected to be available (boolean value)
#nova = true
+# Whether or not Heat is expected to be available (boolean value)
+#heat = false
+
+# Whether or not Ceilometer is expected to be available (boolean
+# value)
+#ceilometer = true
+
+# Whether or not Horizon is expected to be available (boolean value)
+#horizon = true
+
# Whether or not Sahara is expected to be available (boolean value)
#sahara = false
-# Whether or not swift is expected to be available (boolean value)
-#swift = true
+# Whether or not Ironic is expected to be available (boolean value)
+#ironic = false
# Whether or not Trove is expected to be available (boolean value)
#trove = false
@@ -981,40 +996,40 @@
# From 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
-# Allows a full cleaning process after a stress test. Caution : this
-# cleanup will remove every objects of every tenant. (boolean value)
-#full_clean_stack = false
-
# Prevent the cleaning (tearDownClass()) between each stress test run
# if an exception occurs during this run. (boolean value)
#leave_dirty_stack = false
-# time (in seconds) between log file error checks. (integer value)
-#log_check_interval = 60
-
-# Maximum number of instances to create during test. (integer value)
-#max_instances = 16
-
-# Directory containing log files on the compute nodes (string value)
-#nova_logdir = <None>
-
-# Controller host. (string value)
-#target_controller = <None>
-
-# regexp for list of log files. (string value)
-#target_logfiles = <None>
-
-# Path to private key. (string value)
-#target_private_key_path = <None>
-
-# ssh user. (string value)
-#target_ssh_user = <None>
+# Allows a full cleaning process after a stress test. Caution : this
+# cleanup will remove every objects of every tenant. (boolean value)
+#full_clean_stack = false
[telemetry]
@@ -1040,14 +1055,6 @@
# From tempest.config
#
-# 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
-
# Time in seconds between volume availability checks. (integer value)
#build_interval = 1
@@ -1058,23 +1065,31 @@
# Catalog type of the Volume Service (string value)
#catalog_type = volume
-# Disk format to use when copying a volume to image (string value)
-#disk_format = raw
-
-# The endpoint type to use for the volume service. (string value)
-#endpoint_type = publicURL
-
# 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 =
+# The endpoint type to use for the volume service. (string value)
+#endpoint_type = publicURL
+
+# 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
+
# Default size in GB for volumes created by volumes tests (integer
# value)
#volume_size = 1
@@ -1086,6 +1101,15 @@
# From tempest.config
#
+# Runs Cinder multi-backend test (requires 2 backends) (boolean value)
+#multi_backend = false
+
+# Runs Cinder volumes backup test (boolean value)
+#backup = true
+
+# Runs Cinder volume snapshot test (boolean value)
+#snapshot = true
+
# A list of enabled volume extensions with a special entry all which
# indicates every extension is enabled. Empty list indicates all
# extensions are disabled (list value)
@@ -1096,12 +1120,3 @@
# Is the v2 volume API enabled (boolean value)
#api_v2 = true
-
-# Runs Cinder volumes backup test (boolean value)
-#backup = true
-
-# Runs Cinder multi-backend test (requires 2 backends) (boolean value)
-#multi_backend = false
-
-# Runs Cinder volume snapshot test (boolean value)
-#snapshot = true
diff --git a/requirements.txt b/requirements.txt
index f9d8036..1ce2fc5 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -6,12 +6,12 @@
httplib2>=0.7.5
jsonschema>=2.0.0,<3.0.0
testtools>=0.9.36,!=1.2.0
-boto>=2.32.1
+boto>=2.32.1,<2.35.0
paramiko>=1.13.0
netaddr>=0.7.12
python-ceilometerclient>=1.0.6
-python-glanceclient>=0.14.0
-python-keystoneclient>=0.11.1
+python-glanceclient>=0.15.0
+python-keystoneclient>=1.0.0
python-novaclient>=2.18.0
python-neutronclient>=2.3.6,<3
python-cinderclient>=1.1.0
@@ -20,9 +20,9 @@
python-saharaclient>=0.7.6
python-swiftclient>=2.2.0
testrepository>=0.0.18
-oslo.config>=1.4.0 # Apache-2.0
+oslo.config>=1.6.0 # Apache-2.0
six>=1.7.0
iso8601>=0.1.9
fixtures>=0.3.14
testscenarios>=0.4
-tempest-lib
+tempest-lib>=0.1.0
diff --git a/tempest/api/baremetal/admin/test_ports.py b/tempest/api/baremetal/admin/test_ports.py
index 3392ab9..4aedaa4 100644
--- a/tempest/api/baremetal/admin/test_ports.py
+++ b/tempest/api/baremetal/admin/test_ports.py
@@ -87,6 +87,11 @@
self._assertExpected(self.port, port)
@test.attr(type='smoke')
+ def test_show_port_by_address(self):
+ _, port = self.client.show_port_by_address(self.port['address'])
+ self._assertExpected(self.port, port['ports'][0])
+
+ @test.attr(type='smoke')
def test_show_port_with_links(self):
_, port = self.client.show_port(self.port['uuid'])
self.assertIn('links', port.keys())
diff --git a/tempest/api/compute/admin/test_agents.py b/tempest/api/compute/admin/test_agents.py
index 3bdcfd6..425ce13 100644
--- a/tempest/api/compute/admin/test_agents.py
+++ b/tempest/api/compute/admin/test_agents.py
@@ -37,8 +37,7 @@
hypervisor='common', os='linux', architecture='x86_64',
version='7.0', url='xxx://xxxx/xxx/xxx',
md5hash='add6bb58e139be103324d04d82d8f545')
- resp, body = self.client.create_agent(**params)
- self.assertEqual(200, resp.status)
+ body = self.client.create_agent(**params)
self.agent_id = body['agent_id']
def tearDown(self):
@@ -67,8 +66,7 @@
hypervisor='kvm', os='win', architecture='x86',
version='7.0', url='xxx://xxxx/xxx/xxx',
md5hash='add6bb58e139be103324d04d82d8f545')
- resp, body = self.client.create_agent(**params)
- self.assertEqual(200, resp.status)
+ body = self.client.create_agent(**params)
self.addCleanup(self.client.delete_agent, body['agent_id'])
for expected_item, value in params.items():
self.assertEqual(value, body[expected_item])
@@ -79,27 +77,23 @@
params = self._param_helper(
version='8.0', url='xxx://xxxx/xxx/xxx2',
md5hash='add6bb58e139be103324d04d82d8f547')
- resp, body = self.client.update_agent(self.agent_id, **params)
- self.assertEqual(200, resp.status)
+ body = self.client.update_agent(self.agent_id, **params)
for expected_item, value in params.items():
self.assertEqual(value, body[expected_item])
@test.attr(type='gate')
def test_delete_agent(self):
# Delete an agent.
- resp, _ = self.client.delete_agent(self.agent_id)
- self.assertEqual(200, resp.status)
+ self.client.delete_agent(self.agent_id)
# Verify the list doesn't contain the deleted agent.
- resp, agents = self.client.list_agents()
- self.assertEqual(200, resp.status)
+ agents = self.client.list_agents()
self.assertNotIn(self.agent_id, map(lambda x: x['agent_id'], agents))
@test.attr(type='gate')
def test_list_agents(self):
# List all agents.
- resp, agents = self.client.list_agents()
- self.assertEqual(200, resp.status)
+ agents = self.client.list_agents()
self.assertTrue(len(agents) > 0, 'Cannot get any agents.(%s)' % agents)
self.assertIn(self.agent_id, map(lambda x: x['agent_id'], agents))
@@ -110,14 +104,12 @@
hypervisor='xen', os='linux', architecture='x86',
version='7.0', url='xxx://xxxx/xxx/xxx1',
md5hash='add6bb58e139be103324d04d82d8f546')
- resp, agent_xen = self.client.create_agent(**params)
- self.assertEqual(200, resp.status)
+ agent_xen = self.client.create_agent(**params)
self.addCleanup(self.client.delete_agent, agent_xen['agent_id'])
agent_id_xen = agent_xen['agent_id']
params_filter = {'hypervisor': agent_xen['hypervisor']}
- resp, agents = self.client.list_agents(params_filter)
- self.assertEqual(200, resp.status)
+ agents = self.client.list_agents(params_filter)
self.assertTrue(len(agents) > 0, 'Cannot get any agents.(%s)' % agents)
self.assertIn(agent_id_xen, map(lambda x: x['agent_id'], agents))
self.assertNotIn(self.agent_id, map(lambda x: x['agent_id'], agents))
diff --git a/tempest/api/compute/admin/test_aggregates.py b/tempest/api/compute/admin/test_aggregates.py
index 7c2e604..a866ede 100644
--- a/tempest/api/compute/admin/test_aggregates.py
+++ b/tempest/api/compute/admin/test_aggregates.py
@@ -35,7 +35,7 @@
cls.aggregate_name_prefix = 'test_aggregate_'
cls.az_name_prefix = 'test_az_'
- resp, hosts_all = cls.os_adm.hosts_client.list_hosts()
+ hosts_all = cls.os_adm.hosts_client.list_hosts()
hosts = map(lambda x: x['host_name'],
filter(lambda y: y['service'] == 'compute', hosts_all))
cls.host = hosts[0]
@@ -52,14 +52,12 @@
def test_aggregate_create_delete(self):
# Create and delete an aggregate.
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- resp, aggregate = self.client.create_aggregate(name=aggregate_name)
+ aggregate = self.client.create_aggregate(name=aggregate_name)
self.addCleanup(self._try_delete_aggregate, aggregate['id'])
- self.assertEqual(200, resp.status)
self.assertEqual(aggregate_name, aggregate['name'])
self.assertIsNone(aggregate['availability_zone'])
- resp, _ = self.client.delete_aggregate(aggregate['id'])
- self.assertEqual(200, resp.status)
+ self.client.delete_aggregate(aggregate['id'])
self.client.wait_for_resource_deletion(aggregate['id'])
@test.attr(type='gate')
@@ -67,26 +65,23 @@
# Create and delete an aggregate.
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
az_name = data_utils.rand_name(self.az_name_prefix)
- resp, aggregate = self.client.create_aggregate(
+ aggregate = self.client.create_aggregate(
name=aggregate_name, availability_zone=az_name)
self.addCleanup(self._try_delete_aggregate, aggregate['id'])
- self.assertEqual(200, resp.status)
self.assertEqual(aggregate_name, aggregate['name'])
self.assertEqual(az_name, aggregate['availability_zone'])
- resp, _ = self.client.delete_aggregate(aggregate['id'])
- self.assertEqual(200, resp.status)
+ self.client.delete_aggregate(aggregate['id'])
self.client.wait_for_resource_deletion(aggregate['id'])
@test.attr(type='gate')
def test_aggregate_create_verify_entry_in_list(self):
# Create an aggregate and ensure it is listed.
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- resp, aggregate = self.client.create_aggregate(name=aggregate_name)
+ aggregate = self.client.create_aggregate(name=aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
- resp, aggregates = self.client.list_aggregates()
- self.assertEqual(200, resp.status)
+ aggregates = self.client.list_aggregates()
self.assertIn((aggregate['id'], aggregate['availability_zone']),
map(lambda x: (x['id'], x['availability_zone']),
aggregates))
@@ -95,11 +90,10 @@
def test_aggregate_create_update_metadata_get_details(self):
# Create an aggregate and ensure its details are returned.
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- resp, aggregate = self.client.create_aggregate(name=aggregate_name)
+ aggregate = self.client.create_aggregate(name=aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
- resp, body = self.client.get_aggregate(aggregate['id'])
- self.assertEqual(200, resp.status)
+ body = self.client.get_aggregate(aggregate['id'])
self.assertEqual(aggregate['name'], body['name'])
self.assertEqual(aggregate['availability_zone'],
body['availability_zone'])
@@ -107,13 +101,11 @@
# set the metadata of the aggregate
meta = {"key": "value"}
- resp, body = self.client.set_metadata(aggregate['id'], meta)
- self.assertEqual(200, resp.status)
+ body = self.client.set_metadata(aggregate['id'], meta)
self.assertEqual(meta, body["metadata"])
# verify the metadata has been set
- resp, body = self.client.get_aggregate(aggregate['id'])
- self.assertEqual(200, resp.status)
+ body = self.client.get_aggregate(aggregate['id'])
self.assertEqual(meta, body["metadata"])
@test.attr(type='gate')
@@ -121,11 +113,10 @@
# Update an aggregate and ensure properties are updated correctly
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
az_name = data_utils.rand_name(self.az_name_prefix)
- resp, aggregate = self.client.create_aggregate(
+ aggregate = self.client.create_aggregate(
name=aggregate_name, availability_zone=az_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
- self.assertEqual(200, resp.status)
self.assertEqual(aggregate_name, aggregate['name'])
self.assertEqual(az_name, aggregate['availability_zone'])
self.assertIsNotNone(aggregate['id'])
@@ -134,15 +125,13 @@
new_aggregate_name = aggregate_name + '_new'
new_az_name = az_name + '_new'
- resp, resp_aggregate = self.client.update_aggregate(aggregate_id,
- new_aggregate_name,
- new_az_name)
- self.assertEqual(200, resp.status)
+ resp_aggregate = self.client.update_aggregate(aggregate_id,
+ new_aggregate_name,
+ new_az_name)
self.assertEqual(new_aggregate_name, resp_aggregate['name'])
self.assertEqual(new_az_name, resp_aggregate['availability_zone'])
- resp, aggregates = self.client.list_aggregates()
- self.assertEqual(200, resp.status)
+ aggregates = self.client.list_aggregates()
self.assertIn((aggregate_id, new_aggregate_name, new_az_name),
map(lambda x:
(x['id'], x['name'], x['availability_zone']),
@@ -153,18 +142,16 @@
# Add an host to the given aggregate and remove.
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- resp, aggregate = self.client.create_aggregate(name=aggregate_name)
+ aggregate = self.client.create_aggregate(name=aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
- resp, body = self.client.add_host(aggregate['id'], self.host)
- self.assertEqual(200, resp.status)
+ body = self.client.add_host(aggregate['id'], self.host)
self.assertEqual(aggregate_name, body['name'])
self.assertEqual(aggregate['availability_zone'],
body['availability_zone'])
self.assertIn(self.host, body['hosts'])
- resp, body = self.client.remove_host(aggregate['id'], self.host)
- self.assertEqual(200, resp.status)
+ body = self.client.remove_host(aggregate['id'], self.host)
self.assertEqual(aggregate_name, body['name'])
self.assertEqual(aggregate['availability_zone'],
body['availability_zone'])
@@ -175,12 +162,12 @@
# Add an host to the given aggregate and list.
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- resp, aggregate = self.client.create_aggregate(name=aggregate_name)
+ aggregate = self.client.create_aggregate(name=aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
self.client.add_host(aggregate['id'], self.host)
self.addCleanup(self.client.remove_host, aggregate['id'], self.host)
- resp, aggregates = self.client.list_aggregates()
+ aggregates = self.client.list_aggregates()
aggs = filter(lambda x: x['id'] == aggregate['id'], aggregates)
self.assertEqual(1, len(aggs))
agg = aggs[0]
@@ -193,12 +180,12 @@
# Add an host to the given aggregate and get details.
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- resp, aggregate = self.client.create_aggregate(name=aggregate_name)
+ aggregate = self.client.create_aggregate(name=aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
self.client.add_host(aggregate['id'], self.host)
self.addCleanup(self.client.remove_host, aggregate['id'], self.host)
- resp, body = self.client.get_aggregate(aggregate['id'])
+ body = self.client.get_aggregate(aggregate['id'])
self.assertEqual(aggregate_name, body['name'])
self.assertIsNone(body['availability_zone'])
self.assertIn(self.host, body['hosts'])
@@ -209,7 +196,7 @@
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
az_name = data_utils.rand_name(self.az_name_prefix)
- resp, aggregate = self.client.create_aggregate(
+ aggregate = self.client.create_aggregate(
name=aggregate_name, availability_zone=az_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
self.client.add_host(aggregate['id'], self.host)
diff --git a/tempest/api/compute/admin/test_aggregates_negative.py b/tempest/api/compute/admin/test_aggregates_negative.py
index 219d12e..a450e5d 100644
--- a/tempest/api/compute/admin/test_aggregates_negative.py
+++ b/tempest/api/compute/admin/test_aggregates_negative.py
@@ -34,7 +34,7 @@
cls.aggregate_name_prefix = 'test_aggregate_'
cls.az_name_prefix = 'test_az_'
- resp, hosts_all = cls.os_adm.hosts_client.list_hosts()
+ hosts_all = cls.os_adm.hosts_client.list_hosts()
hosts = map(lambda x: x['host_name'],
filter(lambda y: y['service'] == 'compute', hosts_all))
cls.host = hosts[0]
@@ -66,8 +66,7 @@
def test_aggregate_create_with_existent_aggregate_name(self):
# creating an aggregate with existent aggregate name is forbidden
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- resp, aggregate = self.client.create_aggregate(name=aggregate_name)
- self.assertEqual(200, resp.status)
+ aggregate = self.client.create_aggregate(name=aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
self.assertRaises(exceptions.Conflict,
@@ -78,8 +77,7 @@
def test_aggregate_delete_as_user(self):
# Regular user is not allowed to delete an aggregate.
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- resp, aggregate = self.client.create_aggregate(name=aggregate_name)
- self.assertEqual(200, resp.status)
+ aggregate = self.client.create_aggregate(name=aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
self.assertRaises(exceptions.Unauthorized,
@@ -96,8 +94,7 @@
def test_aggregate_get_details_as_user(self):
# Regular user is not allowed to get aggregate details.
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- resp, aggregate = self.client.create_aggregate(name=aggregate_name)
- self.assertEqual(200, resp.status)
+ aggregate = self.client.create_aggregate(name=aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
self.assertRaises(exceptions.Unauthorized,
@@ -119,7 +116,7 @@
@test.attr(type=['negative', 'gate'])
def test_aggregate_add_non_exist_host(self):
# Adding a non-exist host to an aggregate should raise exceptions.
- resp, hosts_all = self.os_adm.hosts_client.list_hosts()
+ hosts_all = self.os_adm.hosts_client.list_hosts()
hosts = map(lambda x: x['host_name'], hosts_all)
while True:
non_exist_host = data_utils.rand_name('nonexist_host_')
@@ -127,7 +124,7 @@
break
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- resp, aggregate = self.client.create_aggregate(name=aggregate_name)
+ aggregate = self.client.create_aggregate(name=aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
self.assertRaises(exceptions.NotFound, self.client.add_host,
@@ -137,8 +134,7 @@
def test_aggregate_add_host_as_user(self):
# Regular user is not allowed to add a host to an aggregate.
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- resp, aggregate = self.client.create_aggregate(name=aggregate_name)
- self.assertEqual(200, resp.status)
+ aggregate = self.client.create_aggregate(name=aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
self.assertRaises(exceptions.Unauthorized,
@@ -149,12 +145,10 @@
def test_aggregate_add_existent_host(self):
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- resp, aggregate = self.client.create_aggregate(name=aggregate_name)
- self.assertEqual(200, resp.status)
+ aggregate = self.client.create_aggregate(name=aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
- resp, body = self.client.add_host(aggregate['id'], self.host)
- self.assertEqual(200, resp.status)
+ self.client.add_host(aggregate['id'], self.host)
self.addCleanup(self.client.remove_host, aggregate['id'], self.host)
self.assertRaises(exceptions.Conflict, self.client.add_host,
@@ -165,11 +159,9 @@
# Regular user is not allowed to remove a host from an aggregate.
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- resp, aggregate = self.client.create_aggregate(name=aggregate_name)
- self.assertEqual(200, resp.status)
+ aggregate = self.client.create_aggregate(name=aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
- resp, body = self.client.add_host(aggregate['id'], self.host)
- self.assertEqual(200, resp.status)
+ self.client.add_host(aggregate['id'], self.host)
self.addCleanup(self.client.remove_host, aggregate['id'], self.host)
self.assertRaises(exceptions.Unauthorized,
@@ -180,8 +172,7 @@
def test_aggregate_remove_nonexistent_host(self):
non_exist_host = data_utils.rand_name('nonexist_host_')
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- resp, aggregate = self.client.create_aggregate(name=aggregate_name)
- self.assertEqual(200, resp.status)
+ aggregate = self.client.create_aggregate(name=aggregate_name)
self.addCleanup(self.client.delete_aggregate, aggregate['id'])
self.assertRaises(exceptions.NotFound, self.client.remove_host,
diff --git a/tempest/api/compute/admin/test_hosts.py b/tempest/api/compute/admin/test_hosts.py
index 25965fd..b9d47bb 100644
--- a/tempest/api/compute/admin/test_hosts.py
+++ b/tempest/api/compute/admin/test_hosts.py
@@ -30,19 +30,17 @@
@test.attr(type='gate')
def test_list_hosts(self):
- resp, hosts = self.client.list_hosts()
- self.assertEqual(200, resp.status)
+ hosts = self.client.list_hosts()
self.assertTrue(len(hosts) >= 2, str(hosts))
@test.attr(type='gate')
def test_list_hosts_with_zone(self):
self.useFixture(fixtures.LockFixture('availability_zone'))
- resp, hosts = self.client.list_hosts()
+ hosts = self.client.list_hosts()
host = hosts[0]
zone_name = host['zone']
params = {'zone': zone_name}
- resp, hosts = self.client.list_hosts(params)
- self.assertEqual(200, resp.status)
+ hosts = self.client.list_hosts(params)
self.assertTrue(len(hosts) >= 1)
self.assertIn(host, hosts)
@@ -51,31 +49,27 @@
# If send the request with a blank zone, the request will be successful
# and it will return all the hosts list
params = {'zone': ''}
- resp, hosts = self.client.list_hosts(params)
+ hosts = self.client.list_hosts(params)
self.assertNotEqual(0, len(hosts))
- self.assertEqual(200, resp.status)
@test.attr(type='gate')
def test_list_hosts_with_nonexistent_zone(self):
# If send the request with a nonexistent zone, the request will be
# successful and no hosts will be retured
params = {'zone': 'xxx'}
- resp, hosts = self.client.list_hosts(params)
+ hosts = self.client.list_hosts(params)
self.assertEqual(0, len(hosts))
- self.assertEqual(200, resp.status)
@test.attr(type='gate')
def test_show_host_detail(self):
- resp, hosts = self.client.list_hosts()
- self.assertEqual(200, resp.status)
+ hosts = self.client.list_hosts()
hosts = [host for host in hosts if host['service'] == 'compute']
self.assertTrue(len(hosts) >= 1)
for host in hosts:
hostname = host['host_name']
- resp, resources = self.client.show_host_detail(hostname)
- self.assertEqual(200, resp.status)
+ resources = self.client.show_host_detail(hostname)
self.assertTrue(len(resources) >= 1)
host_resource = resources[0]['resource']
self.assertIsNotNone(host_resource)
diff --git a/tempest/api/compute/admin/test_hosts_negative.py b/tempest/api/compute/admin/test_hosts_negative.py
index 055219f..fc918a3 100644
--- a/tempest/api/compute/admin/test_hosts_negative.py
+++ b/tempest/api/compute/admin/test_hosts_negative.py
@@ -31,8 +31,7 @@
cls.non_admin_client = cls.os.hosts_client
def _get_host_name(self):
- resp, hosts = self.client.list_hosts()
- self.assertEqual(200, resp.status)
+ hosts = self.client.list_hosts()
self.assertTrue(len(hosts) >= 1)
hostname = hosts[0]['host_name']
return hostname
diff --git a/tempest/api/compute/admin/test_hypervisor.py b/tempest/api/compute/admin/test_hypervisor.py
index de3debb..fbfef87 100644
--- a/tempest/api/compute/admin/test_hypervisor.py
+++ b/tempest/api/compute/admin/test_hypervisor.py
@@ -30,8 +30,7 @@
def _list_hypervisors(self):
# List of hypervisors
- resp, hypers = self.client.get_hypervisor_list()
- self.assertEqual(200, resp.status)
+ hypers = self.client.get_hypervisor_list()
return hypers
def assertHypervisors(self, hypers):
@@ -46,8 +45,7 @@
@test.attr(type='gate')
def test_get_hypervisor_list_details(self):
# Display the details of the all hypervisor
- resp, hypers = self.client.get_hypervisor_list_details()
- self.assertEqual(200, resp.status)
+ hypers = self.client.get_hypervisor_list_details()
self.assertHypervisors(hypers)
@test.attr(type='gate')
@@ -56,9 +54,7 @@
hypers = self._list_hypervisors()
self.assertHypervisors(hypers)
- resp, details = (self.client.
- get_hypervisor_show_details(hypers[0]['id']))
- self.assertEqual(200, resp.status)
+ details = self.client.get_hypervisor_show_details(hypers[0]['id'])
self.assertTrue(len(details) > 0)
self.assertEqual(details['hypervisor_hostname'],
hypers[0]['hypervisor_hostname'])
@@ -70,15 +66,13 @@
self.assertHypervisors(hypers)
hostname = hypers[0]['hypervisor_hostname']
- resp, hypervisors = self.client.get_hypervisor_servers(hostname)
- self.assertEqual(200, resp.status)
+ hypervisors = self.client.get_hypervisor_servers(hostname)
self.assertTrue(len(hypervisors) > 0)
@test.attr(type='gate')
def test_get_hypervisor_stats(self):
# Verify the stats of the all hypervisor
- resp, stats = self.client.get_hypervisor_stats()
- self.assertEqual(200, resp.status)
+ stats = self.client.get_hypervisor_stats()
self.assertTrue(len(stats) > 0)
@test.attr(type='gate')
@@ -94,9 +88,7 @@
ironic_only = True
hypers_without_ironic = []
for hyper in hypers:
- resp, details = (self.client.
- get_hypervisor_show_details(hypers[0]['id']))
- self.assertEqual(200, resp.status)
+ details = self.client.get_hypervisor_show_details(hypers[0]['id'])
if details['hypervisor_type'] != 'ironic':
hypers_without_ironic.append(hyper)
ironic_only = False
@@ -110,8 +102,8 @@
# because hypervisors might be disabled, this loops looking
# for any good hit.
try:
- resp, uptime = self.client.get_hypervisor_uptime(hyper['id'])
- if (resp.status == 200) and (len(uptime) > 0):
+ uptime = self.client.get_hypervisor_uptime(hyper['id'])
+ if len(uptime) > 0:
has_valid_uptime = True
break
except Exception:
@@ -124,7 +116,6 @@
def test_search_hypervisor(self):
hypers = self._list_hypervisors()
self.assertHypervisors(hypers)
- resp, hypers = self.client.search_hypervisor(
+ hypers = self.client.search_hypervisor(
hypers[0]['hypervisor_hostname'])
- self.assertEqual(200, resp.status)
self.assertHypervisors(hypers)
diff --git a/tempest/api/compute/admin/test_hypervisor_negative.py b/tempest/api/compute/admin/test_hypervisor_negative.py
index b1f2351..a137a61 100644
--- a/tempest/api/compute/admin/test_hypervisor_negative.py
+++ b/tempest/api/compute/admin/test_hypervisor_negative.py
@@ -35,8 +35,7 @@
def _list_hypervisors(self):
# List of hypervisors
- resp, hypers = self.client.get_hypervisor_list()
- self.assertEqual(200, resp.status)
+ hypers = self.client.get_hypervisor_list()
return hypers
@test.attr(type=['negative', 'gate'])
diff --git a/tempest/api/compute/admin/test_quotas.py b/tempest/api/compute/admin/test_quotas.py
index 7c666a2..fc70fdb 100644
--- a/tempest/api/compute/admin/test_quotas.py
+++ b/tempest/api/compute/admin/test_quotas.py
@@ -99,8 +99,8 @@
tenant_name = data_utils.rand_name('cpu_quota_tenant_')
tenant_desc = tenant_name + '-desc'
identity_client = self.os_adm.identity_client
- _, tenant = identity_client.create_tenant(name=tenant_name,
- description=tenant_desc)
+ tenant = identity_client.create_tenant(name=tenant_name,
+ description=tenant_desc)
tenant_id = tenant['id']
self.addCleanup(identity_client.delete_tenant, tenant_id)
@@ -113,10 +113,10 @@
user_name = data_utils.rand_name('cpu_quota_user_')
password = data_utils.rand_name('password-')
email = user_name + '@testmail.tm'
- _, user = identity_client.create_user(name=user_name,
- password=password,
- tenant_id=tenant_id,
- email=email)
+ user = identity_client.create_user(name=user_name,
+ password=password,
+ tenant_id=tenant_id,
+ email=email)
user_id = user['id']
self.addCleanup(identity_client.delete_user, user_id)
@@ -134,8 +134,8 @@
tenant_name = data_utils.rand_name('ram_quota_tenant_')
tenant_desc = tenant_name + '-desc'
identity_client = self.os_adm.identity_client
- _, tenant = identity_client.create_tenant(name=tenant_name,
- description=tenant_desc)
+ tenant = identity_client.create_tenant(name=tenant_name,
+ description=tenant_desc)
tenant_id = tenant['id']
self.addCleanup(identity_client.delete_tenant, tenant_id)
resp, quota_set_default = self.adm_client.get_quota_set(tenant_id)
diff --git a/tempest/api/compute/admin/test_servers.py b/tempest/api/compute/admin/test_servers.py
index e3477f1..5210077 100644
--- a/tempest/api/compute/admin/test_servers.py
+++ b/tempest/api/compute/admin/test_servers.py
@@ -79,6 +79,24 @@
self.assertIn(self.s2_name, servers_name)
@test.attr(type='gate')
+ def test_list_servers_by_admin_with_specified_tenant(self):
+ # In nova v2, tenant_id is ignored unless all_tenants is specified
+
+ # List the primary tenant but get nothing due to odd specified behavior
+ tenant_id = self.non_admin_client.tenant_id
+ params = {'tenant_id': tenant_id}
+ resp, body = self.client.list_servers_with_detail(params)
+ servers = body['servers']
+ self.assertEqual([], servers)
+
+ # List the admin tenant which has no servers
+ admin_tenant_id = self.client.tenant_id
+ params = {'all_tenants': '', 'tenant_id': admin_tenant_id}
+ resp, body = self.client.list_servers_with_detail(params)
+ servers = body['servers']
+ self.assertEqual([], servers)
+
+ @test.attr(type='gate')
def test_list_servers_filter_by_exist_host(self):
# Filter the list of servers by existent host
name = data_utils.rand_name('server')
diff --git a/tempest/api/compute/admin/test_services.py b/tempest/api/compute/admin/test_services.py
index e7a39f8..5cf4a31 100644
--- a/tempest/api/compute/admin/test_services.py
+++ b/tempest/api/compute/admin/test_services.py
@@ -31,29 +31,27 @@
@test.attr(type='gate')
def test_list_services(self):
- resp, services = self.client.list_services()
- self.assertEqual(200, resp.status)
+ services = self.client.list_services()
self.assertNotEqual(0, len(services))
@test.attr(type='gate')
def test_get_service_by_service_binary_name(self):
binary_name = 'nova-compute'
params = {'binary': binary_name}
- resp, services = self.client.list_services(params)
- self.assertEqual(200, resp.status)
+ services = self.client.list_services(params)
self.assertNotEqual(0, len(services))
for service in services:
self.assertEqual(binary_name, service['binary'])
@test.attr(type='gate')
def test_get_service_by_host_name(self):
- resp, services = self.client.list_services()
+ services = self.client.list_services()
host_name = services[0]['host']
services_on_host = [service for service in services if
service['host'] == host_name]
params = {'host': host_name}
- resp, services = self.client.list_services(params)
+ services = self.client.list_services(params)
# we could have a periodic job checkin between the 2 service
# lookups, so only compare binary lists.
@@ -66,13 +64,12 @@
@test.attr(type='gate')
def test_get_service_by_service_and_host_name(self):
- resp, services = self.client.list_services()
+ services = self.client.list_services()
host_name = services[0]['host']
binary_name = services[0]['binary']
params = {'host': host_name, 'binary': binary_name}
- resp, services = self.client.list_services(params)
- self.assertEqual(200, resp.status)
+ services = self.client.list_services(params)
self.assertEqual(1, len(services))
self.assertEqual(host_name, services[0]['host'])
self.assertEqual(binary_name, services[0]['binary'])
diff --git a/tempest/api/compute/admin/test_services_negative.py b/tempest/api/compute/admin/test_services_negative.py
index 534afc5..bb19a39 100644
--- a/tempest/api/compute/admin/test_services_negative.py
+++ b/tempest/api/compute/admin/test_services_negative.py
@@ -37,26 +37,23 @@
@test.attr(type=['negative', 'gate'])
def test_get_service_by_invalid_params(self):
# return all services if send the request with invalid parameter
- resp, services = self.client.list_services()
+ services = self.client.list_services()
params = {'xxx': 'nova-compute'}
- resp, services_xxx = self.client.list_services(params)
- self.assertEqual(200, resp.status)
+ services_xxx = self.client.list_services(params)
self.assertEqual(len(services), len(services_xxx))
@test.attr(type=['negative', 'gate'])
def test_get_service_by_invalid_service_and_valid_host(self):
- resp, services = self.client.list_services()
+ services = self.client.list_services()
host_name = services[0]['host']
params = {'host': host_name, 'binary': 'xxx'}
- resp, services = self.client.list_services(params)
- self.assertEqual(200, resp.status)
+ services = self.client.list_services(params)
self.assertEqual(0, len(services))
@test.attr(type=['negative', 'gate'])
def test_get_service_with_valid_service_and_invalid_host(self):
- resp, services = self.client.list_services()
+ services = self.client.list_services()
binary_name = services[0]['binary']
params = {'host': 'xxx', 'binary': binary_name}
- resp, services = self.client.list_services(params)
- self.assertEqual(200, resp.status)
+ services = self.client.list_services(params)
self.assertEqual(0, len(services))
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index 4feba59..c245eb4 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -174,7 +174,7 @@
LOG.debug('Clearing server groups: %s', ','.join(cls.server_groups))
for server_group_id in cls.server_groups:
try:
- cls.client.delete_server_group(server_group_id)
+ cls.servers_client.delete_server_group(server_group_id)
except exceptions.NotFound:
# The server-group may have already been deleted which is OK.
pass
@@ -271,7 +271,7 @@
def _delete_volume(volumes_client, volume_id):
"""Deletes the given volume and waits for it to be gone."""
try:
- resp, _ = volumes_client.delete_volume(volume_id)
+ volumes_client.delete_volume(volume_id)
# TODO(mriedem): We should move the wait_for_resource_deletion
# into the delete_volume method as a convenience to the caller.
volumes_client.wait_for_resource_deletion(volume_id)
@@ -293,20 +293,20 @@
if 'name' in kwargs:
name = kwargs.pop('name')
- resp, image = cls.images_client.create_image(server_id, name)
- image_id = data_utils.parse_image_id(resp['location'])
+ image = cls.images_client.create_image(server_id, name)
+ image_id = data_utils.parse_image_id(image.response['location'])
cls.images.append(image_id)
if 'wait_until' in kwargs:
cls.images_client.wait_for_image_status(image_id,
kwargs['wait_until'])
- resp, image = cls.images_client.get_image(image_id)
+ image = cls.images_client.get_image(image_id)
if kwargs['wait_until'] == 'ACTIVE':
if kwargs.get('wait_for_server', True):
cls.servers_client.wait_for_server_status(server_id,
'ACTIVE')
- return resp, image
+ return image
@classmethod
def rebuild_server(cls, server_id, **kwargs):
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 db382eb..19f5fba 100644
--- a/tempest/api/compute/floating_ips/test_floating_ips_actions.py
+++ b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
@@ -96,6 +96,11 @@
self.floating_ip,
self.server_id)
self.assertEqual(202, resp.status)
+
+ # Check instance_id in the floating_ip body
+ resp, body = self.client.get_floating_ip_details(self.floating_ip_id)
+ self.assertEqual(self.server_id, body['instance_id'])
+
# Disassociation of floating IP that was associated in this method
resp, body = self.client.disassociate_floating_ip_from_server(
self.floating_ip,
diff --git a/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py b/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
index 2b0f268..b08df97 100644
--- a/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
+++ b/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
@@ -89,7 +89,7 @@
@test.services('network')
def test_associate_ip_to_server_without_passing_floating_ip(self):
# Negative test:Association of empty floating IP to specific server
- # should raise NotFound exception
- self.assertRaises(exceptions.NotFound,
+ # should raise NotFound or BadRequest(In case of Nova V2.1) exception.
+ self.assertRaises((exceptions.NotFound, exceptions.BadRequest),
self.client.associate_floating_ip_to_server,
'', self.server_id)
diff --git a/tempest/api/compute/images/test_image_metadata.py b/tempest/api/compute/images/test_image_metadata.py
index 5105e2f..c3b144d 100644
--- a/tempest/api/compute/images/test_image_metadata.py
+++ b/tempest/api/compute/images/test_image_metadata.py
@@ -37,10 +37,10 @@
cls.image_id = None
name = data_utils.rand_name('image')
- resp, body = cls.glance_client.create_image(name=name,
- container_format='bare',
- disk_format='raw',
- is_public=False)
+ body = cls.glance_client.create_image(name=name,
+ container_format='bare',
+ disk_format='raw',
+ is_public=False)
cls.image_id = body['id']
cls.images.append(cls.image_id)
image_file = StringIO.StringIO(('*' * 1024))
@@ -49,61 +49,62 @@
def setUp(self):
super(ImagesMetadataTestJSON, self).setUp()
- meta = {'key1': 'value1', 'key2': 'value2'}
- resp, _ = self.client.set_image_metadata(self.image_id, meta)
- self.assertEqual(resp.status, 200)
+ meta = {'os_version': 'value1', 'os_distro': 'value2'}
+ self.client.set_image_metadata(self.image_id, meta)
@test.attr(type='gate')
def test_list_image_metadata(self):
# All metadata key/value pairs for an image should be returned
- resp, resp_metadata = self.client.list_image_metadata(self.image_id)
- expected = {'key1': 'value1', 'key2': 'value2'}
+ resp_metadata = self.client.list_image_metadata(self.image_id)
+ expected = {'os_version': 'value1', 'os_distro': 'value2'}
self.assertEqual(expected, resp_metadata)
@test.attr(type='gate')
def test_set_image_metadata(self):
# The metadata for the image should match the new values
- req_metadata = {'meta2': 'value2', 'meta3': 'value3'}
- resp, body = self.client.set_image_metadata(self.image_id,
- req_metadata)
+ req_metadata = {'os_version': 'value2', 'architecture': 'value3'}
+ self.client.set_image_metadata(self.image_id,
+ req_metadata)
- resp, resp_metadata = self.client.list_image_metadata(self.image_id)
+ resp_metadata = self.client.list_image_metadata(self.image_id)
self.assertEqual(req_metadata, resp_metadata)
@test.attr(type='gate')
def test_update_image_metadata(self):
# The metadata for the image should match the updated values
- req_metadata = {'key1': 'alt1', 'key3': 'value3'}
- resp, metadata = self.client.update_image_metadata(self.image_id,
- req_metadata)
+ req_metadata = {'os_version': 'alt1', 'architecture': 'value3'}
+ self.client.update_image_metadata(self.image_id,
+ req_metadata)
- resp, resp_metadata = self.client.list_image_metadata(self.image_id)
- expected = {'key1': 'alt1', 'key2': 'value2', 'key3': 'value3'}
+ resp_metadata = self.client.list_image_metadata(self.image_id)
+ expected = {'os_version': 'alt1',
+ 'os_distro': 'value2',
+ 'architecture': 'value3'}
self.assertEqual(expected, resp_metadata)
@test.attr(type='gate')
def test_get_image_metadata_item(self):
# The value for a specific metadata key should be returned
- resp, meta = self.client.get_image_metadata_item(self.image_id,
- 'key2')
- self.assertEqual('value2', meta['key2'])
+ meta = self.client.get_image_metadata_item(self.image_id,
+ 'os_distro')
+ self.assertEqual('value2', meta['os_distro'])
@test.attr(type='gate')
def test_set_image_metadata_item(self):
# The value provided for the given meta item should be set for
# the image
- meta = {'key1': 'alt'}
- resp, body = self.client.set_image_metadata_item(self.image_id,
- 'key1', meta)
- resp, resp_metadata = self.client.list_image_metadata(self.image_id)
- expected = {'key1': 'alt', 'key2': 'value2'}
+ meta = {'os_version': 'alt'}
+ self.client.set_image_metadata_item(self.image_id,
+ 'os_version', meta)
+ resp_metadata = self.client.list_image_metadata(self.image_id)
+ expected = {'os_version': 'alt', 'os_distro': 'value2'}
self.assertEqual(expected, resp_metadata)
@test.attr(type='gate')
def test_delete_image_metadata_item(self):
# The metadata value/key pair should be deleted from the image
- resp, body = self.client.delete_image_metadata_item(self.image_id,
- 'key1')
- resp, resp_metadata = self.client.list_image_metadata(self.image_id)
- expected = {'key2': 'value2'}
+ self.client.delete_image_metadata_item(self.image_id,
+ 'os_version')
+ resp_metadata = self.client.list_image_metadata(self.image_id)
+ expected = {'os_distro': 'value2'}
self.assertEqual(expected, resp_metadata)
diff --git a/tempest/api/compute/images/test_image_metadata_negative.py b/tempest/api/compute/images/test_image_metadata_negative.py
index 615b5d0..73412ff 100644
--- a/tempest/api/compute/images/test_image_metadata_negative.py
+++ b/tempest/api/compute/images/test_image_metadata_negative.py
@@ -36,7 +36,7 @@
@test.attr(type=['negative', 'gate'])
def test_update_nonexistent_image_metadata(self):
# Negative test:An update should not happen for a non-existent image
- meta = {'key1': 'alt1', 'key2': 'alt2'}
+ meta = {'os_distro': 'alt1', 'os_version': 'alt2'}
self.assertRaises(exceptions.NotFound,
self.client.update_image_metadata,
data_utils.rand_uuid(), meta)
@@ -46,12 +46,12 @@
# Negative test: Get on non-existent image should not happen
self.assertRaises(exceptions.NotFound,
self.client.get_image_metadata_item,
- data_utils.rand_uuid(), 'key2')
+ data_utils.rand_uuid(), 'os_version')
@test.attr(type=['negative', 'gate'])
def test_set_nonexistent_image_metadata(self):
# Negative test: Metadata should not be set to a non-existent image
- meta = {'key1': 'alt1', 'key2': 'alt2'}
+ meta = {'os_distro': 'alt1', 'os_version': 'alt2'}
self.assertRaises(exceptions.NotFound, self.client.set_image_metadata,
data_utils.rand_uuid(), meta)
@@ -59,10 +59,10 @@
def test_set_nonexistent_image_metadata_item(self):
# Negative test: Metadata item should not be set to a
# nonexistent image
- meta = {'key1': 'alt'}
+ meta = {'os_distro': 'alt'}
self.assertRaises(exceptions.NotFound,
self.client.set_image_metadata_item,
- data_utils.rand_uuid(), 'key1',
+ data_utils.rand_uuid(), 'os_distro',
meta)
@test.attr(type=['negative', 'gate'])
@@ -71,4 +71,4 @@
# item from non-existent image
self.assertRaises(exceptions.NotFound,
self.client.delete_image_metadata_item,
- data_utils.rand_uuid(), 'key1')
+ data_utils.rand_uuid(), 'os_distro')
diff --git a/tempest/api/compute/images/test_images.py b/tempest/api/compute/images/test_images.py
index 51dae65..dc27a70 100644
--- a/tempest/api/compute/images/test_images.py
+++ b/tempest/api/compute/images/test_images.py
@@ -42,8 +42,7 @@
snapshot_name = data_utils.rand_name('test-snap-')
resp, server = self.create_test_server(wait_until='ACTIVE')
self.addCleanup(self.servers_client.delete_server, server['id'])
- resp, image = self.create_image_from_server(server['id'],
- name=snapshot_name,
- wait_until='SAVING')
- resp, body = self.client.delete_image(image['id'])
- self.assertEqual('204', resp['status'])
+ image = self.create_image_from_server(server['id'],
+ name=snapshot_name,
+ wait_until='SAVING')
+ self.client.delete_image(image['id'])
diff --git a/tempest/api/compute/images/test_images_negative.py b/tempest/api/compute/images/test_images_negative.py
index 9570ca5..58fc20d 100644
--- a/tempest/api/compute/images/test_images_negative.py
+++ b/tempest/api/compute/images/test_images_negative.py
@@ -72,10 +72,10 @@
'SHUTOFF')
self.addCleanup(self.servers_client.delete_server, server['id'])
snapshot_name = data_utils.rand_name('test-snap-')
- resp, image = self.create_image_from_server(server['id'],
- name=snapshot_name,
- wait_until='ACTIVE',
- wait_for_server=False)
+ image = self.create_image_from_server(server['id'],
+ name=snapshot_name,
+ wait_until='ACTIVE',
+ wait_for_server=False)
self.addCleanup(self.client.delete_image, image['id'])
self.assertEqual(snapshot_name, image['name'])
diff --git a/tempest/api/compute/images/test_images_oneserver.py b/tempest/api/compute/images/test_images_oneserver.py
index 91e0423..6156c5a 100644
--- a/tempest/api/compute/images/test_images_oneserver.py
+++ b/tempest/api/compute/images/test_images_oneserver.py
@@ -72,17 +72,16 @@
# Create a new image
name = data_utils.rand_name('image')
meta = {'image_type': 'test'}
- resp, body = self.client.create_image(self.server_id, name, meta)
- self.assertEqual(202, resp.status)
- image_id = data_utils.parse_image_id(resp['location'])
+ body = self.client.create_image(self.server_id, name, meta)
+ image_id = data_utils.parse_image_id(body.response['location'])
self.client.wait_for_image_status(image_id, 'ACTIVE')
# Verify the image was created correctly
- resp, image = self.client.get_image(image_id)
+ image = self.client.get_image(image_id)
self.assertEqual(name, image['name'])
self.assertEqual('test', image['metadata']['image_type'])
- resp, original_image = self.client.get_image(self.image_ref)
+ original_image = self.client.get_image(self.image_ref)
# Verify minRAM is the same as the original image
self.assertEqual(image['minRam'], original_image['minRam'])
@@ -93,8 +92,7 @@
(str(original_image['minDisk']), str(flavor_disk_size)))
# Verify the image was deleted correctly
- resp, body = self.client.delete_image(image_id)
- self.assertEqual('204', resp['status'])
+ self.client.delete_image(image_id)
self.client.wait_for_resource_deletion(image_id)
@test.attr(type=['gate'])
@@ -106,7 +104,6 @@
# #1370954 in glance which will 500 if mysql is used as the
# backend and it attempts to store a 4 byte utf-8 character
utf8_name = data_utils.rand_name('\xe2\x82\xa1')
- resp, body = self.client.create_image(self.server_id, utf8_name)
- image_id = data_utils.parse_image_id(resp['location'])
+ body = self.client.create_image(self.server_id, utf8_name)
+ image_id = data_utils.parse_image_id(body.response['location'])
self.addCleanup(self.client.delete_image, image_id)
- self.assertEqual('202', resp['status'])
diff --git a/tempest/api/compute/images/test_images_oneserver_negative.py b/tempest/api/compute/images/test_images_oneserver_negative.py
index ae6e712..46cec9b 100644
--- a/tempest/api/compute/images/test_images_oneserver_negative.py
+++ b/tempest/api/compute/images/test_images_oneserver_negative.py
@@ -94,10 +94,9 @@
# Create first snapshot
snapshot_name = data_utils.rand_name('test-snap-')
- resp, body = self.client.create_image(self.server_id,
- snapshot_name)
- self.assertEqual(202, resp.status)
- image_id = data_utils.parse_image_id(resp['location'])
+ body = self.client.create_image(self.server_id,
+ snapshot_name)
+ image_id = data_utils.parse_image_id(body.response['location'])
self.image_ids.append(image_id)
self.addCleanup(self._reset_server)
@@ -119,15 +118,13 @@
# Return an error while trying to delete an image what is creating
snapshot_name = data_utils.rand_name('test-snap-')
- resp, body = self.client.create_image(self.server_id, snapshot_name)
- self.assertEqual(202, resp.status)
- image_id = data_utils.parse_image_id(resp['location'])
+ body = self.client.create_image(self.server_id, snapshot_name)
+ image_id = data_utils.parse_image_id(body.response['location'])
self.image_ids.append(image_id)
self.addCleanup(self._reset_server)
# Do not wait, attempt to delete the image, ensure it's successful
- resp, body = self.client.delete_image(image_id)
- self.assertEqual('204', resp['status'])
+ self.client.delete_image(image_id)
self.image_ids.remove(image_id)
self.assertRaises(exceptions.NotFound, self.client.get_image, image_id)
diff --git a/tempest/api/compute/images/test_list_image_filters.py b/tempest/api/compute/images/test_list_image_filters.py
index ceab4f9..742c2dd 100644
--- a/tempest/api/compute/images/test_list_image_filters.py
+++ b/tempest/api/compute/images/test_list_image_filters.py
@@ -42,10 +42,10 @@
def _create_image():
name = data_utils.rand_name('image')
- _, body = cls.glance_client.create_image(name=name,
- container_format='bare',
- disk_format='raw',
- is_public=False)
+ body = cls.glance_client.create_image(name=name,
+ container_format='bare',
+ disk_format='raw',
+ is_public=False)
image_id = body['id']
cls.images.append(image_id)
# Wait 1 second between creation and upload to ensure a delta
@@ -54,7 +54,7 @@
image_file = StringIO.StringIO(('*' * 1024))
cls.glance_client.update_image(image_id, data=image_file)
cls.client.wait_for_image_status(image_id, 'ACTIVE')
- _, body = cls.client.get_image(image_id)
+ body = cls.client.get_image(image_id)
return body
# Create non-snapshot images via glance
@@ -76,19 +76,19 @@
'ACTIVE')
# Create images to be used in the filter tests
- resp, cls.snapshot1 = cls.create_image_from_server(
+ cls.snapshot1 = cls.create_image_from_server(
cls.server1['id'], wait_until='ACTIVE')
cls.snapshot1_id = cls.snapshot1['id']
# Servers have a hidden property for when they are being imaged
# Performing back-to-back create image calls on a single
# server will sometimes cause failures
- resp, cls.snapshot3 = cls.create_image_from_server(
+ cls.snapshot3 = cls.create_image_from_server(
cls.server2['id'], wait_until='ACTIVE')
cls.snapshot3_id = cls.snapshot3['id']
# Wait for the server to be active after the image upload
- resp, cls.snapshot2 = cls.create_image_from_server(
+ cls.snapshot2 = cls.create_image_from_server(
cls.server1['id'], wait_until='ACTIVE')
cls.snapshot2_id = cls.snapshot2['id']
@@ -97,7 +97,7 @@
# The list of images should contain only images with the
# provided status
params = {'status': 'ACTIVE'}
- resp, images = self.client.list_images(params)
+ images = self.client.list_images(params)
self.assertTrue(any([i for i in images if i['id'] == self.image1_id]))
self.assertTrue(any([i for i in images if i['id'] == self.image2_id]))
@@ -108,7 +108,7 @@
# List of all images should contain the expected images filtered
# by name
params = {'name': self.image1['name']}
- resp, images = self.client.list_images(params)
+ images = self.client.list_images(params)
self.assertTrue(any([i for i in images if i['id'] == self.image1_id]))
self.assertFalse(any([i for i in images if i['id'] == self.image2_id]))
@@ -120,7 +120,7 @@
def test_list_images_filter_by_server_id(self):
# The images should contain images filtered by server id
params = {'server': self.server1['id']}
- resp, images = self.client.list_images(params)
+ images = self.client.list_images(params)
self.assertTrue(any([i for i in images
if i['id'] == self.snapshot1_id]),
@@ -141,7 +141,7 @@
# Try all server link types
for link in server_links:
params = {'server': link['href']}
- resp, images = self.client.list_images(params)
+ images = self.client.list_images(params)
self.assertFalse(any([i for i in images
if i['id'] == self.snapshot1_id]))
@@ -156,7 +156,7 @@
def test_list_images_filter_by_type(self):
# The list of servers should be filtered by image type
params = {'type': 'snapshot'}
- resp, images = self.client.list_images(params)
+ images = self.client.list_images(params)
self.assertTrue(any([i for i in images
if i['id'] == self.snapshot1_id]))
@@ -171,7 +171,7 @@
def test_list_images_limit_results(self):
# Verify only the expected number of results are returned
params = {'limit': '1'}
- resp, images = self.client.list_images(params)
+ images = self.client.list_images(params)
# when _interface='xml', one element for images_links in images
# ref: Question #224349
self.assertEqual(1, len([x for x in images if 'id' in x]))
@@ -183,7 +183,7 @@
# Becoming ACTIVE will modify the updated time
# Filter by the image's created time
params = {'changes-since': self.image3['created']}
- resp, images = self.client.list_images(params)
+ images = self.client.list_images(params)
found = any([i for i in images if i['id'] == self.image3_id])
self.assertTrue(found)
@@ -192,7 +192,7 @@
# Detailed list of all images should only contain images
# with the provided status
params = {'status': 'ACTIVE'}
- resp, images = self.client.list_images_with_detail(params)
+ images = self.client.list_images_with_detail(params)
self.assertTrue(any([i for i in images if i['id'] == self.image1_id]))
self.assertTrue(any([i for i in images if i['id'] == self.image2_id]))
@@ -203,7 +203,7 @@
# Detailed list of all images should contain the expected
# images filtered by name
params = {'name': self.image1['name']}
- resp, images = self.client.list_images_with_detail(params)
+ images = self.client.list_images_with_detail(params)
self.assertTrue(any([i for i in images if i['id'] == self.image1_id]))
self.assertFalse(any([i for i in images if i['id'] == self.image2_id]))
@@ -214,7 +214,7 @@
# Verify only the expected number of results (with full details)
# are returned
params = {'limit': '1'}
- resp, images = self.client.list_images_with_detail(params)
+ images = self.client.list_images_with_detail(params)
self.assertEqual(1, len(images))
@testtools.skipUnless(CONF.compute_feature_enabled.snapshot,
@@ -227,7 +227,7 @@
# Try all server link types
for link in server_links:
params = {'server': link['href']}
- resp, images = self.client.list_images_with_detail(params)
+ images = self.client.list_images_with_detail(params)
self.assertFalse(any([i for i in images
if i['id'] == self.snapshot1_id]))
@@ -242,8 +242,8 @@
def test_list_images_with_detail_filter_by_type(self):
# The detailed list of servers should be filtered by image type
params = {'type': 'snapshot'}
- resp, images = self.client.list_images_with_detail(params)
- resp, image4 = self.client.get_image(self.image_ref)
+ images = self.client.list_images_with_detail(params)
+ self.client.get_image(self.image_ref)
self.assertTrue(any([i for i in images
if i['id'] == self.snapshot1_id]))
@@ -261,5 +261,5 @@
# Becoming ACTIVE will modify the updated time
# Filter by the image's created time
params = {'changes-since': self.image1['created']}
- resp, images = self.client.list_images_with_detail(params)
+ images = self.client.list_images_with_detail(params)
self.assertTrue(any([i for i in images if i['id'] == self.image1_id]))
diff --git a/tempest/api/compute/images/test_list_images.py b/tempest/api/compute/images/test_list_images.py
index 22d64e9..cd01147 100644
--- a/tempest/api/compute/images/test_list_images.py
+++ b/tempest/api/compute/images/test_list_images.py
@@ -33,19 +33,19 @@
@test.attr(type='smoke')
def test_get_image(self):
# Returns the correct details for a single image
- resp, image = self.client.get_image(self.image_ref)
+ image = self.client.get_image(self.image_ref)
self.assertEqual(self.image_ref, image['id'])
@test.attr(type='smoke')
def test_list_images(self):
# The list of all images should contain the image
- resp, images = self.client.list_images()
+ images = self.client.list_images()
found = any([i for i in images if i['id'] == self.image_ref])
self.assertTrue(found)
@test.attr(type='smoke')
def test_list_images_with_detail(self):
# Detailed list of all images should contain the expected images
- resp, images = self.client.list_images_with_detail()
+ images = self.client.list_images_with_detail()
found = any([i for i in images if i['id'] == self.image_ref])
self.assertTrue(found)
diff --git a/tempest/api/compute/limits/test_absolute_limits_negative.py b/tempest/api/compute/limits/test_absolute_limits_negative.py
index a9c72fb..d537d83 100644
--- a/tempest/api/compute/limits/test_absolute_limits_negative.py
+++ b/tempest/api/compute/limits/test_absolute_limits_negative.py
@@ -14,12 +14,18 @@
# under the License.
from tempest.api.compute import base
+from tempest.common import tempest_fixtures as fixtures
from tempest import exceptions
from tempest import test
class AbsoluteLimitsNegativeTestJSON(base.BaseV2ComputeTest):
+ def setUp(self):
+ # NOTE(mriedem): Avoid conflicts with os-quota-class-sets tests.
+ self.useFixture(fixtures.LockFixture('compute_quotas'))
+ super(AbsoluteLimitsNegativeTestJSON, self).setUp()
+
@classmethod
def resource_setup(cls):
super(AbsoluteLimitsNegativeTestJSON, cls).resource_setup()
@@ -46,7 +52,4 @@
# A 403 Forbidden or 413 Overlimit (old behaviour) exception
# will be raised when out of quota
self.assertRaises((exceptions.Unauthorized, exceptions.OverLimit),
- self.server_client.create_server,
- name='test', meta=meta_data,
- flavor_ref=self.flavor_ref,
- image_ref=self.image_ref)
+ self.create_test_server, meta=meta_data)
diff --git a/tempest/api/compute/servers/test_attach_interfaces.py b/tempest/api/compute/servers/test_attach_interfaces.py
index 049736c..4b14dc4 100644
--- a/tempest/api/compute/servers/test_attach_interfaces.py
+++ b/tempest/api/compute/servers/test_attach_interfaces.py
@@ -37,7 +37,7 @@
cls.client = cls.os.interfaces_client
def _check_interface(self, iface, port_id=None, network_id=None,
- fixed_ip=None):
+ fixed_ip=None, mac_addr=None):
self.assertIn('port_state', iface)
if port_id:
self.assertEqual(iface['port_id'], port_id)
@@ -45,6 +45,8 @@
self.assertEqual(iface['net_id'], network_id)
if fixed_ip:
self.assertEqual(iface['fixed_ips'][0]['ip_address'], fixed_ip)
+ if mac_addr:
+ self.assertEqual(iface['mac_addr'], mac_addr)
def _create_server_get_interfaces(self):
resp, server = self.create_test_server(wait_until='ACTIVE')
@@ -78,7 +80,10 @@
resp, _iface = self.client.show_interface(server['id'],
iface['port_id'])
self.assertEqual(200, resp.status)
- self.assertEqual(iface, _iface)
+ self._check_interface(iface, port_id=_iface['port_id'],
+ network_id=_iface['net_id'],
+ fixed_ip=_iface['fixed_ips'][0]['ip_address'],
+ mac_addr=_iface['mac_addr'])
def _test_delete_interface(self, server, ifs):
# NOTE(danms): delete not the first or last, but one in the middle
diff --git a/tempest/api/compute/servers/test_list_server_filters.py b/tempest/api/compute/servers/test_list_server_filters.py
index 5ff39df..7964cf7 100644
--- a/tempest/api/compute/servers/test_list_server_filters.py
+++ b/tempest/api/compute/servers/test_list_server_filters.py
@@ -33,7 +33,7 @@
# Check to see if the alternate image ref actually exists...
images_client = cls.images_client
- resp, images = images_client.list_images()
+ images = images_client.list_images()
if cls.image_ref != cls.image_ref_alt and \
any([image for image in images
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 28deaa7..17e3669 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -290,12 +290,11 @@
'backup_type': "daily",
'instance_uuid': self.server_id,
}
- resp, image_list = self.os.image_client.image_list_detail(
+ image_list = self.os.image_client.image_list_detail(
properties,
status='active',
sort_key='created_at',
sort_dir='asc')
- self.assertEqual(200, resp.status)
self.assertEqual(2, len(image_list))
self.assertEqual((backup1, backup2),
(image_list[0]['name'], image_list[1]['name']))
@@ -315,12 +314,11 @@
self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
self.os.image_client.wait_for_resource_deletion(image1_id)
oldest_backup_exist = False
- resp, image_list = self.os.image_client.image_list_detail(
+ image_list = self.os.image_client.image_list_detail(
properties,
status='active',
sort_key='created_at',
sort_dir='asc')
- self.assertEqual(200, resp.status)
self.assertEqual(2, len(image_list),
'Unexpected number of images for '
'v2:test_create_backup; was the oldest backup not '
@@ -439,7 +437,7 @@
resp, server = self.client.get_server(self.server_id)
image_name = server['name'] + '-shelved'
params = {'name': image_name}
- resp, images = self.images_client.list_images(params)
+ images = self.images_client.list_images(params)
self.assertEqual(1, len(images))
self.assertEqual(image_name, images[0]['name'])
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index f44d158..b703cfe 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -431,7 +431,7 @@
resp, server = self.client.get_server(self.server_id)
image_name = server['name'] + '-shelved'
params = {'name': image_name}
- resp, images = self.images_client.list_images(params)
+ images = self.images_client.list_images(params)
self.assertEqual(1, len(images))
self.assertEqual(image_name, images[0]['name'])
diff --git a/tempest/api/compute/test_authorization.py b/tempest/api/compute/test_authorization.py
index 1f4f124..60cb812 100644
--- a/tempest/api/compute/test_authorization.py
+++ b/tempest/api/compute/test_authorization.py
@@ -57,15 +57,15 @@
resp, cls.server = cls.client.get_server(server['id'])
name = data_utils.rand_name('image')
- resp, body = cls.glance_client.create_image(name=name,
- container_format='bare',
- disk_format='raw',
- is_public=False)
+ body = cls.glance_client.create_image(name=name,
+ container_format='bare',
+ disk_format='raw',
+ is_public=False)
image_id = body['id']
image_file = StringIO.StringIO(('*' * 1024))
- resp, body = cls.glance_client.update_image(image_id, data=image_file)
+ body = cls.glance_client.update_image(image_id, data=image_file)
cls.glance_client.wait_for_image_status(image_id, 'active')
- resp, cls.image = cls.images_client.get_image(image_id)
+ cls.image = cls.images_client.get_image(image_id)
cls.keypairname = data_utils.rand_name('keypair')
resp, keypair = \
diff --git a/tempest/api/compute/test_live_block_migration.py b/tempest/api/compute/test_live_block_migration.py
index cb75d07..180dffd 100644
--- a/tempest/api/compute/test_live_block_migration.py
+++ b/tempest/api/compute/test_live_block_migration.py
@@ -36,7 +36,7 @@
cls.created_server_ids = []
def _get_compute_hostnames(self):
- _resp, body = self.admin_hosts_client.list_hosts()
+ body = self.admin_hosts_client.list_hosts()
return [
host_record['host_name']
for host_record in body
@@ -115,8 +115,7 @@
actual_host = self._get_host_for_server(server_id)
target_host = self._get_host_other_than(actual_host)
- resp, volume = self.volumes_client.create_volume(1,
- display_name='test')
+ volume = self.volumes_client.create_volume(1, display_name='test')
self.volumes_client.wait_for_volume_status(volume['id'],
'available')
diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py
index 1d22fbd..7fef52f 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -61,7 +61,7 @@
self.servers_client.list_addresses(self.server['id']))
# Create a volume and wait for it to become ready
- _, self.volume = self.volumes_client.create_volume(
+ self.volume = self.volumes_client.create_volume(
1, display_name='test')
self.addCleanup(self._delete_volume)
self.volumes_client.wait_for_volume_status(self.volume['id'],
diff --git a/tempest/api/data_processing/test_plugins.py b/tempest/api/data_processing/test_plugins.py
index 9fd7a17..4b4ec48 100644
--- a/tempest/api/data_processing/test_plugins.py
+++ b/tempest/api/data_processing/test_plugins.py
@@ -13,8 +13,11 @@
# under the License.
from tempest.api.data_processing import base as dp_base
+from tempest import config
from tempest import test
+CONF = config.CONF
+
class PluginsTest(dp_base.BaseDataProcessingTest):
def _list_all_plugin_names(self):
@@ -24,8 +27,8 @@
"""
_, plugins = self.client.list_plugins()
plugins_names = [plugin['name'] for plugin in plugins]
- self.assertIn('vanilla', plugins_names)
- self.assertIn('hdp', plugins_names)
+ for enabled_plugin in CONF.data_processing_feature_enabled.plugins:
+ self.assertIn(enabled_plugin, plugins_names)
return plugins_names
diff --git a/tempest/api/identity/admin/test_roles.py b/tempest/api/identity/admin/test_roles.py
index fabc0ed..c6c7dc3 100644
--- a/tempest/api/identity/admin/test_roles.py
+++ b/tempest/api/identity/admin/test_roles.py
@@ -28,7 +28,7 @@
super(RolesTestJSON, cls).resource_setup()
for _ in moves.xrange(5):
role_name = data_utils.rand_name(name='role-')
- _, role = cls.client.create_role(role_name)
+ role = cls.client.create_role(role_name)
cls.data.roles.append(role)
def _get_role_params(self):
@@ -49,7 +49,7 @@
@test.attr(type='gate')
def test_list_roles(self):
"""Return a list of all roles."""
- _, body = self.client.list_roles()
+ body = self.client.list_roles()
found = [role for role in body if role in self.data.roles]
self.assertTrue(any(found))
self.assertEqual(len(found), len(self.data.roles))
@@ -58,16 +58,16 @@
def test_role_create_delete(self):
"""Role should be created, verified, and deleted."""
role_name = data_utils.rand_name(name='role-test-')
- _, body = self.client.create_role(role_name)
+ body = self.client.create_role(role_name)
self.assertEqual(role_name, body['name'])
- _, body = self.client.list_roles()
+ body = self.client.list_roles()
found = [role for role in body if role['name'] == role_name]
self.assertTrue(any(found))
- _, body = self.client.delete_role(found[0]['id'])
+ body = self.client.delete_role(found[0]['id'])
- _, body = self.client.list_roles()
+ body = self.client.list_roles()
found = [role for role in body if role['name'] == role_name]
self.assertFalse(any(found))
@@ -77,7 +77,7 @@
self.data.setup_test_role()
role_id = self.data.role['id']
role_name = self.data.role['name']
- _, body = self.client.get_role(role_id)
+ body = self.client.get_role(role_id)
self.assertEqual(role_id, body['id'])
self.assertEqual(role_name, body['name'])
@@ -86,15 +86,15 @@
"""Assign a role to a user on a tenant."""
(user, tenant, role) = self._get_role_params()
self.client.assign_user_role(tenant['id'], user['id'], role['id'])
- _, roles = self.client.list_user_roles(tenant['id'], user['id'])
+ roles = self.client.list_user_roles(tenant['id'], user['id'])
self.assert_role_in_role_list(role, roles)
@test.attr(type='gate')
def test_remove_user_role(self):
"""Remove a role assigned to a user on a tenant."""
(user, tenant, role) = self._get_role_params()
- _, user_role = self.client.assign_user_role(tenant['id'],
- user['id'], role['id'])
+ user_role = self.client.assign_user_role(tenant['id'],
+ user['id'], role['id'])
self.client.remove_user_role(tenant['id'], user['id'],
user_role['id'])
@@ -103,5 +103,5 @@
"""List roles assigned to a user on tenant."""
(user, tenant, role) = self._get_role_params()
self.client.assign_user_role(tenant['id'], user['id'], role['id'])
- _, roles = self.client.list_user_roles(tenant['id'], user['id'])
+ roles = self.client.list_user_roles(tenant['id'], user['id'])
self.assert_role_in_role_list(role, roles)
diff --git a/tempest/api/identity/admin/test_roles_negative.py b/tempest/api/identity/admin/test_roles_negative.py
index d0eb334..58f726a 100644
--- a/tempest/api/identity/admin/test_roles_negative.py
+++ b/tempest/api/identity/admin/test_roles_negative.py
@@ -72,7 +72,7 @@
def test_role_create_duplicate(self):
# Role names should be unique
role_name = data_utils.rand_name(name='role-dup-')
- _, body = self.client.create_role(role_name)
+ body = self.client.create_role(role_name)
role1_id = body.get('id')
self.addCleanup(self.client.delete_role, role1_id)
self.assertRaises(exceptions.Conflict, self.client.create_role,
@@ -82,7 +82,7 @@
def test_delete_role_by_unauthorized_user(self):
# Non-administrator user should not be able to delete role
role_name = data_utils.rand_name(name='role-')
- _, body = self.client.create_role(role_name)
+ body = self.client.create_role(role_name)
self.data.roles.append(body)
role_id = body.get('id')
self.assertRaises(exceptions.Unauthorized,
@@ -92,7 +92,7 @@
def test_delete_role_request_without_token(self):
# Request to delete role without a valid token should fail
role_name = data_utils.rand_name(name='role-')
- _, body = self.client.create_role(role_name)
+ body = self.client.create_role(role_name)
self.data.roles.append(body)
role_id = body.get('id')
token = self.client.auth_provider.get_token()
@@ -158,9 +158,9 @@
# Non-administrator user should not be authorized to
# remove a user's role
(user, tenant, role) = self._get_role_params()
- resp, user_role = self.client.assign_user_role(tenant['id'],
- user['id'],
- role['id'])
+ self.client.assign_user_role(tenant['id'],
+ user['id'],
+ role['id'])
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.remove_user_role,
tenant['id'], user['id'], role['id'])
@@ -169,9 +169,9 @@
def test_remove_user_role_request_without_token(self):
# Request to remove a user's role without a valid token
(user, tenant, role) = self._get_role_params()
- resp, user_role = self.client.assign_user_role(tenant['id'],
- user['id'],
- role['id'])
+ self.client.assign_user_role(tenant['id'],
+ user['id'],
+ role['id'])
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
self.assertRaises(exceptions.Unauthorized,
@@ -183,9 +183,9 @@
def test_remove_user_role_non_existent_role(self):
# Attempt to delete a non existent role from a user should fail
(user, tenant, role) = self._get_role_params()
- resp, user_role = self.client.assign_user_role(tenant['id'],
- user['id'],
- role['id'])
+ self.client.assign_user_role(tenant['id'],
+ user['id'],
+ role['id'])
non_existent_role = str(uuid.uuid4().hex)
self.assertRaises(exceptions.NotFound, self.client.remove_user_role,
tenant['id'], user['id'], non_existent_role)
@@ -194,9 +194,9 @@
def test_remove_user_role_non_existent_tenant(self):
# Attempt to remove a role from a non existent tenant should fail
(user, tenant, role) = self._get_role_params()
- resp, user_role = self.client.assign_user_role(tenant['id'],
- user['id'],
- role['id'])
+ self.client.assign_user_role(tenant['id'],
+ user['id'],
+ role['id'])
non_existent_tenant = str(uuid.uuid4().hex)
self.assertRaises(exceptions.NotFound, self.client.remove_user_role,
non_existent_tenant, user['id'], role['id'])
diff --git a/tempest/api/identity/admin/test_services.py b/tempest/api/identity/admin/test_services.py
index b8f09ad..03d6e35 100644
--- a/tempest/api/identity/admin/test_services.py
+++ b/tempest/api/identity/admin/test_services.py
@@ -38,7 +38,7 @@
name = data_utils.rand_name('service-')
type = data_utils.rand_name('type--')
description = data_utils.rand_name('description-')
- _, service_data = self.client.create_service(
+ 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'])
@@ -51,7 +51,7 @@
self.assertIn('description', service_data)
self.assertEqual(description, service_data['description'])
# Get service
- _, fetched_service = self.client.get_service(service_data['id'])
+ fetched_service = self.client.get_service(service_data['id'])
# verifying the existence of service created
self.assertIn('id', fetched_service)
self.assertEqual(fetched_service['id'], service_data['id'])
@@ -68,7 +68,7 @@
# Create a service only with name and type
name = data_utils.rand_name('service-')
type = data_utils.rand_name('type--')
- _, service = self.client.create_service(name, type)
+ service = self.client.create_service(name, type)
self.assertIn('id', service)
self.addCleanup(self._del_service, service['id'])
self.assertIn('name', service)
@@ -84,7 +84,7 @@
name = data_utils.rand_name('service-')
type = data_utils.rand_name('type--')
description = data_utils.rand_name('description-')
- _, service = self.client.create_service(
+ service = self.client.create_service(
name, type, description=description)
services.append(service)
service_ids = map(lambda x: x['id'], services)
@@ -95,6 +95,6 @@
self.addCleanup(delete_services)
# List and Verify Services
- _, body = self.client.list_services()
+ body = self.client.list_services()
found = [serv for serv in body if serv['id'] in service_ids]
self.assertEqual(len(found), len(services), 'Services not found')
diff --git a/tempest/api/identity/admin/test_tenant_negative.py b/tempest/api/identity/admin/test_tenant_negative.py
index 57a2fec..75f0152 100644
--- a/tempest/api/identity/admin/test_tenant_negative.py
+++ b/tempest/api/identity/admin/test_tenant_negative.py
@@ -42,7 +42,7 @@
def test_tenant_delete_by_unauthorized_user(self):
# Non-administrator user should not be able to delete a tenant
tenant_name = data_utils.rand_name(name='tenant-')
- _, tenant = self.client.create_tenant(tenant_name)
+ tenant = self.client.create_tenant(tenant_name)
self.data.tenants.append(tenant)
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.delete_tenant, tenant['id'])
@@ -51,7 +51,7 @@
def test_tenant_delete_request_without_token(self):
# Request to delete a tenant without a valid token should fail
tenant_name = data_utils.rand_name(name='tenant-')
- _, tenant = self.client.create_tenant(tenant_name)
+ tenant = self.client.create_tenant(tenant_name)
self.data.tenants.append(tenant)
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
@@ -69,7 +69,7 @@
def test_tenant_create_duplicate(self):
# Tenant names should be unique
tenant_name = data_utils.rand_name(name='tenant-')
- _, body = self.client.create_tenant(tenant_name)
+ body = self.client.create_tenant(tenant_name)
tenant = body
self.data.tenants.append(tenant)
tenant1_id = body.get('id')
@@ -119,7 +119,7 @@
def test_tenant_update_by_unauthorized_user(self):
# Non-administrator user should not be able to update a tenant
tenant_name = data_utils.rand_name(name='tenant-')
- _, tenant = self.client.create_tenant(tenant_name)
+ tenant = self.client.create_tenant(tenant_name)
self.data.tenants.append(tenant)
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.update_tenant, tenant['id'])
@@ -128,7 +128,7 @@
def test_tenant_update_request_without_token(self):
# Request to update a tenant without a valid token should fail
tenant_name = data_utils.rand_name(name='tenant-')
- _, tenant = self.client.create_tenant(tenant_name)
+ tenant = self.client.create_tenant(tenant_name)
self.data.tenants.append(tenant)
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
diff --git a/tempest/api/identity/admin/test_tenants.py b/tempest/api/identity/admin/test_tenants.py
index 778bd5c..549e952 100644
--- a/tempest/api/identity/admin/test_tenants.py
+++ b/tempest/api/identity/admin/test_tenants.py
@@ -29,11 +29,11 @@
tenants = []
for _ in moves.xrange(3):
tenant_name = data_utils.rand_name(name='tenant-new')
- _, tenant = self.client.create_tenant(tenant_name)
+ tenant = self.client.create_tenant(tenant_name)
self.data.tenants.append(tenant)
tenants.append(tenant)
tenant_ids = map(lambda x: x['id'], tenants)
- _, body = self.client.list_tenants()
+ body = self.client.list_tenants()
found = [t for t in body if t['id'] in tenant_ids]
self.assertEqual(len(found), len(tenants), 'Tenants not created')
@@ -41,7 +41,7 @@
self.client.delete_tenant(tenant['id'])
self.data.tenants.remove(tenant)
- _, body = self.client.list_tenants()
+ body = self.client.list_tenants()
found = [tenant for tenant in body if tenant['id'] in tenant_ids]
self.assertFalse(any(found), 'Tenants failed to delete')
@@ -50,15 +50,15 @@
# Create tenant with a description
tenant_name = data_utils.rand_name(name='tenant-')
tenant_desc = data_utils.rand_name(name='desc-')
- _, body = self.client.create_tenant(tenant_name,
- description=tenant_desc)
+ body = self.client.create_tenant(tenant_name,
+ description=tenant_desc)
tenant = body
self.data.tenants.append(tenant)
tenant_id = body['id']
desc1 = body['description']
self.assertEqual(desc1, tenant_desc, 'Description should have '
'been sent in response for create')
- _, body = self.client.get_tenant(tenant_id)
+ body = self.client.get_tenant(tenant_id)
desc2 = body['description']
self.assertEqual(desc2, tenant_desc, 'Description does not appear'
'to be set')
@@ -69,13 +69,13 @@
def test_tenant_create_enabled(self):
# Create a tenant that is enabled
tenant_name = data_utils.rand_name(name='tenant-')
- _, body = self.client.create_tenant(tenant_name, enabled=True)
+ body = self.client.create_tenant(tenant_name, enabled=True)
tenant = body
self.data.tenants.append(tenant)
tenant_id = body['id']
en1 = body['enabled']
self.assertTrue(en1, 'Enable should be True in response')
- _, body = self.client.get_tenant(tenant_id)
+ body = self.client.get_tenant(tenant_id)
en2 = body['enabled']
self.assertTrue(en2, 'Enable should be True in lookup')
self.client.delete_tenant(tenant_id)
@@ -85,14 +85,14 @@
def test_tenant_create_not_enabled(self):
# Create a tenant that is not enabled
tenant_name = data_utils.rand_name(name='tenant-')
- _, body = self.client.create_tenant(tenant_name, enabled=False)
+ body = self.client.create_tenant(tenant_name, enabled=False)
tenant = body
self.data.tenants.append(tenant)
tenant_id = body['id']
en1 = body['enabled']
self.assertEqual('false', str(en1).lower(),
'Enable should be False in response')
- _, body = self.client.get_tenant(tenant_id)
+ body = self.client.get_tenant(tenant_id)
en2 = body['enabled']
self.assertEqual('false', str(en2).lower(),
'Enable should be False in lookup')
@@ -103,7 +103,7 @@
def test_tenant_update_name(self):
# Update name attribute of a tenant
t_name1 = data_utils.rand_name(name='tenant-')
- _, body = self.client.create_tenant(t_name1)
+ body = self.client.create_tenant(t_name1)
tenant = body
self.data.tenants.append(tenant)
@@ -111,11 +111,11 @@
resp1_name = body['name']
t_name2 = data_utils.rand_name(name='tenant2-')
- _, body = self.client.update_tenant(t_id, name=t_name2)
+ body = self.client.update_tenant(t_id, name=t_name2)
resp2_name = body['name']
self.assertNotEqual(resp1_name, resp2_name)
- _, body = self.client.get_tenant(t_id)
+ body = self.client.get_tenant(t_id)
resp3_name = body['name']
self.assertNotEqual(resp1_name, resp3_name)
@@ -130,7 +130,7 @@
# Update description attribute of a tenant
t_name = data_utils.rand_name(name='tenant-')
t_desc = data_utils.rand_name(name='desc-')
- _, body = self.client.create_tenant(t_name, description=t_desc)
+ body = self.client.create_tenant(t_name, description=t_desc)
tenant = body
self.data.tenants.append(tenant)
@@ -138,11 +138,11 @@
resp1_desc = body['description']
t_desc2 = data_utils.rand_name(name='desc2-')
- _, body = self.client.update_tenant(t_id, description=t_desc2)
+ body = self.client.update_tenant(t_id, description=t_desc2)
resp2_desc = body['description']
self.assertNotEqual(resp1_desc, resp2_desc)
- _, body = self.client.get_tenant(t_id)
+ body = self.client.get_tenant(t_id)
resp3_desc = body['description']
self.assertNotEqual(resp1_desc, resp3_desc)
@@ -157,7 +157,7 @@
# Update the enabled attribute of a tenant
t_name = data_utils.rand_name(name='tenant-')
t_en = False
- _, body = self.client.create_tenant(t_name, enabled=t_en)
+ body = self.client.create_tenant(t_name, enabled=t_en)
tenant = body
self.data.tenants.append(tenant)
@@ -165,11 +165,11 @@
resp1_en = body['enabled']
t_en2 = True
- _, body = self.client.update_tenant(t_id, enabled=t_en2)
+ body = self.client.update_tenant(t_id, enabled=t_en2)
resp2_en = body['enabled']
self.assertNotEqual(resp1_en, resp2_en)
- _, body = self.client.get_tenant(t_id)
+ body = self.client.get_tenant(t_id)
resp3_en = body['enabled']
self.assertNotEqual(resp1_en, resp3_en)
diff --git a/tempest/api/identity/admin/test_tokens.py b/tempest/api/identity/admin/test_tokens.py
index bfdc7d6..bec621c 100644
--- a/tempest/api/identity/admin/test_tokens.py
+++ b/tempest/api/identity/admin/test_tokens.py
@@ -28,21 +28,21 @@
user_password = data_utils.rand_name(name='pass-')
# first:create a tenant
tenant_name = data_utils.rand_name(name='tenant-')
- _, tenant = self.client.create_tenant(tenant_name)
+ tenant = self.client.create_tenant(tenant_name)
self.data.tenants.append(tenant)
# second:create a user
- _, user = self.client.create_user(user_name, user_password,
- tenant['id'], '')
+ user = self.client.create_user(user_name, user_password,
+ tenant['id'], '')
self.data.users.append(user)
# then get a token for the user
- _, body = self.token_client.auth(user_name,
- user_password,
- tenant['name'])
+ body = self.token_client.auth(user_name,
+ user_password,
+ tenant['name'])
self.assertEqual(body['token']['tenant']['name'],
tenant['name'])
# Perform GET Token
token_id = body['token']['id']
- _, token_details = self.client.get_token(token_id)
+ token_details = self.client.get_token(token_id)
self.assertEqual(token_id, token_details['token']['id'])
self.assertEqual(user['id'], token_details['user']['id'])
self.assertEqual(user_name, token_details['user']['name'])
@@ -62,22 +62,22 @@
user_password = data_utils.rand_name(name='pass-')
tenant_id = None # No default tenant so will get unscoped token.
email = ''
- _, user = self.client.create_user(user_name, user_password,
- tenant_id, email)
+ user = self.client.create_user(user_name, user_password,
+ tenant_id, email)
self.data.users.append(user)
# Create a couple tenants.
tenant1_name = data_utils.rand_name(name='tenant-')
- _, tenant1 = self.client.create_tenant(tenant1_name)
+ tenant1 = self.client.create_tenant(tenant1_name)
self.data.tenants.append(tenant1)
tenant2_name = data_utils.rand_name(name='tenant-')
- _, tenant2 = self.client.create_tenant(tenant2_name)
+ tenant2 = self.client.create_tenant(tenant2_name)
self.data.tenants.append(tenant2)
# Create a role
role_name = data_utils.rand_name(name='role-')
- _, role = self.client.create_role(role_name)
+ role = self.client.create_role(role_name)
self.data.roles.append(role)
# Grant the user the role on the tenants.
@@ -88,13 +88,13 @@
role['id'])
# Get an unscoped token.
- _, body = self.token_client.auth(user_name, user_password)
+ body = self.token_client.auth(user_name, user_password)
token_id = body['token']['id']
# Use the unscoped token to get a token scoped to tenant1
- _, body = self.token_client.auth_token(token_id,
- tenant=tenant1_name)
+ body = self.token_client.auth_token(token_id,
+ tenant=tenant1_name)
scoped_token_id = body['token']['id']
@@ -102,5 +102,5 @@
self.client.delete_token(scoped_token_id)
# Use the unscoped token to get a token scoped to tenant2
- _, body = self.token_client.auth_token(token_id,
- tenant=tenant2_name)
+ body = self.token_client.auth_token(token_id,
+ tenant=tenant2_name)
diff --git a/tempest/api/identity/admin/test_users.py b/tempest/api/identity/admin/test_users.py
index 84a8103..25312e8 100644
--- a/tempest/api/identity/admin/test_users.py
+++ b/tempest/api/identity/admin/test_users.py
@@ -34,9 +34,9 @@
def test_create_user(self):
# Create a user
self.data.setup_test_tenant()
- _, user = self.client.create_user(self.alt_user, self.alt_password,
- self.data.tenant['id'],
- self.alt_email)
+ user = self.client.create_user(self.alt_user, self.alt_password,
+ self.data.tenant['id'],
+ self.alt_email)
self.data.users.append(user)
self.assertEqual(self.alt_user, user['name'])
@@ -45,9 +45,9 @@
# Create a user with enabled : False
self.data.setup_test_tenant()
name = data_utils.rand_name('test_user_')
- _, user = self.client.create_user(name, self.alt_password,
- self.data.tenant['id'],
- self.alt_email, enabled=False)
+ user = self.client.create_user(name, self.alt_password,
+ self.data.tenant['id'],
+ self.alt_email, enabled=False)
self.data.users.append(user)
self.assertEqual(name, user['name'])
self.assertEqual('false', str(user['enabled']).lower())
@@ -58,22 +58,22 @@
# Test case to check if updating of user attributes is successful.
test_user = data_utils.rand_name('test_user_')
self.data.setup_test_tenant()
- _, user = self.client.create_user(test_user, self.alt_password,
- self.data.tenant['id'],
- self.alt_email)
+ user = self.client.create_user(test_user, self.alt_password,
+ self.data.tenant['id'],
+ self.alt_email)
# Delete the User at the end of this method
self.addCleanup(self.client.delete_user, user['id'])
# Updating user details with new values
u_name2 = data_utils.rand_name('user2-')
u_email2 = u_name2 + '@testmail.tm'
- _, update_user = self.client.update_user(user['id'], name=u_name2,
- email=u_email2,
- enabled=False)
+ update_user = self.client.update_user(user['id'], name=u_name2,
+ email=u_email2,
+ enabled=False)
self.assertEqual(u_name2, update_user['name'])
self.assertEqual(u_email2, update_user['email'])
self.assertEqual('false', str(update_user['enabled']).lower())
# GET by id after updating
- _, updated_user = self.client.get_user(user['id'])
+ updated_user = self.client.get_user(user['id'])
# Assert response body of GET after updating
self.assertEqual(u_name2, updated_user['name'])
self.assertEqual(u_email2, updated_user['email'])
@@ -84,9 +84,9 @@
# Delete a user
test_user = data_utils.rand_name('test_user_')
self.data.setup_test_tenant()
- _, user = self.client.create_user(test_user, self.alt_password,
- self.data.tenant['id'],
- self.alt_email)
+ user = self.client.create_user(test_user, self.alt_password,
+ self.data.tenant['id'],
+ self.alt_email)
self.client.delete_user(user['id'])
@test.attr(type='smoke')
@@ -121,7 +121,7 @@
def test_get_users(self):
# Get a list of users and find the test user
self.data.setup_test_user()
- _, users = self.client.get_users()
+ users = self.client.get_users()
self.assertThat([u['name'] for u in users],
matchers.Contains(self.data.test_user),
"Could not find %s" % self.data.test_user)
@@ -133,20 +133,20 @@
user_ids = list()
fetched_user_ids = list()
alt_tenant_user1 = data_utils.rand_name('tenant_user1_')
- _, user1 = self.client.create_user(alt_tenant_user1, 'password1',
- self.data.tenant['id'],
- 'user1@123')
+ user1 = self.client.create_user(alt_tenant_user1, 'password1',
+ self.data.tenant['id'],
+ 'user1@123')
user_ids.append(user1['id'])
self.data.users.append(user1)
alt_tenant_user2 = data_utils.rand_name('tenant_user2_')
- _, user2 = self.client.create_user(alt_tenant_user2, 'password2',
- self.data.tenant['id'],
- 'user2@123')
+ user2 = self.client.create_user(alt_tenant_user2, 'password2',
+ self.data.tenant['id'],
+ 'user2@123')
user_ids.append(user2['id'])
self.data.users.append(user2)
# List of users for the respective tenant ID
- _, body = self.client.list_users_for_tenant(self.data.tenant['id'])
+ body = self.client.list_users_for_tenant(self.data.tenant['id'])
for i in body:
fetched_user_ids.append(i['id'])
# verifying the user Id in the list
@@ -168,20 +168,20 @@
user_ids = list()
fetched_user_ids = list()
user_ids.append(user['id'])
- _, role = self.client.assign_user_role(tenant['id'], user['id'],
- role['id'])
+ role = self.client.assign_user_role(tenant['id'], user['id'],
+ role['id'])
alt_user2 = data_utils.rand_name('second_user_')
- _, second_user = self.client.create_user(alt_user2, 'password1',
- self.data.tenant['id'],
- 'user2@123')
+ second_user = self.client.create_user(alt_user2, 'password1',
+ self.data.tenant['id'],
+ 'user2@123')
user_ids.append(second_user['id'])
self.data.users.append(second_user)
- _, role = self.client.assign_user_role(tenant['id'],
- second_user['id'],
- role['id'])
+ role = self.client.assign_user_role(tenant['id'],
+ second_user['id'],
+ role['id'])
# List of users with roles for the respective tenant ID
- _, body = self.client.list_users_for_tenant(self.data.tenant['id'])
+ body = self.client.list_users_for_tenant(self.data.tenant['id'])
for i in body:
fetched_user_ids.append(i['id'])
# verifying the user Id in the list
@@ -197,12 +197,12 @@
self.data.setup_test_user()
# Updating the user with new password
new_pass = data_utils.rand_name('pass-')
- _, update_user = self.client.update_user_password(
+ update_user = self.client.update_user_password(
self.data.user['id'], new_pass)
self.assertEqual(update_user['id'], self.data.user['id'])
# Validate the updated password
# Get a token
- _, body = self.token_client.auth(self.data.test_user, new_pass,
- self.data.test_tenant)
+ body = self.token_client.auth(self.data.test_user, new_pass,
+ self.data.test_tenant)
self.assertTrue('id' in body['token'])
diff --git a/tempest/api/identity/admin/v3/test_credentials.py b/tempest/api/identity/admin/v3/test_credentials.py
index 9b30166..6f2f6d4 100644
--- a/tempest/api/identity/admin/v3/test_credentials.py
+++ b/tempest/api/identity/admin/v3/test_credentials.py
@@ -32,12 +32,12 @@
u_email = '%s@testmail.tm' % u_name
u_password = data_utils.rand_name('pass-')
for i in range(2):
- _, cls.project = cls.client.create_project(
+ cls.project = cls.client.create_project(
data_utils.rand_name('project-'),
description=data_utils.rand_name('project-desc-'))
cls.projects.append(cls.project['id'])
- _, cls.user_body = cls.client.create_user(
+ cls.user_body = cls.client.create_user(
u_name, description=u_desc, password=u_password,
email=u_email, project_id=cls.projects[0])
@@ -55,7 +55,7 @@
def test_credentials_create_get_update_delete(self):
keys = [data_utils.rand_name('Access-'),
data_utils.rand_name('Secret-')]
- _, cred = self.creds_client.create_credential(
+ cred = self.creds_client.create_credential(
keys[0], keys[1], self.user_body['id'],
self.projects[0])
self.addCleanup(self._delete_credential, cred['id'])
@@ -66,7 +66,7 @@
new_keys = [data_utils.rand_name('NewAccess-'),
data_utils.rand_name('NewSecret-')]
- _, update_body = self.creds_client.update_credential(
+ update_body = self.creds_client.update_credential(
cred['id'], access_key=new_keys[0], secret_key=new_keys[1],
project_id=self.projects[1])
self.assertEqual(cred['id'], update_body['id'])
@@ -75,7 +75,7 @@
self.assertEqual(update_body['blob']['access'], new_keys[0])
self.assertEqual(update_body['blob']['secret'], new_keys[1])
- _, get_body = self.creds_client.get_credential(cred['id'])
+ get_body = self.creds_client.get_credential(cred['id'])
for value1 in self.creds_list[0]:
self.assertEqual(update_body[value1],
get_body[value1])
@@ -89,14 +89,14 @@
fetched_cred_ids = list()
for i in range(2):
- _, cred = self.creds_client.create_credential(
+ cred = self.creds_client.create_credential(
data_utils.rand_name('Access-'),
data_utils.rand_name('Secret-'),
self.user_body['id'], self.projects[0])
created_cred_ids.append(cred['id'])
self.addCleanup(self._delete_credential, cred['id'])
- _, creds = self.creds_client.list_credentials()
+ creds = self.creds_client.list_credentials()
for i in creds:
fetched_cred_ids.append(i['id'])
diff --git a/tempest/api/identity/admin/v3/test_default_project_id.py b/tempest/api/identity/admin/v3/test_default_project_id.py
index 8ffd1ed..bd29cb8 100644
--- a/tempest/api/identity/admin/v3/test_default_project_id.py
+++ b/tempest/api/identity/admin/v3/test_default_project_id.py
@@ -35,13 +35,13 @@
def test_default_project_id(self):
# create a domain
dom_name = data_utils.rand_name('dom')
- _, domain_body = self.client.create_domain(dom_name)
+ domain_body = self.client.create_domain(dom_name)
dom_id = domain_body['id']
self.addCleanup(self._delete_domain, dom_id)
# create a project in the domain
proj_name = data_utils.rand_name('proj')
- _, proj_body = self.client.create_project(proj_name, domain_id=dom_id)
+ proj_body = self.client.create_project(proj_name, domain_id=dom_id)
proj_id = proj_body['id']
self.addCleanup(self.client.delete_project, proj_id)
self.assertEqual(proj_body['domain_id'], dom_id,
@@ -51,9 +51,9 @@
# create a user in the domain, with the previous project as his
# default project
user_name = data_utils.rand_name('user')
- _, user_body = self.client.create_user(user_name, password=user_name,
- domain_id=dom_id,
- default_project_id=proj_id)
+ user_body = self.client.create_user(user_name, password=user_name,
+ domain_id=dom_id,
+ default_project_id=proj_id)
user_id = user_body['id']
self.addCleanup(self.client.delete_user, user_id)
self.assertEqual(user_body['domain_id'], dom_id,
@@ -79,6 +79,6 @@
# verify the user's token and see that it is scoped to the project
token, auth_data = admin_client.auth_provider.get_auth()
- _, result = admin_client.identity_v3_client.get_token(token)
+ result = admin_client.identity_v3_client.get_token(token)
self.assertEqual(result['project']['domain']['id'], dom_id)
self.assertEqual(result['project']['id'], proj_id)
diff --git a/tempest/api/identity/admin/v3/test_domains.py b/tempest/api/identity/admin/v3/test_domains.py
index 286ef97..c1bc705 100644
--- a/tempest/api/identity/admin/v3/test_domains.py
+++ b/tempest/api/identity/admin/v3/test_domains.py
@@ -34,14 +34,14 @@
domain_ids = list()
fetched_ids = list()
for _ in range(3):
- _, domain = self.client.create_domain(
+ domain = self.client.create_domain(
data_utils.rand_name('domain-'),
description=data_utils.rand_name('domain-desc-'))
# Delete the domain at the end of this method
self.addCleanup(self._delete_domain, domain['id'])
domain_ids.append(domain['id'])
# List and Verify Domains
- _, body = self.client.list_domains()
+ body = self.client.list_domains()
for d in body:
fetched_ids.append(d['id'])
missing_doms = [d for d in domain_ids if d not in fetched_ids]
@@ -51,7 +51,7 @@
def test_create_update_delete_domain(self):
d_name = data_utils.rand_name('domain-')
d_desc = data_utils.rand_name('domain-desc-')
- _, domain = self.client.create_domain(
+ domain = self.client.create_domain(
d_name, description=d_desc)
self.addCleanup(self._delete_domain, domain['id'])
self.assertIn('id', domain)
@@ -69,7 +69,7 @@
new_desc = data_utils.rand_name('new-desc-')
new_name = data_utils.rand_name('new-name-')
- _, updated_domain = self.client.update_domain(
+ updated_domain = self.client.update_domain(
domain['id'], name=new_name, description=new_desc)
self.assertIn('id', updated_domain)
self.assertIn('description', updated_domain)
@@ -81,7 +81,7 @@
self.assertEqual(new_desc, updated_domain['description'])
self.assertEqual('true', str(updated_domain['enabled']).lower())
- _, fetched_domain = self.client.get_domain(domain['id'])
+ fetched_domain = self.client.get_domain(domain['id'])
self.assertEqual(new_name, fetched_domain['name'])
self.assertEqual(new_desc, fetched_domain['description'])
self.assertEqual('true', str(fetched_domain['enabled']).lower())
diff --git a/tempest/api/identity/admin/v3/test_endpoints.py b/tempest/api/identity/admin/v3/test_endpoints.py
index 6044d2b..eed0eb5 100644
--- a/tempest/api/identity/admin/v3/test_endpoints.py
+++ b/tempest/api/identity/admin/v3/test_endpoints.py
@@ -30,7 +30,7 @@
s_name = data_utils.rand_name('service-')
s_type = data_utils.rand_name('type--')
s_description = data_utils.rand_name('description-')
- _, cls.service_data =\
+ cls.service_data =\
cls.service_client.create_service(s_name, s_type,
description=s_description)
cls.service_id = cls.service_data['id']
@@ -41,7 +41,7 @@
region = data_utils.rand_name('region')
url = data_utils.rand_url()
interface = 'public'
- resp, endpoint = cls.client.create_endpoint(
+ endpoint = cls.client.create_endpoint(
cls.service_id, interface, url, region=region, enabled=True)
cls.setup_endpoints.append(endpoint)
@@ -56,7 +56,7 @@
@test.attr(type='gate')
def test_list_endpoints(self):
# Get a list of endpoints
- _, fetched_endpoints = self.client.list_endpoints()
+ fetched_endpoints = self.client.list_endpoints()
# Asserting LIST endpoints
missing_endpoints =\
[e for e in self.setup_endpoints if e not in fetched_endpoints]
@@ -69,7 +69,7 @@
region = data_utils.rand_name('region')
url = data_utils.rand_url()
interface = 'public'
- _, endpoint =\
+ endpoint =\
self.client.create_endpoint(self.service_id, interface, url,
region=region, enabled=True)
# Asserting Create Endpoint response body
@@ -77,13 +77,13 @@
self.assertEqual(region, endpoint['region'])
self.assertEqual(url, endpoint['url'])
# Checking if created endpoint is present in the list of endpoints
- resp, fetched_endpoints = self.client.list_endpoints()
+ fetched_endpoints = self.client.list_endpoints()
fetched_endpoints_id = [e['id'] for e in fetched_endpoints]
self.assertIn(endpoint['id'], fetched_endpoints_id)
# Deleting the endpoint created in this method
self.client.delete_endpoint(endpoint['id'])
# Checking whether endpoint is deleted successfully
- resp, fetched_endpoints = self.client.list_endpoints()
+ fetched_endpoints = self.client.list_endpoints()
fetched_endpoints_id = [e['id'] for e in fetched_endpoints]
self.assertNotIn(endpoint['id'], fetched_endpoints_id)
@@ -94,7 +94,7 @@
region1 = data_utils.rand_name('region')
url1 = data_utils.rand_url()
interface1 = 'public'
- resp, endpoint_for_update =\
+ endpoint_for_update =\
self.client.create_endpoint(self.service_id, interface1,
url1, region=region1,
enabled=True)
@@ -103,7 +103,7 @@
s_name = data_utils.rand_name('service-')
s_type = data_utils.rand_name('type--')
s_description = data_utils.rand_name('description-')
- _, service2 =\
+ service2 =\
self.service_client.create_service(s_name, s_type,
description=s_description)
self.service_ids.append(service2['id'])
@@ -111,7 +111,7 @@
region2 = data_utils.rand_name('region')
url2 = data_utils.rand_url()
interface2 = 'internal'
- _, endpoint = \
+ endpoint = \
self.client.update_endpoint(endpoint_for_update['id'],
service_id=service2['id'],
interface=interface2, url=url2,
diff --git a/tempest/api/identity/admin/v3/test_endpoints_negative.py b/tempest/api/identity/admin/v3/test_endpoints_negative.py
index 4308d44..9da0a57 100644
--- a/tempest/api/identity/admin/v3/test_endpoints_negative.py
+++ b/tempest/api/identity/admin/v3/test_endpoints_negative.py
@@ -33,7 +33,7 @@
s_name = data_utils.rand_name('service-')
s_type = data_utils.rand_name('type--')
s_description = data_utils.rand_name('description-')
- _, cls.service_data = (
+ cls.service_data = (
cls.service_client.create_service(s_name, s_type,
description=s_description))
cls.service_id = cls.service_data['id']
@@ -71,7 +71,7 @@
region1 = data_utils.rand_name('region')
url1 = data_utils.rand_url()
interface1 = 'public'
- resp, endpoint_for_update = (
+ endpoint_for_update = (
self.client.create_endpoint(self.service_id, interface1,
url1, region=region1, enabled=True))
self.addCleanup(self.client.delete_endpoint, endpoint_for_update['id'])
diff --git a/tempest/api/identity/admin/v3/test_groups.py b/tempest/api/identity/admin/v3/test_groups.py
index 3f2069d..64dba7d 100644
--- a/tempest/api/identity/admin/v3/test_groups.py
+++ b/tempest/api/identity/admin/v3/test_groups.py
@@ -29,21 +29,21 @@
def test_group_create_update_get(self):
name = data_utils.rand_name('Group')
description = data_utils.rand_name('Description')
- _, group = self.client.create_group(name,
- description=description)
+ group = self.client.create_group(name,
+ description=description)
self.addCleanup(self.client.delete_group, group['id'])
self.assertEqual(group['name'], name)
self.assertEqual(group['description'], description)
new_name = data_utils.rand_name('UpdateGroup')
new_desc = data_utils.rand_name('UpdateDescription')
- _, updated_group = self.client.update_group(group['id'],
- name=new_name,
- description=new_desc)
+ updated_group = self.client.update_group(group['id'],
+ name=new_name,
+ description=new_desc)
self.assertEqual(updated_group['name'], new_name)
self.assertEqual(updated_group['description'], new_desc)
- _, new_group = self.client.get_group(group['id'])
+ new_group = self.client.get_group(group['id'])
self.assertEqual(group['id'], new_group['id'])
self.assertEqual(new_name, new_group['name'])
self.assertEqual(new_desc, new_group['description'])
@@ -51,31 +51,31 @@
@test.attr(type='smoke')
def test_group_users_add_list_delete(self):
name = data_utils.rand_name('Group')
- _, group = self.client.create_group(name)
+ group = self.client.create_group(name)
self.addCleanup(self.client.delete_group, group['id'])
# add user into group
users = []
for i in range(3):
name = data_utils.rand_name('User')
- _, user = self.client.create_user(name)
+ user = self.client.create_user(name)
users.append(user)
self.addCleanup(self.client.delete_user, user['id'])
self.client.add_group_user(group['id'], user['id'])
# list users in group
- _, group_users = self.client.list_group_users(group['id'])
+ group_users = self.client.list_group_users(group['id'])
self.assertEqual(sorted(users), sorted(group_users))
# delete user in group
for user in users:
self.client.delete_group_user(group['id'],
user['id'])
- _, group_users = self.client.list_group_users(group['id'])
+ group_users = self.client.list_group_users(group['id'])
self.assertEqual(len(group_users), 0)
@test.attr(type='smoke')
def test_list_user_groups(self):
# create a user
- _, user = self.client.create_user(
+ user = self.client.create_user(
data_utils.rand_name('User-'),
password=data_utils.rand_name('Pass-'))
self.addCleanup(self.client.delete_user, user['id'])
@@ -83,11 +83,11 @@
groups = []
for i in range(2):
name = data_utils.rand_name('Group-')
- _, group = self.client.create_group(name)
+ group = self.client.create_group(name)
groups.append(group)
self.addCleanup(self.client.delete_group, group['id'])
self.client.add_group_user(group['id'], user['id'])
# list groups which user belongs to
- _, user_groups = self.client.list_user_groups(user['id'])
+ user_groups = self.client.list_user_groups(user['id'])
self.assertEqual(sorted(groups), sorted(user_groups))
self.assertEqual(2, len(user_groups))
diff --git a/tempest/api/identity/admin/v3/test_list_projects.py b/tempest/api/identity/admin/v3/test_list_projects.py
index 2065de3..c0187f9 100644
--- a/tempest/api/identity/admin/v3/test_list_projects.py
+++ b/tempest/api/identity/admin/v3/test_list_projects.py
@@ -28,23 +28,23 @@
cls.data.setup_test_domain()
# Create project with domain
cls.p1_name = data_utils.rand_name('project')
- _, cls.p1 = cls.client.create_project(
+ cls.p1 = cls.client.create_project(
cls.p1_name, enabled=False, domain_id=cls.data.domain['id'])
cls.data.projects.append(cls.p1)
cls.project_ids.append(cls.p1['id'])
# Create default project
p2_name = data_utils.rand_name('project')
- _, cls.p2 = cls.client.create_project(p2_name)
+ cls.p2 = cls.client.create_project(p2_name)
cls.data.projects.append(cls.p2)
cls.project_ids.append(cls.p2['id'])
@test.attr(type='gate')
def test_projects_list(self):
# List projects
- resp, list_projects = self.client.list_projects()
+ list_projects = self.client.list_projects()
for p in self.project_ids:
- _, get_project = self.client.get_project(p)
+ get_project = self.client.get_project(p)
self.assertIn(get_project, list_projects)
@test.attr(type='gate')
@@ -64,6 +64,6 @@
self._list_projects_with_params({'name': self.p1_name}, 'name')
def _list_projects_with_params(self, params, key):
- resp, body = self.client.list_projects(params)
+ body = self.client.list_projects(params)
self.assertIn(self.p1[key], map(lambda x: x[key], body))
self.assertNotIn(self.p2[key], map(lambda x: x[key], body))
diff --git a/tempest/api/identity/admin/v3/test_list_users.py b/tempest/api/identity/admin/v3/test_list_users.py
index 70c8ec6..e728867 100644
--- a/tempest/api/identity/admin/v3/test_list_users.py
+++ b/tempest/api/identity/admin/v3/test_list_users.py
@@ -26,7 +26,7 @@
# assert the response based on expected and not_expected
# expected: user expected in the list response
# not_expected: user, which should not be present in list response
- _, body = self.client.get_users(params)
+ body = self.client.get_users(params)
self.assertIn(expected[key], map(lambda x: x[key], body))
self.assertNotIn(not_expected[key],
map(lambda x: x[key], body))
@@ -40,13 +40,13 @@
cls.data.setup_test_domain()
# Create user with Domain
u1_name = data_utils.rand_name('test_user')
- _, cls.domain_enabled_user = cls.client.create_user(
+ cls.domain_enabled_user = cls.client.create_user(
u1_name, password=alt_password,
email=cls.alt_email, domain_id=cls.data.domain['id'])
cls.data.v3_users.append(cls.domain_enabled_user)
# Create default not enabled user
u2_name = data_utils.rand_name('test_user')
- _, cls.non_domain_enabled_user = cls.client.create_user(
+ cls.non_domain_enabled_user = cls.client.create_user(
u2_name, password=alt_password,
email=cls.alt_email, enabled=False)
cls.data.v3_users.append(cls.non_domain_enabled_user)
@@ -78,7 +78,7 @@
@test.attr(type='gate')
def test_list_users(self):
# List users
- _, body = self.client.get_users()
+ body = self.client.get_users()
fetched_ids = [u['id'] for u in body]
missing_users = [u['id'] for u in self.data.v3_users
if u['id'] not in fetched_ids]
@@ -89,7 +89,7 @@
@test.attr(type='gate')
def test_get_user(self):
# Get a user detail
- _, user = self.client.get_user(self.data.v3_users[0]['id'])
+ user = self.client.get_user(self.data.v3_users[0]['id'])
self.assertEqual(self.data.v3_users[0]['id'], user['id'])
self.assertEqual(self.data.v3_users[0]['name'], user['name'])
self.assertEqual(self.alt_email, user['email'])
diff --git a/tempest/api/identity/admin/v3/test_projects.py b/tempest/api/identity/admin/v3/test_projects.py
index e7fd2b5..2cf6458 100644
--- a/tempest/api/identity/admin/v3/test_projects.py
+++ b/tempest/api/identity/admin/v3/test_projects.py
@@ -26,14 +26,14 @@
# Create project with a description
project_name = data_utils.rand_name('project-')
project_desc = data_utils.rand_name('desc-')
- _, project = self.client.create_project(
+ project = self.client.create_project(
project_name, description=project_desc)
self.data.projects.append(project)
project_id = project['id']
desc1 = project['description']
self.assertEqual(desc1, project_desc, 'Description should have '
'been sent in response for create')
- _, body = self.client.get_project(project_id)
+ body = self.client.get_project(project_id)
desc2 = body['description']
self.assertEqual(desc2, project_desc, 'Description does not appear'
'to be set')
@@ -43,13 +43,13 @@
# Create project with a domain
self.data.setup_test_domain()
project_name = data_utils.rand_name('project')
- resp, project = self.client.create_project(
+ project = self.client.create_project(
project_name, domain_id=self.data.domain['id'])
self.data.projects.append(project)
project_id = project['id']
self.assertEqual(project_name, project['name'])
self.assertEqual(self.data.domain['id'], project['domain_id'])
- _, body = self.client.get_project(project_id)
+ body = self.client.get_project(project_id)
self.assertEqual(project_name, body['name'])
self.assertEqual(self.data.domain['id'], body['domain_id'])
@@ -57,13 +57,13 @@
def test_project_create_enabled(self):
# Create a project that is enabled
project_name = data_utils.rand_name('project-')
- _, project = self.client.create_project(
+ project = self.client.create_project(
project_name, enabled=True)
self.data.projects.append(project)
project_id = project['id']
en1 = project['enabled']
self.assertTrue(en1, 'Enable should be True in response')
- _, body = self.client.get_project(project_id)
+ body = self.client.get_project(project_id)
en2 = body['enabled']
self.assertTrue(en2, 'Enable should be True in lookup')
@@ -71,13 +71,13 @@
def test_project_create_not_enabled(self):
# Create a project that is not enabled
project_name = data_utils.rand_name('project-')
- _, project = self.client.create_project(
+ project = self.client.create_project(
project_name, enabled=False)
self.data.projects.append(project)
en1 = project['enabled']
self.assertEqual('false', str(en1).lower(),
'Enable should be False in response')
- _, body = self.client.get_project(project['id'])
+ body = self.client.get_project(project['id'])
en2 = body['enabled']
self.assertEqual('false', str(en2).lower(),
'Enable should be False in lookup')
@@ -86,17 +86,17 @@
def test_project_update_name(self):
# Update name attribute of a project
p_name1 = data_utils.rand_name('project-')
- _, project = self.client.create_project(p_name1)
+ project = self.client.create_project(p_name1)
self.data.projects.append(project)
resp1_name = project['name']
p_name2 = data_utils.rand_name('project2-')
- _, body = self.client.update_project(project['id'], name=p_name2)
+ body = self.client.update_project(project['id'], name=p_name2)
resp2_name = body['name']
self.assertNotEqual(resp1_name, resp2_name)
- _, body = self.client.get_project(project['id'])
+ body = self.client.get_project(project['id'])
resp3_name = body['name']
self.assertNotEqual(resp1_name, resp3_name)
@@ -108,18 +108,18 @@
# Update description attribute of a project
p_name = data_utils.rand_name('project-')
p_desc = data_utils.rand_name('desc-')
- _, project = self.client.create_project(
+ project = self.client.create_project(
p_name, description=p_desc)
self.data.projects.append(project)
resp1_desc = project['description']
p_desc2 = data_utils.rand_name('desc2-')
- _, body = self.client.update_project(
+ body = self.client.update_project(
project['id'], description=p_desc2)
resp2_desc = body['description']
self.assertNotEqual(resp1_desc, resp2_desc)
- _, body = self.client.get_project(project['id'])
+ body = self.client.get_project(project['id'])
resp3_desc = body['description']
self.assertNotEqual(resp1_desc, resp3_desc)
@@ -131,18 +131,18 @@
# Update the enabled attribute of a project
p_name = data_utils.rand_name('project-')
p_en = False
- _, project = self.client.create_project(p_name, enabled=p_en)
+ project = self.client.create_project(p_name, enabled=p_en)
self.data.projects.append(project)
resp1_en = project['enabled']
p_en2 = True
- _, body = self.client.update_project(
+ body = self.client.update_project(
project['id'], enabled=p_en2)
resp2_en = body['enabled']
self.assertNotEqual(resp1_en, resp2_en)
- _, body = self.client.get_project(project['id'])
+ body = self.client.get_project(project['id'])
resp3_en = body['enabled']
self.assertNotEqual(resp1_en, resp3_en)
@@ -154,7 +154,7 @@
# Associate a user to a project
# Create a Project
p_name = data_utils.rand_name('project-')
- _, project = self.client.create_project(p_name)
+ project = self.client.create_project(p_name)
self.data.projects.append(project)
# Create a User
@@ -162,14 +162,14 @@
u_desc = u_name + 'description'
u_email = u_name + '@testmail.tm'
u_password = data_utils.rand_name('pass-')
- _, user = self.client.create_user(
+ user = self.client.create_user(
u_name, description=u_desc, password=u_password,
email=u_email, project_id=project['id'])
# Delete the User at the end of this method
self.addCleanup(self.client.delete_user, user['id'])
# Get User To validate the user details
- _, new_user_get = self.client.get_user(user['id'])
+ new_user_get = self.client.get_user(user['id'])
# Assert response body of GET
self.assertEqual(u_name, new_user_get['name'])
self.assertEqual(u_desc, new_user_get['description'])
diff --git a/tempest/api/identity/admin/v3/test_projects_negative.py b/tempest/api/identity/admin/v3/test_projects_negative.py
index da35ace..f5e832b 100644
--- a/tempest/api/identity/admin/v3/test_projects_negative.py
+++ b/tempest/api/identity/admin/v3/test_projects_negative.py
@@ -32,7 +32,7 @@
def test_project_create_duplicate(self):
# Project names should be unique
project_name = data_utils.rand_name('project-dup-')
- _, project = self.client.create_project(project_name)
+ project = self.client.create_project(project_name)
self.data.projects.append(project)
self.assertRaises(
@@ -63,7 +63,7 @@
def test_project_delete_by_unauthorized_user(self):
# Non-admin user should not be able to delete a project
project_name = data_utils.rand_name('project-')
- _, project = self.client.create_project(project_name)
+ project = self.client.create_project(project_name)
self.data.projects.append(project)
self.assertRaises(
exceptions.Unauthorized, self.non_admin_client.delete_project,
diff --git a/tempest/api/identity/admin/v3/test_regions.py b/tempest/api/identity/admin/v3/test_regions.py
index 4305060..c71cbf3 100644
--- a/tempest/api/identity/admin/v3/test_regions.py
+++ b/tempest/api/identity/admin/v3/test_regions.py
@@ -29,7 +29,7 @@
cls.client = cls.region_client
for i in range(2):
r_description = data_utils.rand_name('description-')
- _, region = cls.client.create_region(r_description)
+ region = cls.client.create_region(r_description)
cls.setup_regions.append(region)
@classmethod
@@ -46,7 +46,7 @@
@test.attr(type='gate')
def test_create_update_get_delete_region(self):
r_description = data_utils.rand_name('description-')
- _, region = self.client.create_region(
+ region = self.client.create_region(
r_description, parent_region_id=self.setup_regions[0]['id'])
self.addCleanup(self._delete_region, region['id'])
self.assertEqual(r_description, region['description'])
@@ -54,7 +54,7 @@
region['parent_region_id'])
# Update region with new description and parent ID
r_alt_description = data_utils.rand_name('description-')
- _, region = self.client.update_region(
+ region = self.client.update_region(
region['id'],
description=r_alt_description,
parent_region_id=self.setup_regions[1]['id'])
@@ -62,7 +62,7 @@
self.assertEqual(self.setup_regions[1]['id'],
region['parent_region_id'])
# Get the details of region
- _, region = self.client.get_region(region['id'])
+ region = self.client.get_region(region['id'])
self.assertEqual(r_alt_description, region['description'])
self.assertEqual(self.setup_regions[1]['id'],
region['parent_region_id'])
@@ -72,7 +72,7 @@
# Create a region with a specific id
r_region_id = data_utils.rand_uuid()
r_description = data_utils.rand_name('description-')
- _, region = self.client.create_region(
+ region = self.client.create_region(
r_description, unique_region_id=r_region_id)
self.addCleanup(self._delete_region, region['id'])
# Asserting Create Region with specific id response body
@@ -82,7 +82,7 @@
@test.attr(type='gate')
def test_list_regions(self):
# Get a list of regions
- _, fetched_regions = self.client.list_regions()
+ fetched_regions = self.client.list_regions()
missing_regions =\
[e for e in self.setup_regions if e not in fetched_regions]
# Asserting List Regions response
diff --git a/tempest/api/identity/admin/v3/test_roles.py b/tempest/api/identity/admin/v3/test_roles.py
index 3c0a180..b8b309d 100644
--- a/tempest/api/identity/admin/v3/test_roles.py
+++ b/tempest/api/identity/admin/v3/test_roles.py
@@ -26,28 +26,28 @@
super(RolesV3TestJSON, cls).resource_setup()
for _ in range(3):
role_name = data_utils.rand_name(name='role-')
- _, role = cls.client.create_role(role_name)
+ role = cls.client.create_role(role_name)
cls.data.v3_roles.append(role)
cls.fetched_role_ids = list()
u_name = data_utils.rand_name('user-')
u_desc = '%s description' % u_name
u_email = '%s@testmail.tm' % u_name
cls.u_password = data_utils.rand_name('pass-')
- _, cls.domain = cls.client.create_domain(
+ cls.domain = cls.client.create_domain(
data_utils.rand_name('domain-'),
description=data_utils.rand_name('domain-desc-'))
- _, cls.project = cls.client.create_project(
+ cls.project = cls.client.create_project(
data_utils.rand_name('project-'),
description=data_utils.rand_name('project-desc-'),
domain_id=cls.domain['id'])
- _, cls.group_body = cls.client.create_group(
+ cls.group_body = cls.client.create_group(
data_utils.rand_name('Group-'), project_id=cls.project['id'],
domain_id=cls.domain['id'])
- _, cls.user_body = cls.client.create_user(
+ cls.user_body = cls.client.create_user(
u_name, description=u_desc, password=cls.u_password,
email=u_email, project_id=cls.project['id'],
domain_id=cls.domain['id'])
- _, cls.role = cls.client.create_role(
+ cls.role = cls.client.create_role(
data_utils.rand_name('Role-'))
@classmethod
@@ -69,23 +69,23 @@
@test.attr(type='smoke')
def test_role_create_update_get_list(self):
r_name = data_utils.rand_name('Role-')
- _, role = self.client.create_role(r_name)
+ role = self.client.create_role(r_name)
self.addCleanup(self.client.delete_role, role['id'])
self.assertIn('name', role)
self.assertEqual(role['name'], r_name)
new_name = data_utils.rand_name('NewRole-')
- _, updated_role = self.client.update_role(new_name, role['id'])
+ updated_role = self.client.update_role(new_name, role['id'])
self.assertIn('name', updated_role)
self.assertIn('id', updated_role)
self.assertIn('links', updated_role)
self.assertNotEqual(r_name, updated_role['name'])
- _, new_role = self.client.get_role(role['id'])
+ new_role = self.client.get_role(role['id'])
self.assertEqual(new_name, new_role['name'])
self.assertEqual(updated_role['id'], new_role['id'])
- _, roles = self.client.list_roles()
+ roles = self.client.list_roles()
self.assertIn(role['id'], [r['id'] for r in roles])
@test.attr(type='smoke')
@@ -93,7 +93,7 @@
self.client.assign_user_role_on_project(
self.project['id'], self.user_body['id'], self.role['id'])
- _, roles = self.client.list_user_roles_on_project(
+ roles = self.client.list_user_roles_on_project(
self.project['id'], self.user_body['id'])
for i in roles:
@@ -110,7 +110,7 @@
self.client.assign_user_role_on_domain(
self.domain['id'], self.user_body['id'], self.role['id'])
- _, roles = self.client.list_user_roles_on_domain(
+ roles = self.client.list_user_roles_on_domain(
self.domain['id'], self.user_body['id'])
for i in roles:
@@ -128,7 +128,7 @@
self.client.assign_group_role_on_project(
self.project['id'], self.group_body['id'], self.role['id'])
# List group roles on project
- _, roles = self.client.list_group_roles_on_project(
+ roles = self.client.list_group_roles_on_project(
self.project['id'], self.group_body['id'])
for i in roles:
@@ -140,9 +140,9 @@
self.client.add_group_user(self.group_body['id'], self.user_body['id'])
self.addCleanup(self.client.delete_group_user,
self.group_body['id'], self.user_body['id'])
- _, body = self.token.auth(self.user_body['id'], self.u_password,
- self.project['name'],
- domain=self.domain['name'])
+ body = self.token.auth(self.user_body['id'], self.u_password,
+ self.project['name'],
+ domain=self.domain['name'])
roles = body['token']['roles']
self.assertEqual(len(roles), 1)
self.assertEqual(roles[0]['id'], self.role['id'])
@@ -155,7 +155,7 @@
self.client.assign_group_role_on_domain(
self.domain['id'], self.group_body['id'], self.role['id'])
- _, roles = self.client.list_group_roles_on_domain(
+ roles = self.client.list_group_roles_on_domain(
self.domain['id'], self.group_body['id'])
for i in roles:
@@ -170,6 +170,6 @@
@test.attr(type='gate')
def test_list_roles(self):
# Return a list of all roles
- _, body = self.client.list_roles()
+ body = self.client.list_roles()
found = [role for role in body if role in self.data.v3_roles]
self.assertEqual(len(found), len(self.data.v3_roles))
diff --git a/tempest/api/identity/admin/v3/test_services.py b/tempest/api/identity/admin/v3/test_services.py
index a871f17..9e45b50 100644
--- a/tempest/api/identity/admin/v3/test_services.py
+++ b/tempest/api/identity/admin/v3/test_services.py
@@ -35,7 +35,7 @@
name = data_utils.rand_name('service')
serv_type = data_utils.rand_name('type')
desc = data_utils.rand_name('description')
- _, create_service = self.service_client.create_service(
+ create_service = self.service_client.create_service(
serv_type, name=name, description=desc)
self.addCleanup(self._del_service, create_service['id'])
self.assertIsNotNone(create_service['id'])
@@ -48,14 +48,14 @@
s_id = create_service['id']
resp1_desc = create_service['description']
s_desc2 = data_utils.rand_name('desc2')
- _, update_service = self.service_client.update_service(
+ update_service = self.service_client.update_service(
s_id, description=s_desc2)
resp2_desc = update_service['description']
self.assertNotEqual(resp1_desc, resp2_desc)
# Get service
- _, fetched_service = self.service_client.get_service(s_id)
+ fetched_service = self.service_client.get_service(s_id)
resp3_desc = fetched_service['description']
self.assertEqual(resp2_desc, resp3_desc)
@@ -66,7 +66,7 @@
# Create a service only with name and type
name = data_utils.rand_name('service')
serv_type = data_utils.rand_name('type')
- _, service = self.service_client.create_service(
+ service = self.service_client.create_service(
serv_type, name=name)
self.addCleanup(self.service_client.delete_service, service['id'])
self.assertIn('id', service)
@@ -80,14 +80,14 @@
for _ in range(3):
name = data_utils.rand_name('service')
serv_type = data_utils.rand_name('type')
- _, create_service = self.service_client.create_service(
+ create_service = self.service_client.create_service(
serv_type, name=name)
self.addCleanup(self.service_client.delete_service,
create_service['id'])
service_ids.append(create_service['id'])
# List and Verify Services
- _, services = self.service_client.list_services()
+ services = self.service_client.list_services()
fetched_ids = [service['id'] for service in services]
found = [s for s in fetched_ids if s in service_ids]
self.assertEqual(len(found), len(service_ids))
diff --git a/tempest/api/identity/admin/v3/test_tokens.py b/tempest/api/identity/admin/v3/test_tokens.py
index aef8239..f0acfdf 100644
--- a/tempest/api/identity/admin/v3/test_tokens.py
+++ b/tempest/api/identity/admin/v3/test_tokens.py
@@ -30,15 +30,15 @@
u_desc = '%s-description' % u_name
u_email = '%s@testmail.tm' % u_name
u_password = data_utils.rand_name('pass-')
- _, user = self.client.create_user(
+ user = self.client.create_user(
u_name, description=u_desc, password=u_password,
email=u_email)
self.addCleanup(self.client.delete_user, user['id'])
# Perform Authentication
- resp, _ = self.token.auth(user['id'], u_password)
+ resp = self.token.auth(user['id'], u_password).response
subject_token = resp['x-subject-token']
# Perform GET Token
- _, token_details = self.client.get_token(subject_token)
+ token_details = self.client.get_token(subject_token)
self.assertEqual(resp['x-subject-token'], subject_token)
self.assertEqual(token_details['user']['id'], user['id'])
self.assertEqual(token_details['user']['name'], u_name)
@@ -60,21 +60,21 @@
# Create a user.
user_name = data_utils.rand_name(name='user-')
user_password = data_utils.rand_name(name='pass-')
- _, user = self.client.create_user(user_name, password=user_password)
+ user = self.client.create_user(user_name, password=user_password)
self.addCleanup(self.client.delete_user, user['id'])
# Create a couple projects
project1_name = data_utils.rand_name(name='project-')
- _, project1 = self.client.create_project(project1_name)
+ project1 = self.client.create_project(project1_name)
self.addCleanup(self.client.delete_project, project1['id'])
project2_name = data_utils.rand_name(name='project-')
- _, project2 = self.client.create_project(project2_name)
+ project2 = self.client.create_project(project2_name)
self.addCleanup(self.client.delete_project, project2['id'])
# Create a role
role_name = data_utils.rand_name(name='role-')
- _, role = self.client.create_role(role_name)
+ role = self.client.create_role(role_name)
self.addCleanup(self.client.delete_role, role['id'])
# Grant the user the role on both projects.
@@ -85,10 +85,10 @@
role['id'])
# Get an unscoped token.
- resp, token_auth = self.token.auth(user=user['id'],
- password=user_password)
+ token_auth = self.token.auth(user=user['id'],
+ password=user_password)
- token_id = resp['x-subject-token']
+ token_id = token_auth.response['x-subject-token']
orig_expires_at = token_auth['token']['expires_at']
orig_issued_at = token_auth['token']['issued_at']
orig_user = token_auth['token']['user']
@@ -107,10 +107,10 @@
self.assertNotIn('roles', token_auth['token'])
# Use the unscoped token to get a scoped token.
- resp, token_auth = self.token.auth(token=token_id,
- tenant=project1_name,
- domain='Default')
- token1_id = resp['x-subject-token']
+ token_auth = self.token.auth(token=token_id,
+ tenant=project1_name,
+ domain='Default')
+ token1_id = token_auth.response['x-subject-token']
self.assertEqual(orig_expires_at, token_auth['token']['expires_at'],
'Expiration time should match original token')
@@ -137,9 +137,9 @@
self.client.delete_token(token1_id)
# Now get another scoped token using the unscoped token.
- _, token_auth = self.token.auth(token=token_id,
- tenant=project2_name,
- domain='Default')
+ token_auth = self.token.auth(token=token_id,
+ tenant=project2_name,
+ domain='Default')
self.assertEqual(project2['id'],
token_auth['token']['project']['id'])
diff --git a/tempest/api/identity/admin/v3/test_trusts.py b/tempest/api/identity/admin/v3/test_trusts.py
index 886c808..cd28e96 100644
--- a/tempest/api/identity/admin/v3/test_trusts.py
+++ b/tempest/api/identity/admin/v3/test_trusts.py
@@ -55,7 +55,7 @@
u_desc = self.trustor_username + 'description'
u_email = self.trustor_username + '@testmail.xx'
self.trustor_password = data_utils.rand_name('pass-')
- _, user = self.client.create_user(
+ user = self.client.create_user(
self.trustor_username,
description=u_desc,
password=self.trustor_password,
@@ -67,10 +67,10 @@
self.delegated_role = data_utils.rand_name('DelegatedRole-')
self.not_delegated_role = data_utils.rand_name('NotDelegatedRole-')
- _, role = self.client.create_role(self.delegated_role)
+ role = self.client.create_role(self.delegated_role)
self.delegated_role_id = role['id']
- _, role = self.client.create_role(self.not_delegated_role)
+ role = self.client.create_role(self.not_delegated_role)
self.not_delegated_role_id = role['id']
# Assign roles to trustor
@@ -106,7 +106,7 @@
def create_trust(self, impersonate=True, expires=None):
- _, trust_create = self.trustor_client.create_trust(
+ trust_create = self.trustor_client.create_trust(
trustor_user_id=self.trustor_user_id,
trustee_user_id=self.trustee_user_id,
project_id=self.trustor_project_id,
@@ -138,7 +138,7 @@
self.assertEqual(1, len(trust['roles']))
def get_trust(self):
- _, trust_get = self.trustor_client.get_trust(self.trust_id)
+ trust_get = self.trustor_client.get_trust(self.trust_id)
return trust_get
def validate_role(self, role):
@@ -153,16 +153,16 @@
def check_trust_roles(self):
# Check we find the delegated role
- _, roles_get = self.trustor_client.get_trust_roles(
+ roles_get = self.trustor_client.get_trust_roles(
self.trust_id)
self.assertEqual(1, len(roles_get))
self.validate_role(roles_get[0])
- _, role_get = self.trustor_client.get_trust_role(
+ role_get = self.trustor_client.get_trust_role(
self.trust_id, self.delegated_role_id)
self.validate_role(role_get)
- _, role_get = self.trustor_client.check_trust_role(
+ role_get = self.trustor_client.check_trust_role(
self.trust_id, self.delegated_role_id)
# And that we don't find not_delegated_role
@@ -245,7 +245,7 @@
@test.attr(type='smoke')
def test_get_trusts_query(self):
self.create_trust()
- _, trusts_get = self.trustor_client.get_trusts(
+ trusts_get = self.trustor_client.get_trusts(
trustor_user_id=self.trustor_user_id)
self.assertEqual(1, len(trusts_get))
self.validate_trust(trusts_get[0], summary=True)
@@ -253,7 +253,7 @@
@test.attr(type='smoke')
def test_get_trusts_all(self):
self.create_trust()
- _, trusts_get = self.client.get_trusts()
+ trusts_get = self.client.get_trusts()
trusts = [t for t in trusts_get
if t['id'] == self.trust_id]
self.assertEqual(1, len(trusts))
diff --git a/tempest/api/identity/admin/v3/test_users.py b/tempest/api/identity/admin/v3/test_users.py
index 1b003c3..4f3ec05 100644
--- a/tempest/api/identity/admin/v3/test_users.py
+++ b/tempest/api/identity/admin/v3/test_users.py
@@ -29,13 +29,13 @@
u_desc = u_name + 'description'
u_email = u_name + '@testmail.tm'
u_password = data_utils.rand_name('pass-')
- _, user = self.client.create_user(
+ user = self.client.create_user(
u_name, description=u_desc, password=u_password,
email=u_email, enabled=False)
# Delete the User at the end of this method
self.addCleanup(self.client.delete_user, user['id'])
# Creating second project for updation
- _, project = self.client.create_project(
+ project = self.client.create_project(
data_utils.rand_name('project-'),
description=data_utils.rand_name('project-desc-'))
# Delete the Project at the end of this method
@@ -44,7 +44,7 @@
u_name2 = data_utils.rand_name('user2-')
u_email2 = u_name2 + '@testmail.tm'
u_description2 = u_name2 + ' description'
- _, update_user = self.client.update_user(
+ update_user = self.client.update_user(
user['id'], name=u_name2, description=u_description2,
project_id=project['id'],
email=u_email2, enabled=False)
@@ -55,7 +55,7 @@
self.assertEqual(u_email2, update_user['email'])
self.assertEqual('false', str(update_user['enabled']).lower())
# GET by id after updation
- _, new_user_get = self.client.get_user(user['id'])
+ new_user_get = self.client.get_user(user['id'])
# Assert response body of GET after updation
self.assertEqual(u_name2, new_user_get['name'])
self.assertEqual(u_description2, new_user_get['description'])
@@ -69,7 +69,7 @@
# Creating User to check password updation
u_name = data_utils.rand_name('user')
original_password = data_utils.rand_name('pass')
- _, user = self.client.create_user(
+ user = self.client.create_user(
u_name, password=original_password)
# Delete the User at the end all test methods
self.addCleanup(self.client.delete_user, user['id'])
@@ -77,10 +77,10 @@
new_password = data_utils.rand_name('pass1')
self.client.update_user_password(user['id'], new_password,
original_password)
- resp, _ = self.token.auth(user['id'], new_password)
+ resp = self.token.auth(user['id'], new_password).response
subject_token = resp['x-subject-token']
# Perform GET Token to verify and confirm password is updated
- _, token_details = self.client.get_token(subject_token)
+ token_details = self.client.get_token(subject_token)
self.assertEqual(resp['x-subject-token'], subject_token)
self.assertEqual(token_details['user']['id'], user['id'])
self.assertEqual(token_details['user']['name'], u_name)
@@ -90,7 +90,7 @@
# List the projects that a user has access upon
assigned_project_ids = list()
fetched_project_ids = list()
- _, u_project = self.client.create_project(
+ u_project = self.client.create_project(
data_utils.rand_name('project-'),
description=data_utils.rand_name('project-desc-'))
# Delete the Project at the end of this method
@@ -100,25 +100,25 @@
u_desc = u_name + 'description'
u_email = u_name + '@testmail.tm'
u_password = data_utils.rand_name('pass-')
- _, user_body = self.client.create_user(
+ user_body = self.client.create_user(
u_name, description=u_desc, password=u_password,
email=u_email, enabled=False, project_id=u_project['id'])
# Delete the User at the end of this method
self.addCleanup(self.client.delete_user, user_body['id'])
# Creating Role
- _, role_body = self.client.create_role(
+ role_body = self.client.create_role(
data_utils.rand_name('role-'))
# Delete the Role at the end of this method
self.addCleanup(self.client.delete_role, role_body['id'])
- _, user = self.client.get_user(user_body['id'])
- _, role = self.client.get_role(role_body['id'])
+ user = self.client.get_user(user_body['id'])
+ role = self.client.get_role(role_body['id'])
for i in range(2):
# Creating project so as to assign role
- _, project_body = self.client.create_project(
+ project_body = self.client.create_project(
data_utils.rand_name('project-'),
description=data_utils.rand_name('project-desc-'))
- _, project = self.client.get_project(project_body['id'])
+ project = self.client.get_project(project_body['id'])
# Delete the Project at the end of this method
self.addCleanup(self.client.delete_project, project_body['id'])
# Assigning roles to user on project
@@ -126,7 +126,7 @@
user['id'],
role['id'])
assigned_project_ids.append(project['id'])
- _, body = self.client.list_user_projects(user['id'])
+ body = self.client.list_user_projects(user['id'])
for i in body:
fetched_project_ids.append(i['id'])
# verifying the project ids in list
@@ -142,5 +142,5 @@
def test_get_user(self):
# Get a user detail
self.data.setup_test_v3_user()
- _, user = self.client.get_user(self.data.v3_user['id'])
+ user = self.client.get_user(self.data.v3_user['id'])
self.assertEqual(self.data.v3_user['id'], user['id'])
diff --git a/tempest/api/identity/base.py b/tempest/api/identity/base.py
index 1e4973b..08bfd4f 100644
--- a/tempest/api/identity/base.py
+++ b/tempest/api/identity/base.py
@@ -46,7 +46,7 @@
@classmethod
def get_user_by_name(cls, name):
- _, users = cls.client.get_users()
+ users = cls.client.get_users()
user = [u for u in users if u['name'] == name]
if len(user) > 0:
return user[0]
@@ -54,16 +54,16 @@
@classmethod
def get_tenant_by_name(cls, name):
try:
- _, tenants = cls.client.list_tenants()
+ tenants = cls.client.list_tenants()
except AttributeError:
- _, tenants = cls.client.list_projects()
+ tenants = cls.client.list_projects()
tenant = [t for t in tenants if t['name'] == name]
if len(tenant) > 0:
return tenant[0]
@classmethod
def get_role_by_name(cls, name):
- _, roles = cls.client.list_roles()
+ roles = cls.client.list_roles()
role = [r for r in roles if r['name'] == name]
if len(role) > 0:
return role[0]
@@ -112,6 +112,27 @@
cls.data.teardown_all()
super(BaseIdentityV3AdminTest, cls).resource_cleanup()
+ @classmethod
+ def get_user_by_name(cls, name):
+ users = cls.client.get_users()
+ user = [u for u in users if u['name'] == name]
+ if len(user) > 0:
+ return user[0]
+
+ @classmethod
+ def get_tenant_by_name(cls, name):
+ tenants = cls.client.list_projects()
+ tenant = [t for t in tenants if t['name'] == name]
+ if len(tenant) > 0:
+ return tenant[0]
+
+ @classmethod
+ def get_role_by_name(cls, name):
+ roles = cls.client.list_roles()
+ role = [r for r in roles if r['name'] == name]
+ if len(role) > 0:
+ return role[0]
+
class DataGenerator(object):
@@ -140,17 +161,17 @@
self.test_user = data_utils.rand_name('test_user_')
self.test_password = data_utils.rand_name('pass_')
self.test_email = self.test_user + '@testmail.tm'
- _, self.user = self.client.create_user(self.test_user,
- self.test_password,
- self.tenant['id'],
- self.test_email)
+ self.user = self.client.create_user(self.test_user,
+ self.test_password,
+ self.tenant['id'],
+ self.test_email)
self.users.append(self.user)
def setup_test_tenant(self):
"""Set up a test tenant."""
self.test_tenant = data_utils.rand_name('test_tenant_')
self.test_description = data_utils.rand_name('desc_')
- _, self.tenant = self.client.create_tenant(
+ self.tenant = self.client.create_tenant(
name=self.test_tenant,
description=self.test_description)
self.tenants.append(self.tenant)
@@ -158,7 +179,7 @@
def setup_test_role(self):
"""Set up a test role."""
self.test_role = data_utils.rand_name('role')
- _, self.role = self.client.create_role(self.test_role)
+ self.role = self.client.create_role(self.test_role)
self.roles.append(self.role)
def setup_test_v3_user(self):
@@ -167,7 +188,7 @@
self.test_user = data_utils.rand_name('test_user_')
self.test_password = data_utils.rand_name('pass_')
self.test_email = self.test_user + '@testmail.tm'
- _, self.v3_user = self.client.create_user(
+ self.v3_user = self.client.create_user(
self.test_user,
password=self.test_password,
project_id=self.project['id'],
@@ -178,7 +199,7 @@
"""Set up a test project."""
self.test_project = data_utils.rand_name('test_project_')
self.test_description = data_utils.rand_name('desc_')
- _, self.project = self.client.create_project(
+ self.project = self.client.create_project(
name=self.test_project,
description=self.test_description)
self.projects.append(self.project)
@@ -186,14 +207,14 @@
def setup_test_v3_role(self):
"""Set up a test v3 role."""
self.test_role = data_utils.rand_name('role')
- _, self.v3_role = self.client.create_role(self.test_role)
+ self.v3_role = self.client.create_role(self.test_role)
self.v3_roles.append(self.v3_role)
def setup_test_domain(self):
"""Set up a test domain."""
self.test_domain = data_utils.rand_name('test_domain')
self.test_description = data_utils.rand_name('desc')
- _, self.domain = self.client.create_domain(
+ self.domain = self.client.create_domain(
name=self.test_domain,
description=self.test_description)
self.domains.append(self.domain)
diff --git a/tempest/api/identity/test_extension.py b/tempest/api/identity/test_extension.py
index 829628a..e3badfc 100644
--- a/tempest/api/identity/test_extension.py
+++ b/tempest/api/identity/test_extension.py
@@ -23,7 +23,7 @@
@test.attr(type='gate')
def test_list_extensions(self):
# List all the extensions
- _, body = self.non_admin_client.list_extensions()
+ body = self.non_admin_client.list_extensions()
self.assertNotEmpty(body)
keys = ['name', 'updated', 'alias', 'links',
'namespace', 'description']
diff --git a/tempest/api/image/base.py b/tempest/api/image/base.py
index 76b6f17..12f3fdd 100644
--- a/tempest/api/image/base.py
+++ b/tempest/api/image/base.py
@@ -67,10 +67,10 @@
container_format = kwargs.pop('container_format')
disk_format = kwargs.pop('disk_format')
- resp, image = cls.client.create_image(name, container_format,
- disk_format, **kwargs)
+ image = cls.client.create_image(name, container_format,
+ disk_format, **kwargs)
cls.created_images.append(image['id'])
- return resp, image
+ return image
class BaseV1ImageTest(BaseImageTest):
@@ -95,11 +95,10 @@
def _create_image(self):
image_file = StringIO.StringIO(data_utils.random_bytes())
- resp, image = self.create_image(container_format='bare',
- disk_format='raw',
- is_public=False,
- data=image_file)
- self.assertEqual(201, resp.status)
+ image = self.create_image(container_format='bare',
+ disk_format='raw',
+ is_public=False,
+ data=image_file)
image_id = image['id']
return image_id
@@ -127,15 +126,15 @@
cls.alt_tenant_id = cls.alt_img_client.tenant_id
def _list_image_ids_as_alt(self):
- _, image_list = self.alt_img_client.image_list()
+ image_list = self.alt_img_client.image_list()
image_ids = map(lambda x: x['id'], image_list)
return image_ids
def _create_image(self):
name = data_utils.rand_name('image')
- _, image = self.os_img_client.create_image(name,
- container_format='bare',
- disk_format='raw')
+ image = self.os_img_client.create_image(name,
+ container_format='bare',
+ disk_format='raw')
image_id = image['id']
self.addCleanup(self.os_img_client.delete_image, image_id)
return image_id
diff --git a/tempest/api/image/v1/test_image_members.py b/tempest/api/image/v1/test_image_members.py
index f91cb69..d18a274 100644
--- a/tempest/api/image/v1/test_image_members.py
+++ b/tempest/api/image/v1/test_image_members.py
@@ -23,7 +23,7 @@
def test_add_image_member(self):
image = self._create_image()
self.client.add_member(self.alt_tenant_id, image)
- _, body = self.client.get_image_membership(image)
+ body = self.client.get_image_membership(image)
members = body['members']
members = map(lambda x: x['member_id'], members)
self.assertIn(self.alt_tenant_id, members)
@@ -36,7 +36,7 @@
self.client.add_member(self.alt_tenant_id, image)
share_image = self._create_image()
self.client.add_member(self.alt_tenant_id, share_image)
- _, body = self.client.get_shared_images(self.alt_tenant_id)
+ body = self.client.get_shared_images(self.alt_tenant_id)
images = body['shared_images']
images = map(lambda x: x['image_id'], images)
self.assertIn(share_image, images)
@@ -47,6 +47,6 @@
image_id = self._create_image()
self.client.add_member(self.alt_tenant_id, image_id)
self.client.delete_member(self.alt_tenant_id, image_id)
- _, body = self.client.get_image_membership(image_id)
+ body = self.client.get_image_membership(image_id)
members = body['members']
self.assertEqual(0, len(members), str(members))
diff --git a/tempest/api/image/v1/test_images.py b/tempest/api/image/v1/test_images.py
index bc45da5..b9f12e6 100644
--- a/tempest/api/image/v1/test_images.py
+++ b/tempest/api/image/v1/test_images.py
@@ -30,11 +30,11 @@
def test_register_then_upload(self):
# Register, then upload an image
properties = {'prop1': 'val1'}
- _, body = self.create_image(name='New Name',
- container_format='bare',
- disk_format='raw',
- is_public=False,
- properties=properties)
+ body = self.create_image(name='New Name',
+ container_format='bare',
+ disk_format='raw',
+ is_public=False,
+ properties=properties)
self.assertIn('id', body)
image_id = body.get('id')
self.assertEqual('New Name', body.get('name'))
@@ -45,19 +45,19 @@
# Now try uploading an image file
image_file = StringIO.StringIO(data_utils.random_bytes())
- _, body = self.client.update_image(image_id, data=image_file)
+ body = self.client.update_image(image_id, data=image_file)
self.assertIn('size', body)
self.assertEqual(1024, body.get('size'))
@test.attr(type='gate')
def test_register_remote_image(self):
# Register a new remote image
- _, body = self.create_image(name='New Remote Image',
- container_format='bare',
- disk_format='raw', is_public=False,
- location=CONF.image.http_image,
- properties={'key1': 'value1',
- 'key2': 'value2'})
+ body = self.create_image(name='New Remote Image',
+ container_format='bare',
+ disk_format='raw', is_public=False,
+ location=CONF.image.http_image,
+ properties={'key1': 'value1',
+ 'key2': 'value2'})
self.assertIn('id', body)
self.assertEqual('New Remote Image', body.get('name'))
self.assertFalse(body.get('is_public'))
@@ -68,10 +68,10 @@
@test.attr(type='gate')
def test_register_http_image(self):
- _, body = self.create_image(name='New Http Image',
- container_format='bare',
- disk_format='raw', is_public=False,
- copy_from=CONF.image.http_image)
+ body = self.create_image(name='New Http Image',
+ container_format='bare',
+ disk_format='raw', is_public=False,
+ copy_from=CONF.image.http_image)
self.assertIn('id', body)
image_id = body.get('id')
self.assertEqual('New Http Image', body.get('name'))
@@ -83,12 +83,12 @@
def test_register_image_with_min_ram(self):
# Register an image with min ram
properties = {'prop1': 'val1'}
- _, body = self.create_image(name='New_image_with_min_ram',
- container_format='bare',
- disk_format='raw',
- is_public=False,
- min_ram=40,
- properties=properties)
+ body = self.create_image(name='New_image_with_min_ram',
+ container_format='bare',
+ disk_format='raw',
+ is_public=False,
+ min_ram=40,
+ properties=properties)
self.assertIn('id', body)
self.assertEqual('New_image_with_min_ram', body.get('name'))
self.assertFalse(body.get('is_public'))
@@ -140,11 +140,11 @@
"""
name = 'New Remote Image %s' % name
location = CONF.image.http_image
- _, image = cls.create_image(name=name,
- container_format=container_format,
- disk_format=disk_format,
- is_public=False,
- location=location)
+ image = cls.create_image(name=name,
+ container_format=container_format,
+ disk_format=disk_format,
+ is_public=False,
+ location=location)
image_id = image['id']
return image_id
@@ -158,24 +158,24 @@
"""
image_file = StringIO.StringIO(data_utils.random_bytes(size))
name = 'New Standard Image %s' % name
- _, image = cls.create_image(name=name,
- container_format=container_format,
- disk_format=disk_format,
- is_public=False, data=image_file)
+ image = cls.create_image(name=name,
+ container_format=container_format,
+ disk_format=disk_format,
+ is_public=False, data=image_file)
image_id = image['id']
return image_id
@test.attr(type='gate')
def test_index_no_params(self):
# Simple test to see all fixture images returned
- _, images_list = self.client.image_list()
+ images_list = self.client.image_list()
image_list = map(lambda x: x['id'], images_list)
for image_id in self.created_images:
self.assertIn(image_id, image_list)
@test.attr(type='gate')
def test_index_disk_format(self):
- _, images_list = self.client.image_list(disk_format='ami')
+ images_list = self.client.image_list(disk_format='ami')
for image in images_list:
self.assertEqual(image['disk_format'], 'ami')
result_set = set(map(lambda x: x['id'], images_list))
@@ -184,7 +184,7 @@
@test.attr(type='gate')
def test_index_container_format(self):
- _, images_list = self.client.image_list(container_format='bare')
+ images_list = self.client.image_list(container_format='bare')
for image in images_list:
self.assertEqual(image['container_format'], 'bare')
result_set = set(map(lambda x: x['id'], images_list))
@@ -193,7 +193,7 @@
@test.attr(type='gate')
def test_index_max_size(self):
- _, images_list = self.client.image_list(size_max=42)
+ images_list = self.client.image_list(size_max=42)
for image in images_list:
self.assertTrue(image['size'] <= 42)
result_set = set(map(lambda x: x['id'], images_list))
@@ -202,7 +202,7 @@
@test.attr(type='gate')
def test_index_min_size(self):
- _, images_list = self.client.image_list(size_min=142)
+ images_list = self.client.image_list(size_min=142)
for image in images_list:
self.assertTrue(image['size'] >= 142)
result_set = set(map(lambda x: x['id'], images_list))
@@ -211,9 +211,9 @@
@test.attr(type='gate')
def test_index_status_active_detail(self):
- _, images_list = self.client.image_list_detail(status='active',
- sort_key='size',
- sort_dir='desc')
+ images_list = self.client.image_list_detail(status='active',
+ sort_key='size',
+ sort_dir='desc')
top_size = images_list[0]['size'] # We have non-zero sized images
for image in images_list:
size = image['size']
@@ -223,7 +223,7 @@
@test.attr(type='gate')
def test_index_name(self):
- _, images_list = self.client.image_list_detail(
+ images_list = self.client.image_list_detail(
name='New Remote Image dup')
result_set = set(map(lambda x: x['id'], images_list))
for image in images_list:
@@ -247,18 +247,18 @@
"""
image_file = StringIO.StringIO(data_utils.random_bytes(size))
name = 'New Standard Image %s' % name
- _, image = cls.create_image(name=name,
- container_format=container_format,
- disk_format=disk_format,
- is_public=False, data=image_file,
- properties={'key1': 'value1'})
+ image = cls.create_image(name=name,
+ container_format=container_format,
+ disk_format=disk_format,
+ is_public=False, data=image_file,
+ properties={'key1': 'value1'})
image_id = image['id']
return image_id
@test.attr(type='gate')
def test_list_image_metadata(self):
# All metadata key/value pairs for an image should be returned
- _, resp_metadata = self.client.get_image_meta(self.image_id)
+ resp_metadata = self.client.get_image_meta(self.image_id)
expected = {'key1': 'value1'}
self.assertEqual(expected, resp_metadata['properties'])
@@ -266,12 +266,12 @@
def test_update_image_metadata(self):
# The metadata for the image should match the updated values
req_metadata = {'key1': 'alt1', 'key2': 'value2'}
- _, metadata = self.client.get_image_meta(self.image_id)
+ metadata = self.client.get_image_meta(self.image_id)
self.assertEqual(metadata['properties'], {'key1': 'value1'})
metadata['properties'].update(req_metadata)
- _, metadata = self.client.update_image(
+ metadata = self.client.update_image(
self.image_id, properties=metadata['properties'])
- _, resp_metadata = self.client.get_image_meta(self.image_id)
+ resp_metadata = self.client.get_image_meta(self.image_id)
expected = {'key1': 'alt1', 'key2': 'value2'}
self.assertEqual(expected, resp_metadata['properties'])
diff --git a/tempest/api/image/v2/test_images.py b/tempest/api/image/v2/test_images.py
index 7e018e5..e307c5c 100644
--- a/tempest/api/image/v2/test_images.py
+++ b/tempest/api/image/v2/test_images.py
@@ -37,11 +37,11 @@
uuid = '00000000-1111-2222-3333-444455556666'
image_name = data_utils.rand_name('image')
- _, body = self.create_image(name=image_name,
- container_format='bare',
- disk_format='raw',
- visibility='private',
- ramdisk_id=uuid)
+ body = self.create_image(name=image_name,
+ container_format='bare',
+ disk_format='raw',
+ visibility='private',
+ ramdisk_id=uuid)
self.assertIn('id', body)
image_id = body.get('id')
self.assertIn('name', body)
@@ -57,7 +57,7 @@
self.client.store_image(image_id, image_file)
# Now try to get image details
- _, body = self.client.get_image(image_id)
+ body = self.client.get_image(image_id)
self.assertEqual(image_id, body['id'])
self.assertEqual(image_name, body['name'])
self.assertEqual(uuid, body['ramdisk_id'])
@@ -74,10 +74,10 @@
# Create image
image_name = data_utils.rand_name('image')
- _, body = self.client.create_image(name=image_name,
- container_format='bare',
- disk_format='raw',
- visibility='private')
+ body = self.client.create_image(name=image_name,
+ container_format='bare',
+ disk_format='raw',
+ visibility='private')
image_id = body['id']
# Delete Image
@@ -85,7 +85,7 @@
self.client.wait_for_resource_deletion(image_id)
# Verifying deletion
- _, images = self.client.image_list()
+ images = self.client.image_list()
images_id = [item['id'] for item in images]
self.assertNotIn(image_id, images_id)
@@ -95,10 +95,10 @@
# Create image
image_name = data_utils.rand_name('image')
- _, body = self.client.create_image(name=image_name,
- container_format='bare',
- disk_format='iso',
- visibility='private')
+ body = self.client.create_image(name=image_name,
+ container_format='bare',
+ disk_format='iso',
+ visibility='private')
self.addCleanup(self.client.delete_image, body['id'])
self.assertEqual('queued', body['status'])
image_id = body['id']
@@ -109,12 +109,12 @@
# Update Image
new_image_name = data_utils.rand_name('new-image')
- _, body = self.client.update_image(image_id, [
+ body = self.client.update_image(image_id, [
dict(replace='/name', value=new_image_name)])
# Verifying updating
- _, body = self.client.get_image(image_id)
+ body = self.client.get_image(image_id)
self.assertEqual(image_id, body['id'])
self.assertEqual(new_image_name, body['name'])
@@ -147,10 +147,10 @@
size = random.randint(1024, 4096)
image_file = StringIO.StringIO(data_utils.random_bytes(size))
name = data_utils.rand_name('image-')
- _, body = cls.create_image(name=name,
- container_format=container_format,
- disk_format=disk_format,
- visibility='private')
+ body = cls.create_image(name=name,
+ container_format=container_format,
+ disk_format=disk_format,
+ visibility='private')
image_id = body['id']
cls.client.store_image(image_id, data=image_file)
@@ -160,7 +160,7 @@
"""
Perform list action with given params and validates result.
"""
- _, images_list = self.client.image_list(params=params)
+ images_list = self.client.image_list(params=params)
# Validating params of fetched images
for image in images_list:
for key in params:
@@ -170,7 +170,7 @@
@test.attr(type='gate')
def test_index_no_params(self):
# Simple test to see all fixture images returned
- _, images_list = self.client.image_list()
+ images_list = self.client.image_list()
image_list = map(lambda x: x['id'], images_list)
for image in self.created_images:
@@ -199,7 +199,7 @@
# Test to get all images by size
image_id = self.created_images[1]
# Get image metadata
- _, image = self.client.get_image(image_id)
+ image = self.client.get_image(image_id)
params = {"size": image['size']}
self._list_by_param_value_and_assert(params)
@@ -209,11 +209,11 @@
# Test to get all images with size between 2000 to 3000
image_id = self.created_images[1]
# Get image metadata
- _, image = self.client.get_image(image_id)
+ image = self.client.get_image(image_id)
size = image['size']
params = {"size_min": size - 500, "size_max": size + 500}
- _, images_list = self.client.image_list(params=params)
+ images_list = self.client.image_list(params=params)
image_size_list = map(lambda x: x['size'], images_list)
for image_size in image_size_list:
@@ -231,7 +231,7 @@
def test_list_images_param_limit(self):
# Test to get images by limit
params = {"limit": 2}
- _, images_list = self.client.image_list(params=params)
+ images_list = self.client.image_list(params=params)
self.assertEqual(len(images_list), params['limit'],
"Failed to get images by limit")
@@ -240,12 +240,12 @@
def test_get_image_schema(self):
# Test to get image schema
schema = "image"
- _, body = self.client.get_schema(schema)
+ body = self.client.get_schema(schema)
self.assertEqual("image", body['name'])
@test.attr(type='gate')
def test_get_images_schema(self):
# Test to get images schema
schema = "images"
- _, body = self.client.get_schema(schema)
+ body = self.client.get_schema(schema)
self.assertEqual("images", body['name'])
diff --git a/tempest/api/image/v2/test_images_member.py b/tempest/api/image/v2/test_images_member.py
index 5aaf578..ec1cf14 100644
--- a/tempest/api/image/v2/test_images_member.py
+++ b/tempest/api/image/v2/test_images_member.py
@@ -20,8 +20,8 @@
@test.attr(type='gate')
def test_image_share_accept(self):
image_id = self._create_image()
- _, member = self.os_img_client.add_member(image_id,
- self.alt_tenant_id)
+ member = self.os_img_client.add_member(image_id,
+ self.alt_tenant_id)
self.assertEqual(member['member_id'], self.alt_tenant_id)
self.assertEqual(member['image_id'], image_id)
self.assertEqual(member['status'], 'pending')
@@ -30,7 +30,7 @@
self.alt_tenant_id,
'accepted')
self.assertIn(image_id, self._list_image_ids_as_alt())
- _, body = self.os_img_client.get_image_membership(image_id)
+ body = self.os_img_client.get_image_membership(image_id)
members = body['members']
member = members[0]
self.assertEqual(len(members), 1, str(members))
@@ -41,8 +41,8 @@
@test.attr(type='gate')
def test_image_share_reject(self):
image_id = self._create_image()
- _, member = self.os_img_client.add_member(image_id,
- self.alt_tenant_id)
+ member = self.os_img_client.add_member(image_id,
+ self.alt_tenant_id)
self.assertEqual(member['member_id'], self.alt_tenant_id)
self.assertEqual(member['image_id'], image_id)
self.assertEqual(member['status'], 'pending')
@@ -62,8 +62,8 @@
'accepted')
self.assertIn(image_id, self._list_image_ids_as_alt())
- _, member = self.os_img_client.get_member(image_id,
- self.alt_tenant_id)
+ member = self.os_img_client.get_member(image_id,
+ self.alt_tenant_id)
self.assertEqual(self.alt_tenant_id, member['member_id'])
self.assertEqual(image_id, member['image_id'])
self.assertEqual('accepted', member['status'])
@@ -83,10 +83,10 @@
@test.attr(type='gate')
def test_get_image_member_schema(self):
- _, body = self.os_img_client.get_schema("member")
+ body = self.os_img_client.get_schema("member")
self.assertEqual("member", body['name'])
@test.attr(type='gate')
def test_get_image_members_schema(self):
- _, body = self.os_img_client.get_schema("members")
+ body = self.os_img_client.get_schema("members")
self.assertEqual("members", body['name'])
diff --git a/tempest/api/image/v2/test_images_member_negative.py b/tempest/api/image/v2/test_images_member_negative.py
index 7da6e65..1f8e3d0 100644
--- a/tempest/api/image/v2/test_images_member_negative.py
+++ b/tempest/api/image/v2/test_images_member_negative.py
@@ -21,8 +21,8 @@
@test.attr(type=['negative', 'gate'])
def test_image_share_invalid_status(self):
image_id = self._create_image()
- _, member = self.os_img_client.add_member(image_id,
- self.alt_tenant_id)
+ member = self.os_img_client.add_member(image_id,
+ self.alt_tenant_id)
self.assertEqual(member['status'], 'pending')
self.assertRaises(exceptions.BadRequest,
self.alt_img_client.update_member_status,
@@ -31,8 +31,8 @@
@test.attr(type=['negative', 'gate'])
def test_image_share_owner_cannot_accept(self):
image_id = self._create_image()
- _, member = self.os_img_client.add_member(image_id,
- self.alt_tenant_id)
+ member = self.os_img_client.add_member(image_id,
+ self.alt_tenant_id)
self.assertEqual(member['status'], 'pending')
self.assertNotIn(image_id, self._list_image_ids_as_alt())
self.assertRaises(exceptions.Unauthorized,
diff --git a/tempest/api/image/v2/test_images_negative.py b/tempest/api/image/v2/test_images_negative.py
index 722929e..fc781b1 100644
--- a/tempest/api/image/v2/test_images_negative.py
+++ b/tempest/api/image/v2/test_images_negative.py
@@ -52,9 +52,9 @@
def test_get_delete_deleted_image(self):
# get and delete the deleted image
# create and delete image
- _, body = self.client.create_image(name='test',
- container_format='bare',
- disk_format='raw')
+ body = self.client.create_image(name='test',
+ container_format='bare',
+ disk_format='raw')
image_id = body['id']
self.client.delete_image(image_id)
self.client.wait_for_resource_deletion(image_id)
diff --git a/tempest/api/image/v2/test_images_tags.py b/tempest/api/image/v2/test_images_tags.py
index a9db24b..4686de2 100644
--- a/tempest/api/image/v2/test_images_tags.py
+++ b/tempest/api/image/v2/test_images_tags.py
@@ -21,19 +21,19 @@
@test.attr(type='gate')
def test_update_delete_tags_for_image(self):
- _, body = self.create_image(container_format='bare',
- disk_format='raw',
- visibility='private')
+ body = self.create_image(container_format='bare',
+ disk_format='raw',
+ visibility='private')
image_id = body['id']
tag = data_utils.rand_name('tag-')
self.addCleanup(self.client.delete_image, image_id)
# Creating image tag and verify it.
self.client.add_image_tag(image_id, tag)
- _, body = self.client.get_image(image_id)
+ body = self.client.get_image(image_id)
self.assertIn(tag, body['tags'])
# Deleting image tag and verify it.
self.client.delete_image_tag(image_id, tag)
- _, body = self.client.get_image(image_id)
+ body = self.client.get_image(image_id)
self.assertNotIn(tag, body['tags'])
diff --git a/tempest/api/image/v2/test_images_tags_negative.py b/tempest/api/image/v2/test_images_tags_negative.py
index 8e42b7c..aa0a214 100644
--- a/tempest/api/image/v2/test_images_tags_negative.py
+++ b/tempest/api/image/v2/test_images_tags_negative.py
@@ -33,10 +33,10 @@
@test.attr(type=['negative', 'gate'])
def test_delete_non_existing_tag(self):
# Delete non existing tag.
- _, body = self.create_image(container_format='bare',
- disk_format='raw',
- visibility='private'
- )
+ body = self.create_image(container_format='bare',
+ disk_format='raw',
+ visibility='private'
+ )
image_id = body['id']
tag = data_utils.rand_name('non-exist-tag-')
self.addCleanup(self.client.delete_image, image_id)
diff --git a/tempest/api/network/admin/test_external_networks_negative.py b/tempest/api/network/admin/test_external_networks_negative.py
new file mode 100644
index 0000000..7dbb347
--- /dev/null
+++ b/tempest/api/network/admin/test_external_networks_negative.py
@@ -0,0 +1,53 @@
+# Copyright 2014 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
+from tempest import config
+from tempest import exceptions
+from tempest import test
+
+CONF = config.CONF
+
+
+class ExternalNetworksAdminNegativeTestJSON(base.BaseAdminNetworkTest):
+ _interface = 'json'
+
+ @test.attr(type=['negative'])
+ def test_create_port_with_precreated_floatingip_as_fixed_ip(self):
+ """
+ External networks can be used to create both floating-ip as well
+ as instance-ip. So, creating an instance-ip with a value of a
+ pre-created floating-ip should be denied.
+ """
+
+ # create a floating ip
+ client = self.admin_client
+ body = client.create_floatingip(
+ floating_network_id=CONF.network.public_network_id)
+ created_floating_ip = body['floatingip']
+ self.addCleanup(self._try_delete_resource,
+ client.delete_floatingip,
+ created_floating_ip['id'])
+ floating_ip_address = created_floating_ip['floating_ip_address']
+ self.assertIsNotNone(floating_ip_address)
+
+ # use the same value of floatingip as fixed-ip to create_port()
+ fixed_ips = [{'ip_address': floating_ip_address}]
+
+ # create a port which will internally create an instance-ip
+ self.assertRaises(exceptions.Conflict,
+ client.create_port,
+ network_id=CONF.network.public_network_id,
+ fixed_ips=fixed_ips)
diff --git a/tempest/api/network/admin/test_quotas.py b/tempest/api/network/admin/test_quotas.py
index 54aa54c..f8dfca9 100644
--- a/tempest/api/network/admin/test_quotas.py
+++ b/tempest/api/network/admin/test_quotas.py
@@ -50,7 +50,7 @@
# Add a tenant to conduct the test
test_tenant = data_utils.rand_name('test_tenant_')
test_description = data_utils.rand_name('desc_')
- _, tenant = self.identity_admin_client.create_tenant(
+ tenant = self.identity_admin_client.create_tenant(
name=test_tenant,
description=test_description)
tenant_id = tenant['id']
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index 12b2d13..10cda53 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -396,8 +396,11 @@
body = cls.client.list_router_interfaces(router['id'])
interfaces = body['ports']
for i in interfaces:
- cls.client.remove_router_interface_with_subnet_id(
- router['id'], i['fixed_ips'][0]['subnet_id'])
+ try:
+ cls.client.remove_router_interface_with_subnet_id(
+ router['id'], i['fixed_ips'][0]['subnet_id'])
+ except exceptions.NotFound:
+ pass
cls.client.delete_router(router['id'])
@classmethod
diff --git a/tempest/api/network/test_dhcp_ipv6.py b/tempest/api/network/test_dhcp_ipv6.py
index 6ce1216..1257699 100644
--- a/tempest/api/network/test_dhcp_ipv6.py
+++ b/tempest/api/network/test_dhcp_ipv6.py
@@ -327,12 +327,11 @@
subnet["allocation_pools"][0]["end"])
ip = netaddr.IPAddress(random.randrange(
ip_range.last + 1, ip_range.last + 10)).format()
- self.assertRaisesRegexp(exceptions.BadRequest,
- "not a valid IP for the defined subnet",
- self.create_port,
- self.network,
- fixed_ips=[{'subnet_id': subnet['id'],
- 'ip_address': ip}])
+ self.assertRaises(exceptions.BadRequest,
+ self.create_port,
+ self.network,
+ fixed_ips=[{'subnet_id': subnet['id'],
+ 'ip_address': ip}])
def test_dhcp_stateful_fixedips_duplicate(self):
"""When port gets IP address from fixed IP range it
diff --git a/tempest/api/network/test_floating_ips_negative.py b/tempest/api/network/test_floating_ips_negative.py
new file mode 100644
index 0000000..82f0519
--- /dev/null
+++ b/tempest/api/network/test_floating_ips_negative.py
@@ -0,0 +1,78 @@
+# Copyright 2014 Hewlett-Packard Development Company, L.P.
+# Copyright 2014 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
+from tempest.common.utils import data_utils
+from tempest import config
+from tempest import exceptions
+from tempest import test
+
+CONF = config.CONF
+
+
+class FloatingIPNegativeTestJSON(base.BaseNetworkTest):
+ _interface = 'json'
+ """
+ Test the following negative operations for floating ips:
+
+ Create floatingip with a port that is unreachable to external network
+ Create floatingip in private network
+ Associate floatingip with port that is unreachable to external network
+ """
+
+ @classmethod
+ def resource_setup(cls):
+ super(FloatingIPNegativeTestJSON, cls).resource_setup()
+ if not test.is_extension_enabled('router', 'network'):
+ msg = "router extension not enabled."
+ raise cls.skipException(msg)
+ cls.ext_net_id = CONF.network.public_network_id
+ # Create a network with a subnet connected to a router.
+ cls.network = cls.create_network()
+ cls.subnet = cls.create_subnet(cls.network)
+ cls.router = cls.create_router(data_utils.rand_name('router'))
+ cls.create_router_interface(cls.router['id'], cls.subnet['id'])
+ cls.port = cls.create_port(cls.network)
+
+ @test.attr(type=['negative', 'smoke'])
+ def test_create_floatingip_with_port_ext_net_unreachable(self):
+ self.assertRaises(exceptions.NotFound, self.client.create_floatingip,
+ floating_network_id=self.ext_net_id,
+ port_id=self.port['id'],
+ fixed_ip_address=self.port['fixed_ips'][0]
+ ['ip_address'])
+
+ @test.attr(type=['negative', 'smoke'])
+ def test_create_floatingip_in_private_network(self):
+ self.assertRaises(exceptions.BadRequest,
+ self.client.create_floatingip,
+ floating_network_id=self.network['id'],
+ port_id=self.port['id'],
+ fixed_ip_address=self.port['fixed_ips'][0]
+ ['ip_address'])
+
+ @test.attr(type=['negative', 'smoke'])
+ def test_associate_floatingip_port_ext_net_unreachable(self):
+ # Create floating ip
+ body = self.client.create_floatingip(
+ floating_network_id=self.ext_net_id)
+ floating_ip = body['floatingip']
+ self.addCleanup(self.client.delete_floatingip, floating_ip['id'])
+ # Associate floating IP to the other port
+ self.assertRaises(exceptions.NotFound, self.client.update_floatingip,
+ floating_ip['id'], port_id=self.port['id'],
+ fixed_ip_address=self.port['fixed_ips'][0]
+ ['ip_address'])
diff --git a/tempest/api/network/test_load_balancer.py b/tempest/api/network/test_load_balancer.py
index 289da7e..b606115 100644
--- a/tempest/api/network/test_load_balancer.py
+++ b/tempest/api/network/test_load_balancer.py
@@ -422,5 +422,6 @@
self.assertEqual(2, member['weight'])
+@test.skip_because(bug="1402007")
class LoadBalancerIpV6TestJSON(LoadBalancerTestJSON):
_ip_version = 6
diff --git a/tempest/api/network/test_networks.py b/tempest/api/network/test_networks.py
index e70519e..65aeb24 100644
--- a/tempest/api/network/test_networks.py
+++ b/tempest/api/network/test_networks.py
@@ -15,7 +15,6 @@
import itertools
import netaddr
-import testtools
from tempest.api.network import base
from tempest.common import custom_matchers
@@ -571,9 +570,16 @@
test_subnet_ids,
'Subnet are not in the same network')
- @testtools.skipUnless(CONF.network_feature_enabled.ipv6_subnet_attributes,
- "IPv6 extended attributes for subnets not "
- "available")
+
+class NetworksIpV6TestAttrs(NetworksIpV6TestJSON):
+
+ @classmethod
+ def resource_setup(cls):
+ if not CONF.network_feature_enabled.ipv6_subnet_attributes:
+ raise cls.skipException("IPv6 extended attributes for "
+ "subnets not available")
+ super(NetworksIpV6TestAttrs, cls).resource_setup()
+
@test.attr(type='smoke')
def test_create_delete_subnet_with_v6_attributes_stateful(self):
self._create_verify_delete_subnet(
@@ -581,20 +587,54 @@
ipv6_ra_mode='dhcpv6-stateful',
ipv6_address_mode='dhcpv6-stateful')
- @testtools.skipUnless(CONF.network_feature_enabled.ipv6_subnet_attributes,
- "IPv6 extended attributes for subnets not "
- "available")
@test.attr(type='smoke')
def test_create_delete_subnet_with_v6_attributes_slaac(self):
self._create_verify_delete_subnet(
ipv6_ra_mode='slaac',
ipv6_address_mode='slaac')
- @testtools.skipUnless(CONF.network_feature_enabled.ipv6_subnet_attributes,
- "IPv6 extended attributes for subnets not "
- "available")
@test.attr(type='smoke')
def test_create_delete_subnet_with_v6_attributes_stateless(self):
self._create_verify_delete_subnet(
ipv6_ra_mode='dhcpv6-stateless',
ipv6_address_mode='dhcpv6-stateless')
+
+ def _test_delete_subnet_with_ports(self, mode):
+ """Create subnet and delete it with existing ports"""
+ slaac_network = self.create_network()
+ subnet_slaac = self.create_subnet(slaac_network,
+ **{'ipv6_ra_mode': mode,
+ 'ipv6_address_mode': mode})
+ port = self.create_port(slaac_network)
+ self.assertIsNotNone(port['fixed_ips'][0]['ip_address'])
+ self.client.delete_subnet(subnet_slaac['id'])
+ self.subnets.pop()
+ subnets = self.client.list_subnets()
+ subnet_ids = [subnet['id'] for subnet in subnets['subnets']]
+ self.assertNotIn(subnet_slaac['id'], subnet_ids,
+ "Subnet wasn't deleted")
+ self.assertRaisesRegexp(
+ exceptions.Conflict,
+ "There are one or more ports still in use on the network",
+ self.client.delete_network,
+ slaac_network['id'])
+
+ @test.attr(type='smoke')
+ def test_create_delete_slaac_subnet_with_ports(self):
+ """Test deleting subnet with SLAAC ports
+
+ Create subnet with SLAAC, create ports in network
+ and then you shall be able to delete subnet without port
+ deletion. But you still can not delete the network.
+ """
+ self._test_delete_subnet_with_ports("slaac")
+
+ @test.attr(type='smoke')
+ def test_create_delete_stateless_subnet_with_ports(self):
+ """Test deleting subnet with DHCPv6 stateless ports
+
+ Create subnet with DHCPv6 stateless, create ports in network
+ and then you shall be able to delete subnet without port
+ deletion. But you still can not delete the network.
+ """
+ self._test_delete_subnet_with_ports("dhcpv6-stateless")
diff --git a/tempest/api/network/test_ports.py b/tempest/api/network/test_ports.py
index 80097db..bf85e90 100644
--- a/tempest/api/network/test_ports.py
+++ b/tempest/api/network/test_ports.py
@@ -13,9 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
+import netaddr
import socket
from tempest.api.network import base
+from tempest.api.network import base_security_groups as sec_base
from tempest.common import custom_matchers
from tempest.common.utils import data_utils
from tempest import config
@@ -24,7 +26,7 @@
CONF = config.CONF
-class PortsTestJSON(base.BaseNetworkTest):
+class PortsTestJSON(sec_base.BaseSecGroupTest):
_interface = 'json'
"""
@@ -83,6 +85,35 @@
self.assertTrue(port1['admin_state_up'])
self.assertTrue(port2['admin_state_up'])
+ @classmethod
+ def _get_ipaddress_from_tempest_conf(cls):
+ """Return first subnet gateway for configured CIDR """
+ if cls._ip_version == 4:
+ cidr = netaddr.IPNetwork(CONF.network.tenant_network_cidr)
+
+ elif cls._ip_version == 6:
+ cidr = netaddr.IPNetwork(CONF.network.tenant_network_v6_cidr)
+
+ return netaddr.IPAddress(cidr)
+
+ @test.attr(type='smoke')
+ def test_create_port_in_allowed_allocation_pools(self):
+ network = self.create_network()
+ net_id = network['id']
+ address = self._get_ipaddress_from_tempest_conf()
+ allocation_pools = {'allocation_pools': [{'start': str(address + 4),
+ 'end': str(address + 6)}]}
+ subnet = self.create_subnet(network, **allocation_pools)
+ self.addCleanup(self.client.delete_subnet, subnet['id'])
+ body = self.client.create_port(network_id=net_id)
+ self.addCleanup(self.client.delete_port, body['port']['id'])
+ port = body['port']
+ ip_address = port['fixed_ips'][0]['ip_address']
+ start_ip_address = allocation_pools['allocation_pools'][0]['start']
+ end_ip_address = allocation_pools['allocation_pools'][0]['end']
+ ip_range = netaddr.IPRange(start_ip_address, end_ip_address)
+ self.assertIn(ip_address, ip_range)
+
@test.attr(type='smoke')
def test_show_port(self):
# Verify the details of port
@@ -119,8 +150,11 @@
def test_port_list_filter_by_router_id(self):
# Create a router
network = self.create_network()
- self.create_subnet(network)
+ self.addCleanup(self.client.delete_network, network['id'])
+ subnet = self.create_subnet(network)
+ self.addCleanup(self.client.delete_subnet, subnet['id'])
router = self.create_router(data_utils.rand_name('router-'))
+ self.addCleanup(self.client.delete_router, router['id'])
port = self.client.create_port(network_id=network['id'])
# Add router interface to port created above
self.client.add_router_interface_with_port_id(
@@ -146,31 +180,41 @@
self.assertEqual(sorted(fields), sorted(port.keys()))
@test.attr(type='smoke')
- def test_update_port_with_second_ip(self):
+ def test_create_update_port_with_second_ip(self):
# Create a network with two subnets
network = self.create_network()
+ self.addCleanup(self.client.delete_network, network['id'])
subnet_1 = self.create_subnet(network)
+ self.addCleanup(self.client.delete_subnet, subnet_1['id'])
subnet_2 = self.create_subnet(network)
+ self.addCleanup(self.client.delete_subnet, subnet_2['id'])
fixed_ip_1 = [{'subnet_id': subnet_1['id']}]
fixed_ip_2 = [{'subnet_id': subnet_2['id']}]
- # Create a port with a single IP address from first subnet
- port = self.create_port(network,
- fixed_ips=fixed_ip_1)
- self.assertEqual(1, len(port['fixed_ips']))
-
- # Update the port with a second IP address from second subnet
fixed_ips = fixed_ip_1 + fixed_ip_2
- port = self.update_port(port, fixed_ips=fixed_ips)
+
+ # Create a port with multiple IP addresses
+ port = self.create_port(network,
+ fixed_ips=fixed_ips)
+ self.addCleanup(self.client.delete_port, port['id'])
self.assertEqual(2, len(port['fixed_ips']))
+ check_fixed_ips = [subnet_1['id'], subnet_2['id']]
+ for item in port['fixed_ips']:
+ self.assertIn(item['subnet_id'], check_fixed_ips)
# Update the port to return to a single IP address
port = self.update_port(port, fixed_ips=fixed_ip_1)
self.assertEqual(1, len(port['fixed_ips']))
+ # Update the port with a second IP address from second subnet
+ port = self.update_port(port, fixed_ips=fixed_ips)
+ self.assertEqual(2, len(port['fixed_ips']))
+
def _update_port_with_security_groups(self, security_groups_names):
- post_body = {"network_id": self.network['id']}
- self.create_subnet(self.network)
+ subnet_1 = self.create_subnet(self.network)
+ self.addCleanup(self.client.delete_subnet, subnet_1['id'])
+ fixed_ip_1 = [{'subnet_id': subnet_1['id']}]
+
security_groups_list = list()
for name in security_groups_names:
group_create_body = self.client.create_security_group(
@@ -180,24 +224,48 @@
security_groups_list.append(group_create_body['security_group']
['id'])
# Create a port
+ sec_grp_name = data_utils.rand_name('secgroup')
+ security_group = self.client.create_security_group(name=sec_grp_name)
+ self.addCleanup(self.client.delete_security_group,
+ security_group['security_group']['id'])
+ post_body = {
+ "name": data_utils.rand_name('port-'),
+ "security_groups": [security_group['security_group']['id']],
+ "network_id": self.network['id'],
+ "admin_state_up": True,
+ "fixed_ips": fixed_ip_1}
body = self.client.create_port(**post_body)
self.addCleanup(self.client.delete_port, body['port']['id'])
port = body['port']
+
# Update the port with security groups
- update_body = {"security_groups": security_groups_list}
+ subnet_2 = self.create_subnet(self.network)
+ fixed_ip_2 = [{'subnet_id': subnet_2['id']}]
+ update_body = {"name": data_utils.rand_name('port-'),
+ "admin_state_up": False,
+ "fixed_ips": fixed_ip_2,
+ "security_groups": security_groups_list}
body = self.client.update_port(port['id'], **update_body)
- # Verify the security groups updated to port
port_show = body['port']
+ # Verify the security groups and other attributes updated to port
+ exclude_keys = set(port_show).symmetric_difference(update_body)
+ exclude_keys.add('fixed_ips')
+ exclude_keys.add('security_groups')
+ self.assertThat(port_show, custom_matchers.MatchesDictExceptForKeys(
+ update_body, exclude_keys))
+ self.assertEqual(fixed_ip_2[0]['subnet_id'],
+ port_show['fixed_ips'][0]['subnet_id'])
+
for security_group in security_groups_list:
self.assertIn(security_group, port_show['security_groups'])
@test.attr(type='smoke')
- def test_update_port_with_security_group(self):
+ def test_update_port_with_security_group_and_extra_attributes(self):
self._update_port_with_security_groups(
[data_utils.rand_name('secgroup')])
@test.attr(type='smoke')
- def test_update_port_with_two_security_groups(self):
+ def test_update_port_with_two_security_groups_and_extra_attributes(self):
self._update_port_with_security_groups(
[data_utils.rand_name('secgroup'),
data_utils.rand_name('secgroup')])
@@ -221,20 +289,15 @@
@test.attr(type='smoke')
def test_create_port_with_no_securitygroups(self):
- port = self.create_port(self.create_network(), security_groups=[])
+ network = self.create_network()
+ self.addCleanup(self.client.delete_network, network['id'])
+ subnet = self.create_subnet(network)
+ self.addCleanup(self.client.delete_subnet, subnet['id'])
+ port = self.create_port(network, security_groups=[])
+ self.addCleanup(self.client.delete_port, port['id'])
self.assertIsNotNone(port['security_groups'])
self.assertEmpty(port['security_groups'])
- @test.attr(type='smoke')
- def test_update_port_with_no_securitygroups(self):
- port = self.create_port(self.create_network())
- # Verify that port is created with default security group
- self.assertIsNotNone(port['security_groups'])
- self.assertNotEmpty(port['security_groups'])
- updated_port = self.update_port(port, security_groups=[])
- self.assertIsNotNone(updated_port['security_groups'])
- self.assertEmpty(updated_port['security_groups'])
-
class PortsAdminExtendedAttrsTestJSON(base.BaseAdminNetworkTest):
_interface = 'json'
diff --git a/tempest/api/network/test_routers.py b/tempest/api/network/test_routers.py
index 5e8a851..210a8af 100644
--- a/tempest/api/network/test_routers.py
+++ b/tempest/api/network/test_routers.py
@@ -94,7 +94,7 @@
# Test creating router from admin user setting tenant_id.
test_tenant = data_utils.rand_name('test_tenant_')
test_description = data_utils.rand_name('desc_')
- _, tenant = self.identity_admin_client.create_tenant(
+ tenant = self.identity_admin_client.create_tenant(
name=test_tenant, description=test_description)
tenant_id = tenant['id']
self.addCleanup(self.identity_admin_client.delete_tenant, tenant_id)
diff --git a/tempest/api/network/test_routers_negative.py b/tempest/api/network/test_routers_negative.py
index 88aa3c9..d571e92 100644
--- a/tempest/api/network/test_routers_negative.py
+++ b/tempest/api/network/test_routers_negative.py
@@ -83,6 +83,24 @@
self.client.delete_router,
self.router['id'])
+ @test.attr(type=['negative', 'smoke'])
+ def test_show_non_existent_router_returns_404(self):
+ router = data_utils.rand_name('non_exist_router')
+ self.assertRaises(exceptions.NotFound, self.client.show_router,
+ router)
+
+ @test.attr(type=['negative', 'smoke'])
+ def test_update_non_existent_router_returns_404(self):
+ router = data_utils.rand_name('non_exist_router')
+ self.assertRaises(exceptions.NotFound, self.client.update_router,
+ router, name="new_name")
+
+ @test.attr(type=['negative', 'smoke'])
+ def test_delete_non_existent_router_returns_404(self):
+ router = data_utils.rand_name('non_exist_router')
+ self.assertRaises(exceptions.NotFound, self.client.delete_router,
+ router)
+
class RoutersNegativeIpV6Test(RoutersNegativeTest):
_ip_version = 6
diff --git a/tempest/api/object_storage/base.py b/tempest/api/object_storage/base.py
index 7fabb7d..36c9f5a 100644
--- a/tempest/api/object_storage/base.py
+++ b/tempest/api/object_storage/base.py
@@ -46,10 +46,8 @@
cls.object_client = cls.os.object_client
cls.container_client = cls.os.container_client
cls.account_client = cls.os.account_client
- cls.custom_object_client = cls.os.custom_object_client
cls.token_client = cls.os_admin.token_client
cls.identity_admin_client = cls.os_admin.identity_client
- cls.custom_account_client = cls.os.custom_account_client
cls.object_client_alt = cls.os_alt.object_client
cls.container_client_alt = cls.os_alt.container_client
cls.identity_client_alt = cls.os_alt.identity_client
@@ -58,8 +56,6 @@
cls.object_client.auth_provider.clear_auth()
cls.container_client.auth_provider.clear_auth()
cls.account_client.auth_provider.clear_auth()
- cls.custom_object_client.auth_provider.clear_auth()
- cls.custom_account_client.auth_provider.clear_auth()
cls.object_client_alt.auth_provider.clear_auth()
cls.container_client_alt.auth_provider.clear_auth()
@@ -126,7 +122,7 @@
def _get_role_id(self, role_name):
try:
- _, roles = self.client.list_roles()
+ roles = self.client.list_roles()
return next(r['id'] for r in roles if r['name'] == role_name)
except StopIteration:
msg = "Role name '%s' is not found" % role_name
diff --git a/tempest/api/object_storage/test_account_quotas.py b/tempest/api/object_storage/test_account_quotas.py
index e75e971..1832b37 100644
--- a/tempest/api/object_storage/test_account_quotas.py
+++ b/tempest/api/object_storage/test_account_quotas.py
@@ -43,30 +43,30 @@
def setUp(self):
super(AccountQuotasTest, self).setUp()
- # Set the reselleradmin auth in headers for next custom_account_client
+ # Set the reselleradmin auth in headers for next account_client
# request
- self.custom_account_client.auth_provider.set_alt_auth_data(
+ self.account_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.reselleradmin_auth_data
)
# Set a quota of 20 bytes on the user's account before each test
headers = {"X-Account-Meta-Quota-Bytes": "20"}
- self.os.custom_account_client.request("POST", url="", headers=headers,
- body="")
+ self.os.account_client.request("POST", url="", headers=headers,
+ body="")
def tearDown(self):
- # Set the reselleradmin auth in headers for next custom_account_client
+ # Set the reselleradmin auth in headers for next account_client
# request
- self.custom_account_client.auth_provider.set_alt_auth_data(
+ self.account_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.reselleradmin_auth_data
)
# remove the quota from the container
headers = {"X-Remove-Account-Meta-Quota-Bytes": "x"}
- self.os.custom_account_client.request("POST", url="", headers=headers,
- body="")
+ self.os.account_client.request("POST", url="", headers=headers,
+ body="")
super(AccountQuotasTest, self).tearDown()
@classmethod
@@ -91,7 +91,7 @@
"""Test that the ResellerAdmin is able to modify and remove the quota
on a user's account.
- Using the custom_account client, the test modifies the quota
+ Using the account client, the test modifies the quota
successively to:
* "25": a random value different from the initial quota value.
@@ -100,15 +100,15 @@
"""
for quota in ("25", "", "20"):
- self.custom_account_client.auth_provider.set_alt_auth_data(
+ self.account_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.reselleradmin_auth_data
)
headers = {"X-Account-Meta-Quota-Bytes": quota}
- resp, _ = self.os.custom_account_client.request("POST", url="",
- headers=headers,
- body="")
+ resp, _ = self.os.account_client.request("POST", url="",
+ headers=headers,
+ body="")
self.assertEqual(resp["status"], "204")
self.assertHeaders(resp, 'Account', 'POST')
diff --git a/tempest/api/object_storage/test_account_quotas_negative.py b/tempest/api/object_storage/test_account_quotas_negative.py
index 6c1fb5a..a6ea6ee 100644
--- a/tempest/api/object_storage/test_account_quotas_negative.py
+++ b/tempest/api/object_storage/test_account_quotas_negative.py
@@ -43,30 +43,30 @@
def setUp(self):
super(AccountQuotasNegativeTest, self).setUp()
- # Set the reselleradmin auth in headers for next custom_account_client
+ # Set the reselleradmin auth in headers for next account_client
# request
- self.custom_account_client.auth_provider.set_alt_auth_data(
+ self.account_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.reselleradmin_auth_data
)
# Set a quota of 20 bytes on the user's account before each test
headers = {"X-Account-Meta-Quota-Bytes": "20"}
- self.os.custom_account_client.request("POST", url="", headers=headers,
- body="")
+ self.os.account_client.request("POST", url="", headers=headers,
+ body="")
def tearDown(self):
- # Set the reselleradmin auth in headers for next custom_account_client
+ # Set the reselleradmin auth in headers for next account_client
# request
- self.custom_account_client.auth_provider.set_alt_auth_data(
+ self.account_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.reselleradmin_auth_data
)
# remove the quota from the container
headers = {"X-Remove-Account-Meta-Quota-Bytes": "x"}
- self.os.custom_account_client.request("POST", url="", headers=headers,
- body="")
+ self.os.account_client.request("POST", url="", headers=headers,
+ body="")
super(AccountQuotasNegativeTest, self).tearDown()
@classmethod
diff --git a/tempest/api/object_storage/test_account_services_negative.py b/tempest/api/object_storage/test_account_services_negative.py
index e4c46e2..ef04387 100644
--- a/tempest/api/object_storage/test_account_services_negative.py
+++ b/tempest/api/object_storage/test_account_services_negative.py
@@ -34,10 +34,10 @@
test_auth_provider.auth_data
# Get fresh auth for test user and set it to next auth request for
- # custom_account_client
+ # account_client
delattr(test_auth_provider, 'auth_data')
test_auth_new_data = test_auth_provider.auth_data
- self.custom_account_client.auth_provider.set_alt_auth_data(
+ self.account_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=test_auth_new_data
)
@@ -45,5 +45,5 @@
params = {'format': 'json'}
# list containers with non-authorized user token
self.assertRaises(exceptions.Unauthorized,
- self.custom_account_client.list_account_containers,
+ self.account_client.list_account_containers,
params=params)
diff --git a/tempest/api/object_storage/test_container_acl.py b/tempest/api/object_storage/test_container_acl.py
index 2244900..205bc91 100644
--- a/tempest/api/object_storage/test_container_acl.py
+++ b/tempest/api/object_storage/test_container_acl.py
@@ -52,11 +52,11 @@
object_name, 'data')
self.assertHeaders(resp, 'Object', 'PUT')
# Trying to read the object with rights
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.test_auth_data
)
- resp, _ = self.custom_object_client.get_object(
+ resp, _ = self.object_client.get_object(
self.container_name, object_name)
self.assertHeaders(resp, 'Object', 'GET')
@@ -71,12 +71,12 @@
metadata_prefix='')
self.assertHeaders(resp_meta, 'Container', 'POST')
# Trying to write the object with rights
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.test_auth_data
)
object_name = data_utils.rand_name(name='Object')
- resp, _ = self.custom_object_client.create_object(
+ resp, _ = self.object_client.create_object(
self.container_name,
- object_name, 'data')
+ object_name, 'data', headers={})
self.assertHeaders(resp, 'Object', 'PUT')
diff --git a/tempest/api/object_storage/test_container_acl_negative.py b/tempest/api/object_storage/test_container_acl_negative.py
index fed4549..138d25a 100644
--- a/tempest/api/object_storage/test_container_acl_negative.py
+++ b/tempest/api/object_storage/test_container_acl_negative.py
@@ -43,13 +43,13 @@
# trying to create object with empty headers
# X-Auth-Token is not provided
object_name = data_utils.rand_name(name='Object')
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=None
)
self.assertRaises(exceptions.Unauthorized,
- self.custom_object_client.create_object,
- self.container_name, object_name, 'data')
+ self.object_client.create_object,
+ self.container_name, object_name, 'data', headers={})
@test.attr(type=['negative', 'gate'])
def test_delete_object_without_using_creds(self):
@@ -59,12 +59,12 @@
object_name, 'data')
# trying to delete object with empty headers
# X-Auth-Token is not provided
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=None
)
self.assertRaises(exceptions.Unauthorized,
- self.custom_object_client.delete_object,
+ self.object_client.delete_object,
self.container_name, object_name)
@test.attr(type=['negative', 'gate'])
@@ -73,13 +73,13 @@
# User provided token is forbidden. ACL are not set
object_name = data_utils.rand_name(name='Object')
# trying to create object with non-authorized user
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.test_auth_data
)
self.assertRaises(exceptions.Unauthorized,
- self.custom_object_client.create_object,
- self.container_name, object_name, 'data')
+ self.object_client.create_object,
+ self.container_name, object_name, 'data', headers={})
@test.attr(type=['negative', 'gate'])
def test_read_object_with_non_authorized_user(self):
@@ -90,12 +90,12 @@
self.container_name, object_name, 'data')
self.assertHeaders(resp, 'Object', 'PUT')
# trying to get object with non authorized user token
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.test_auth_data
)
self.assertRaises(exceptions.Unauthorized,
- self.custom_object_client.get_object,
+ self.object_client.get_object,
self.container_name, object_name)
@test.attr(type=['negative', 'gate'])
@@ -107,12 +107,12 @@
self.container_name, object_name, 'data')
self.assertHeaders(resp, 'Object', 'PUT')
# trying to delete object with non-authorized user token
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.test_auth_data
)
self.assertRaises(exceptions.Unauthorized,
- self.custom_object_client.delete_object,
+ self.object_client.delete_object,
self.container_name, object_name)
@test.attr(type=['negative', 'smoke'])
@@ -130,12 +130,12 @@
object_name, 'data')
self.assertHeaders(resp, 'Object', 'PUT')
# Trying to read the object without rights
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.test_auth_data
)
self.assertRaises(exceptions.Unauthorized,
- self.custom_object_client.get_object,
+ self.object_client.get_object,
self.container_name, object_name)
@test.attr(type=['negative', 'smoke'])
@@ -148,15 +148,15 @@
metadata_prefix='')
self.assertHeaders(resp_meta, 'Container', 'POST')
# Trying to write the object without rights
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.test_auth_data
)
object_name = data_utils.rand_name(name='Object')
self.assertRaises(exceptions.Unauthorized,
- self.custom_object_client.create_object,
+ self.object_client.create_object,
self.container_name,
- object_name, 'data')
+ object_name, 'data', headers={})
@test.attr(type=['negative', 'smoke'])
def test_write_object_without_write_rights(self):
@@ -170,15 +170,15 @@
metadata_prefix='')
self.assertHeaders(resp_meta, 'Container', 'POST')
# Trying to write the object without write rights
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.test_auth_data
)
object_name = data_utils.rand_name(name='Object')
self.assertRaises(exceptions.Unauthorized,
- self.custom_object_client.create_object,
+ self.object_client.create_object,
self.container_name,
- object_name, 'data')
+ object_name, 'data', headers={})
@test.attr(type=['negative', 'smoke'])
def test_delete_object_without_write_rights(self):
@@ -197,11 +197,11 @@
object_name, 'data')
self.assertHeaders(resp, 'Object', 'PUT')
# Trying to delete the object without write rights
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=self.test_auth_data
)
self.assertRaises(exceptions.Unauthorized,
- self.custom_object_client.delete_object,
+ self.object_client.delete_object,
self.container_name,
object_name)
diff --git a/tempest/api/object_storage/test_container_staticweb.py b/tempest/api/object_storage/test_container_staticweb.py
index 5c4e0bf..a8e5f9a 100644
--- a/tempest/api/object_storage/test_container_staticweb.py
+++ b/tempest/api/object_storage/test_container_staticweb.py
@@ -17,6 +17,7 @@
from tempest.api.object_storage import base
from tempest.common import custom_matchers
from tempest.common.utils import data_utils
+from tempest import exceptions
from tempest import test
@@ -58,15 +59,16 @@
self.container_name, metadata=headers)
# Maintain original headers, no auth added
- self.custom_account_client.auth_provider.set_alt_auth_data(
+ self.account_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=None
)
# test GET on http://account_url/container_name
# we should retrieve the self.object_name file
- resp, body = self.custom_account_client.request("GET",
- self.container_name)
+ resp, body = self.account_client.request("GET",
+ self.container_name,
+ headers={})
# This request is equivalent to GET object
self.assertHeaders(resp, 'Object', 'GET')
self.assertEqual(body, self.object_data)
@@ -89,8 +91,9 @@
# test GET on http://account_url/container_name
# we should retrieve a listing of objects
- resp, body = self.custom_account_client.request("GET",
- self.container_name)
+ resp, body = self.account_client.request("GET",
+ self.container_name,
+ headers={})
# The target of the request is not any Swift resource. Therefore, the
# existence of response header is checked without a custom matcher.
self.assertIn('content-length', resp)
@@ -120,15 +123,16 @@
self.container_name, metadata=headers)
# Maintain original headers, no auth added
- self.custom_account_client.auth_provider.set_alt_auth_data(
+ self.account_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=None
)
# test GET on http://account_url/container_name
# we should retrieve a listing of objects
- resp, body = self.custom_account_client.request("GET",
- self.container_name)
+ resp, body = self.account_client.request("GET",
+ self.container_name,
+ headers={})
self.assertIn(self.object_name, body)
css = '<link rel="stylesheet" type="text/css" href="listings.css" />'
self.assertIn(css, body)
@@ -150,13 +154,12 @@
object_data_404)
# Do not set auth in HTTP headers for next request
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=None
)
# Request non-existing object
- resp, body = self.custom_object_client.get_object(self.container_name,
- "notexisting")
- self.assertEqual(resp['status'], '404')
- self.assertEqual(body, object_data_404)
+ self.assertRaises(
+ exceptions.NotFound, self.object_client.get_object,
+ self.container_name, "notexisting")
diff --git a/tempest/api/object_storage/test_container_sync.py b/tempest/api/object_storage/test_container_sync.py
index a50e392..7f8cb8b 100644
--- a/tempest/api/object_storage/test_container_sync.py
+++ b/tempest/api/object_storage/test_container_sync.py
@@ -44,10 +44,9 @@
cls.local_ip = '127.0.0.1'
# Must be configure according to container-sync interval
- container_sync_timeout = \
- int(CONF.object_storage.container_sync_timeout)
+ container_sync_timeout = CONF.object_storage.container_sync_timeout
cls.container_sync_interval = \
- int(CONF.object_storage.container_sync_interval)
+ CONF.object_storage.container_sync_interval
cls.attempts = \
int(container_sync_timeout / cls.container_sync_interval)
@@ -66,12 +65,7 @@
cls.delete_containers(cls.containers, client[0], client[1])
super(ContainerSyncTest, cls).resource_cleanup()
- @test.attr(type='slow')
- @test.skip_because(bug='1317133')
- @testtools.skipIf(
- not CONF.object_storage_feature_enabled.container_sync,
- 'Old-style container sync function is disabled')
- def test_container_synchronization(self):
+ def _test_container_synchronization(self, make_headers):
# container to container synchronization
# to allow/accept sync requests to/from other accounts
@@ -79,15 +73,7 @@
for cont in (self.containers, self.containers[::-1]):
cont_client = [self.clients[c][0] for c in cont]
obj_client = [self.clients[c][1] for c in cont]
- # tell first container to synchronize to a second
- client_proxy_ip = \
- urlparse.urlparse(cont_client[1].base_url).netloc.split(':')[0]
- client_base_url = \
- cont_client[1].base_url.replace(client_proxy_ip,
- self.local_ip)
- headers = {'X-Container-Sync-Key': 'sync_key',
- 'X-Container-Sync-To': "%s/%s" %
- (client_base_url, str(cont[1]))}
+ headers = make_headers(cont[1], cont_client[1])
resp, body = \
cont_client[0].put(str(cont[0]), body=None, headers=headers)
# create object in container
@@ -101,21 +87,19 @@
params = {'format': 'json'}
while self.attempts > 0:
object_lists = []
- for client_index in (0, 1):
- resp, object_list = \
- cont_client[client_index].\
- list_container_contents(self.containers[client_index],
- params=params)
+ for c_client, cont in zip(cont_client, self.containers):
+ resp, object_list = c_client.list_container_contents(
+ cont, params=params)
object_lists.append(dict(
(obj['name'], obj) for obj in object_list))
# check that containers are not empty and have equal keys()
# or wait for next attempt
- if not object_lists[0] or not object_lists[1] or \
- set(object_lists[0].keys()) != set(object_lists[1].keys()):
+ if object_lists[0] and object_lists[1] and \
+ set(object_lists[0].keys()) == set(object_lists[1].keys()):
+ break
+ else:
time.sleep(self.container_sync_interval)
self.attempts -= 1
- else:
- break
self.assertEqual(object_lists[0], object_lists[1],
'Different object lists in containers.')
@@ -126,3 +110,22 @@
for obj_name in object_lists[0]:
resp, object_content = obj_client.get_object(cont, obj_name)
self.assertEqual(object_content, obj_name[::-1])
+
+ @test.attr(type='slow')
+ @test.skip_because(bug='1317133')
+ @testtools.skipIf(
+ not CONF.object_storage_feature_enabled.container_sync,
+ 'Old-style container sync function is disabled')
+ def test_container_synchronization(self):
+ def make_headers(cont, cont_client):
+ # tell first container to synchronize to a second
+ client_proxy_ip = \
+ urlparse.urlparse(cont_client.base_url).netloc.split(':')[0]
+ client_base_url = \
+ cont_client.base_url.replace(client_proxy_ip,
+ self.local_ip)
+ headers = {'X-Container-Sync-Key': 'sync_key',
+ 'X-Container-Sync-To': "%s/%s" %
+ (client_base_url, str(cont))}
+ return headers
+ self._test_container_synchronization(make_headers)
diff --git a/tempest/api/object_storage/test_container_sync_middleware.py b/tempest/api/object_storage/test_container_sync_middleware.py
new file mode 100644
index 0000000..41509a0
--- /dev/null
+++ b/tempest/api/object_storage/test_container_sync_middleware.py
@@ -0,0 +1,51 @@
+# Copyright(c)2015 NTT 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.object_storage import test_container_sync
+from tempest import config
+from tempest import test
+
+CONF = config.CONF
+
+
+# This test can be quite long to run due to its
+# dependency on container-sync process running interval.
+# You can obviously reduce the container-sync interval in the
+# container-server configuration.
+
+
+class ContainerSyncMiddlewareTest(test_container_sync.ContainerSyncTest):
+
+ @classmethod
+ def resource_setup(cls):
+ super(ContainerSyncMiddlewareTest, cls).resource_setup()
+
+ # Set container-sync-realms.conf info
+ cls.realm_name = CONF.object_storage.realm_name
+ cls.key = 'sync_key'
+ cls.cluster_name = CONF.object_storage.cluster_name
+
+ @test.attr(type='slow')
+ @test.requires_ext(extension='container_sync', service='object')
+ def test_container_synchronization(self):
+ def make_headers(cont, cont_client):
+ # tell first container to synchronize to a second
+ account_name = cont_client.base_url.split('/')[-1]
+
+ headers = {'X-Container-Sync-Key': "%s" % (self.key),
+ 'X-Container-Sync-To': "//%s/%s/%s/%s" %
+ (self.realm_name, self.cluster_name,
+ str(account_name), str(cont))}
+ return headers
+ self._test_container_synchronization(make_headers)
diff --git a/tempest/api/object_storage/test_object_services.py b/tempest/api/object_storage/test_object_services.py
index f78220c..cbca5e8 100644
--- a/tempest/api/object_storage/test_object_services.py
+++ b/tempest/api/object_storage/test_object_services.py
@@ -177,7 +177,7 @@
object_name = data_utils.rand_name(name='TestObject')
data = data_utils.arbitrary_string()
metadata = {'Expect': '100-continue'}
- resp = self.custom_object_client.create_object_continue(
+ resp = self.object_client.create_object_continue(
self.container_name,
object_name,
data,
@@ -186,7 +186,7 @@
self.assertIn('status', resp)
self.assertEqual(resp['status'], '100')
- self.custom_object_client.create_object_continue(
+ self.object_client.create_object_continue(
self.container_name,
object_name,
data,
@@ -1014,11 +1014,11 @@
self.assertEqual(resp_meta['x-container-read'], '.r:*,.rlistings')
# trying to get object with empty headers as it is public readable
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=None
)
- resp, body = self.custom_object_client.get_object(
+ resp, body = self.object_client.get_object(
self.container_name, object_name)
self.assertHeaders(resp, 'Object', 'GET')
@@ -1052,12 +1052,12 @@
# get auth token of alternative user
alt_auth_data = self.identity_client_alt.auth_provider.auth_data
- self.custom_object_client.auth_provider.set_alt_auth_data(
+ self.object_client.auth_provider.set_alt_auth_data(
request_part='headers',
auth_data=alt_auth_data
)
# access object using alternate user creds
- resp, body = self.custom_object_client.get_object(
+ resp, body = self.object_client.get_object(
self.container_name, object_name)
self.assertHeaders(resp, 'Object', 'GET')
diff --git a/tempest/api/orchestration/base.py b/tempest/api/orchestration/base.py
index 6896362..d3dffbf 100644
--- a/tempest/api/orchestration/base.py
+++ b/tempest/api/orchestration/base.py
@@ -68,13 +68,13 @@
environment=None, files=None):
if parameters is None:
parameters = {}
- resp, body = cls.client.create_stack(
+ body = cls.client.create_stack(
stack_name,
template=template_data,
parameters=parameters,
environment=environment,
files=files)
- stack_id = resp['location'].split('/')[-1]
+ stack_id = body.response['location'].split('/')[-1]
stack_identifier = '%s/%s' % (stack_name, stack_id)
cls.stacks.append(stack_identifier)
return stack_identifier
@@ -113,9 +113,9 @@
def _create_image(cls, name_start='image-heat-', container_format='bare',
disk_format='iso'):
image_name = data_utils.rand_name(name_start)
- _, body = cls.images_v2_client.create_image(image_name,
- container_format,
- disk_format)
+ body = cls.images_v2_client.create_image(image_name,
+ container_format,
+ disk_format)
image_id = body['id']
cls.images.append(image_id)
return body
@@ -164,7 +164,7 @@
def list_resources(self, stack_identifier):
"""Get a dict mapping of resource names to types."""
- _, resources = self.client.list_resources(stack_identifier)
+ resources = self.client.list_resources(stack_identifier)
self.assertIsInstance(resources, list)
for res in resources:
self.assert_fields_in_dict(res, 'logical_resource_id',
@@ -175,5 +175,5 @@
for r in resources)
def get_stack_output(self, stack_identifier, output_key):
- _, body = self.client.get_stack(stack_identifier)
+ body = self.client.get_stack(stack_identifier)
return self.stack_output(body, output_key)
diff --git a/tempest/api/orchestration/stacks/test_neutron_resources.py b/tempest/api/orchestration/stacks/test_neutron_resources.py
index 8352719..ea6d4be 100644
--- a/tempest/api/orchestration/stacks/test_neutron_resources.py
+++ b/tempest/api/orchestration/stacks/test_neutron_resources.py
@@ -65,14 +65,14 @@
cls.stack_id = cls.stack_identifier.split('/')[1]
try:
cls.client.wait_for_stack_status(cls.stack_id, 'CREATE_COMPLETE')
- _, resources = cls.client.list_resources(cls.stack_identifier)
+ resources = cls.client.list_resources(cls.stack_identifier)
except exceptions.TimeoutException as e:
if CONF.compute_feature_enabled.console_output:
# attempt to log the server console to help with debugging
# the cause of the server not signalling the waitcondition
# to heat.
- _, body = cls.client.get_resource(cls.stack_identifier,
- 'Server')
+ body = cls.client.get_resource(cls.stack_identifier,
+ 'Server')
server_id = body['physical_resource_id']
LOG.debug('Console output for %s', server_id)
_, output = cls.servers_client.get_console_output(
diff --git a/tempest/api/orchestration/stacks/test_non_empty_stack.py b/tempest/api/orchestration/stacks/test_non_empty_stack.py
index bf6c79c..db1ac9a 100644
--- a/tempest/api/orchestration/stacks/test_non_empty_stack.py
+++ b/tempest/api/orchestration/stacks/test_non_empty_stack.py
@@ -47,7 +47,7 @@
cls.client.wait_for_stack_status(cls.stack_id, 'CREATE_COMPLETE')
def _list_stacks(self, expected_num=None, **filter_kwargs):
- _, stacks = self.client.list_stacks(params=filter_kwargs)
+ stacks = self.client.list_stacks(params=filter_kwargs)
self.assertIsInstance(stacks, list)
if expected_num is not None:
self.assertEqual(expected_num, len(stacks))
@@ -63,7 +63,7 @@
@test.attr(type='gate')
def test_stack_show(self):
"""Getting details about created stack should be possible."""
- _, stack = self.client.get_stack(self.stack_name)
+ stack = self.client.get_stack(self.stack_name)
self.assertIsInstance(stack, dict)
self.assert_fields_in_dict(stack, 'stack_name', 'id', 'links',
'parameters', 'outputs', 'disable_rollback',
@@ -82,10 +82,10 @@
@test.attr(type='gate')
def test_suspend_resume_stack(self):
"""Suspend and resume a stack."""
- _, suspend_stack = self.client.suspend_stack(self.stack_identifier)
+ self.client.suspend_stack(self.stack_identifier)
self.client.wait_for_stack_status(self.stack_identifier,
'SUSPEND_COMPLETE')
- _, resume_stack = self.client.resume_stack(self.stack_identifier)
+ self.client.resume_stack(self.stack_identifier)
self.client.wait_for_stack_status(self.stack_identifier,
'RESUME_COMPLETE')
@@ -99,8 +99,8 @@
@test.attr(type='gate')
def test_show_resource(self):
"""Getting details about created resource should be possible."""
- _, resource = self.client.get_resource(self.stack_identifier,
- self.resource_name)
+ resource = self.client.get_resource(self.stack_identifier,
+ self.resource_name)
self.assertIsInstance(resource, dict)
self.assert_fields_in_dict(resource, 'resource_name', 'description',
'links', 'logical_resource_id',
@@ -113,7 +113,7 @@
@test.attr(type='gate')
def test_resource_metadata(self):
"""Getting metadata for created resources should be possible."""
- _, metadata = self.client.show_resource_metadata(
+ metadata = self.client.show_resource_metadata(
self.stack_identifier,
self.resource_name)
self.assertIsInstance(metadata, dict)
@@ -122,7 +122,7 @@
@test.attr(type='gate')
def test_list_events(self):
"""Getting list of created events for the stack should be possible."""
- _, events = self.client.list_events(self.stack_identifier)
+ events = self.client.list_events(self.stack_identifier)
self.assertIsInstance(events, list)
for event in events:
@@ -137,13 +137,13 @@
@test.attr(type='gate')
def test_show_event(self):
"""Getting details about an event should be possible."""
- _, events = self.client.list_resource_events(self.stack_identifier,
- self.resource_name)
+ events = self.client.list_resource_events(self.stack_identifier,
+ self.resource_name)
self.assertNotEqual([], events)
events.sort(key=lambda event: event['event_time'])
event_id = events[0]['id']
- _, event = self.client.show_event(self.stack_identifier,
- self.resource_name, event_id)
+ event = self.client.show_event(self.stack_identifier,
+ self.resource_name, event_id)
self.assertIsInstance(event, dict)
self.assert_fields_in_dict(event, 'resource_name', 'event_time',
'links', 'logical_resource_id',
diff --git a/tempest/api/orchestration/stacks/test_nova_keypair_resources.py b/tempest/api/orchestration/stacks/test_nova_keypair_resources.py
index 1da340c..772bab3 100644
--- a/tempest/api/orchestration/stacks/test_nova_keypair_resources.py
+++ b/tempest/api/orchestration/stacks/test_nova_keypair_resources.py
@@ -43,7 +43,7 @@
cls.stack_id = cls.stack_identifier.split('/')[1]
cls.client.wait_for_stack_status(cls.stack_id, 'CREATE_COMPLETE')
- _, resources = cls.client.list_resources(cls.stack_identifier)
+ resources = cls.client.list_resources(cls.stack_identifier)
cls.test_resources = {}
for resource in resources:
cls.test_resources[resource['logical_resource_id']] = resource
@@ -70,7 +70,7 @@
@test.attr(type='gate')
def test_stack_keypairs_output(self):
- _, stack = self.client.get_stack(self.stack_name)
+ stack = self.client.get_stack(self.stack_name)
self.assertIsInstance(stack, dict)
output_map = {}
diff --git a/tempest/api/orchestration/stacks/test_stacks.py b/tempest/api/orchestration/stacks/test_stacks.py
index d7fbd65..5cdd8b4 100644
--- a/tempest/api/orchestration/stacks/test_stacks.py
+++ b/tempest/api/orchestration/stacks/test_stacks.py
@@ -28,7 +28,7 @@
@test.attr(type='smoke')
def test_stack_list_responds(self):
- _, stacks = self.client.list_stacks()
+ stacks = self.client.list_stacks()
self.assertIsInstance(stacks, list)
@test.attr(type='smoke')
@@ -44,20 +44,20 @@
self.client.wait_for_stack_status(stack_identifier, 'CREATE_COMPLETE')
# check for stack in list
- _, stacks = self.client.list_stacks()
+ stacks = self.client.list_stacks()
list_ids = list([stack['id'] for stack in stacks])
self.assertIn(stack_id, list_ids)
# fetch the stack
- _, stack = self.client.get_stack(stack_identifier)
+ stack = self.client.get_stack(stack_identifier)
self.assertEqual('CREATE_COMPLETE', stack['stack_status'])
# fetch the stack by name
- _, stack = self.client.get_stack(stack_name)
+ stack = self.client.get_stack(stack_name)
self.assertEqual('CREATE_COMPLETE', stack['stack_status'])
# fetch the stack by id
- _, stack = self.client.get_stack(stack_id)
+ stack = self.client.get_stack(stack_id)
self.assertEqual('CREATE_COMPLETE', stack['stack_status'])
# delete the stack
diff --git a/tempest/api/orchestration/stacks/test_swift_resources.py b/tempest/api/orchestration/stacks/test_swift_resources.py
index 307468e..0288fd4 100644
--- a/tempest/api/orchestration/stacks/test_swift_resources.py
+++ b/tempest/api/orchestration/stacks/test_swift_resources.py
@@ -42,7 +42,7 @@
cls.stack_id = cls.stack_identifier.split('/')[1]
cls.client.wait_for_stack_status(cls.stack_id, 'CREATE_COMPLETE')
cls.test_resources = {}
- _, resources = cls.client.list_resources(cls.stack_identifier)
+ resources = cls.client.list_resources(cls.stack_identifier)
for resource in resources:
cls.test_resources[resource['logical_resource_id']] = resource
diff --git a/tempest/api/orchestration/stacks/test_templates.py b/tempest/api/orchestration/stacks/test_templates.py
index 262c576..6113cab 100644
--- a/tempest/api/orchestration/stacks/test_templates.py
+++ b/tempest/api/orchestration/stacks/test_templates.py
@@ -38,13 +38,13 @@
@test.attr(type='gate')
def test_show_template(self):
"""Getting template used to create the stack."""
- _, template = self.client.show_template(self.stack_identifier)
+ self.client.show_template(self.stack_identifier)
@test.attr(type='gate')
def test_validate_template(self):
"""Validating template passing it content."""
- _, parameters = self.client.validate_template(self.template,
- self.parameters)
+ self.client.validate_template(self.template,
+ self.parameters)
class TemplateAWSTestJSON(TemplateYAMLTestJSON):
diff --git a/tempest/api/orchestration/stacks/test_volumes.py b/tempest/api/orchestration/stacks/test_volumes.py
index f47078c..6fddb21 100644
--- a/tempest/api/orchestration/stacks/test_volumes.py
+++ b/tempest/api/orchestration/stacks/test_volumes.py
@@ -33,7 +33,7 @@
def _cinder_verify(self, volume_id, template):
self.assertIsNotNone(volume_id)
- _, volume = self.volumes_client.get_volume(volume_id)
+ volume = self.volumes_client.get_volume(volume_id)
self.assertEqual('available', volume.get('status'))
self.assertEqual(template['resources']['volume']['properties'][
'size'], volume.get('size'))
diff --git a/tempest/api/telemetry/base.py b/tempest/api/telemetry/base.py
index 769c201..e840e3b 100644
--- a/tempest/api/telemetry/base.py
+++ b/tempest/api/telemetry/base.py
@@ -69,11 +69,11 @@
@classmethod
def create_image(cls, client):
- resp, body = client.create_image(
+ body = client.create_image(
data_utils.rand_name('image'), container_format='bare',
disk_format='raw', visibility='private')
cls.image_ids.append(body['id'])
- return resp, body
+ return body
@staticmethod
def cleanup_resources(method, list_of_ids):
diff --git a/tempest/api/telemetry/test_telemetry_notification_api.py b/tempest/api/telemetry/test_telemetry_notification_api.py
index 7267183..e64cd4a 100644
--- a/tempest/api/telemetry/test_telemetry_notification_api.py
+++ b/tempest/api/telemetry/test_telemetry_notification_api.py
@@ -48,7 +48,7 @@
"Glance api v1 is disabled")
@test.skip_because(bug='1351627')
def test_check_glance_v1_notifications(self):
- _, body = self.create_image(self.image_client)
+ body = self.create_image(self.image_client)
self.image_client.update_image(body['id'], data='data')
query = 'resource', 'eq', body['id']
@@ -64,7 +64,7 @@
"Glance api v2 is disabled")
@test.skip_because(bug='1351627')
def test_check_glance_v2_notifications(self):
- _, body = self.create_image(self.image_client_v2)
+ body = self.create_image(self.image_client_v2)
self.image_client_v2.store_image(body['id'], "file")
self.image_client_v2.get_image_file(body['id'])
diff --git a/tempest/api/volume/admin/test_multi_backend.py b/tempest/api/volume/admin/test_multi_backend.py
index 9e24993..65c4bd3 100644
--- a/tempest/api/volume/admin/test_multi_backend.py
+++ b/tempest/api/volume/admin/test_multi_backend.py
@@ -60,14 +60,14 @@
extra_specs = {spec_key_with_prefix: backend_name_key}
else:
extra_specs = {spec_key_without_prefix: backend_name_key}
- _, self.type = self.volume_types_client.create_volume_type(
+ self.type = self.volume_types_client.create_volume_type(
type_name, extra_specs=extra_specs)
self.volume_type_id_list.append(self.type['id'])
params = {self.name_field: vol_name, 'volume_type': type_name}
- _, self.volume = self.admin_volume_client.create_volume(size=1,
- **params)
+ self.volume = self.admin_volume_client.create_volume(size=1,
+ **params)
if with_prefix:
self.volume_id_list_with_prefix.append(self.volume['id'])
else:
@@ -131,7 +131,7 @@
# the multi backend feature has been enabled
# if multi-backend is enabled: os-vol-attr:host should be like:
# host@backend_name
- _, volume = self.admin_volume_client.get_volume(volume_id)
+ volume = self.admin_volume_client.get_volume(volume_id)
volume1_host = volume['os-vol-host-attr:host']
msg = ("multi-backend reporting incorrect values for volume %s" %
@@ -142,10 +142,10 @@
# this test checks that the two volumes created at setUp don't
# belong to the same backend (if they are, than the
# volume backend distinction is not working properly)
- _, volume = self.admin_volume_client.get_volume(volume1_id)
+ volume = self.admin_volume_client.get_volume(volume1_id)
volume1_host = volume['os-vol-host-attr:host']
- _, volume = self.admin_volume_client.get_volume(volume2_id)
+ volume = self.admin_volume_client.get_volume(volume2_id)
volume2_host = volume['os-vol-host-attr:host']
msg = ("volumes %s and %s were created in the same backend" %
diff --git a/tempest/api/volume/admin/test_snapshots_actions.py b/tempest/api/volume/admin/test_snapshots_actions.py
index 31dc09f..6c64298 100644
--- a/tempest/api/volume/admin/test_snapshots_actions.py
+++ b/tempest/api/volume/admin/test_snapshots_actions.py
@@ -30,7 +30,7 @@
vol_name = data_utils.rand_name(cls.__name__ + '-Volume-')
cls.name_field = cls.special_fields['name_field']
params = {cls.name_field: vol_name}
- _, cls.volume = \
+ cls.volume = \
cls.volumes_client.create_volume(size=1, **params)
cls.volumes_client.wait_for_volume_status(cls.volume['id'],
'available')
@@ -38,7 +38,7 @@
# Create a test shared snapshot for tests
snap_name = data_utils.rand_name(cls.__name__ + '-Snapshot-')
params = {cls.name_field: snap_name}
- _, cls.snapshot = \
+ cls.snapshot = \
cls.client.create_snapshot(cls.volume['id'], **params)
cls.client.wait_for_snapshot_status(cls.snapshot['id'],
'available')
@@ -68,9 +68,9 @@
# and force delete temp snapshot
temp_snapshot = self.create_snapshot(self.volume['id'])
if status:
- _, body = self.admin_snapshots_client.\
+ self.admin_snapshots_client.\
reset_snapshot_status(temp_snapshot['id'], status)
- _, volume_delete = self.admin_snapshots_client.\
+ self.admin_snapshots_client.\
force_delete_snapshot(temp_snapshot['id'])
self.client.wait_for_resource_deletion(temp_snapshot['id'])
@@ -81,9 +81,9 @@
def test_reset_snapshot_status(self):
# Reset snapshot status to creating
status = 'creating'
- _, body = self.admin_snapshots_client.\
+ self.admin_snapshots_client.\
reset_snapshot_status(self.snapshot['id'], status)
- _, snapshot_get \
+ snapshot_get \
= self.admin_snapshots_client.get_snapshot(self.snapshot['id'])
self.assertEqual(status, snapshot_get['status'])
@@ -98,9 +98,9 @@
progress = '80%'
status = 'error'
progress_alias = self._get_progress_alias()
- _, body = self.client.update_snapshot_status(self.snapshot['id'],
- status, progress)
- _, snapshot_get \
+ self.client.update_snapshot_status(self.snapshot['id'],
+ status, progress)
+ snapshot_get \
= self.admin_snapshots_client.get_snapshot(self.snapshot['id'])
self.assertEqual(status, snapshot_get['status'])
self.assertEqual(progress, snapshot_get[progress_alias])
diff --git a/tempest/api/volume/admin/test_volume_hosts.py b/tempest/api/volume/admin/test_volume_hosts.py
index e966613..a214edf 100644
--- a/tempest/api/volume/admin/test_volume_hosts.py
+++ b/tempest/api/volume/admin/test_volume_hosts.py
@@ -22,7 +22,7 @@
@test.attr(type='gate')
def test_list_hosts(self):
- _, hosts = self.hosts_client.list_hosts()
+ hosts = self.hosts_client.list_hosts()
self.assertTrue(len(hosts) >= 2, "No. of hosts are < 2,"
"response of list hosts is: % s" % hosts)
diff --git a/tempest/api/volume/admin/test_volume_quotas.py b/tempest/api/volume/admin/test_volume_quotas.py
index 50bab56..52f2d90 100644
--- a/tempest/api/volume/admin/test_volume_quotas.py
+++ b/tempest/api/volume/admin/test_volume_quotas.py
@@ -33,13 +33,13 @@
@test.attr(type='gate')
def test_list_quotas(self):
- _, quotas = self.quotas_client.get_quota_set(self.demo_tenant_id)
+ quotas = self.quotas_client.get_quota_set(self.demo_tenant_id)
for key in QUOTA_KEYS:
self.assertIn(key, quotas)
@test.attr(type='gate')
def test_list_default_quotas(self):
- _, quotas = self.quotas_client.get_default_quota_set(
+ quotas = self.quotas_client.get_default_quota_set(
self.demo_tenant_id)
for key in QUOTA_KEYS:
self.assertIn(key, quotas)
@@ -47,14 +47,14 @@
@test.attr(type='gate')
def test_update_all_quota_resources_for_tenant(self):
# Admin can update all the resource quota limits for a tenant
- _, default_quota_set = self.quotas_client.get_default_quota_set(
+ default_quota_set = self.quotas_client.get_default_quota_set(
self.demo_tenant_id)
new_quota_set = {'gigabytes': 1009,
'volumes': 11,
'snapshots': 11}
# Update limits for all quota resources
- _, quota_set = self.quotas_client.update_quota_set(
+ quota_set = self.quotas_client.update_quota_set(
self.demo_tenant_id,
**new_quota_set)
@@ -70,7 +70,7 @@
@test.attr(type='gate')
def test_show_quota_usage(self):
- _, quota_usage = self.quotas_client.get_quota_usage(
+ quota_usage = self.quotas_client.get_quota_usage(
self.os_adm.credentials.tenant_id)
for key in QUOTA_KEYS:
self.assertIn(key, quota_usage)
@@ -79,14 +79,14 @@
@test.attr(type='gate')
def test_quota_usage(self):
- _, quota_usage = self.quotas_client.get_quota_usage(
+ quota_usage = self.quotas_client.get_quota_usage(
self.demo_tenant_id)
volume = self.create_volume(size=1)
self.addCleanup(self.admin_volume_client.delete_volume,
volume['id'])
- _, new_quota_usage = self.quotas_client.get_quota_usage(
+ new_quota_usage = self.quotas_client.get_quota_usage(
self.demo_tenant_id)
self.assertEqual(quota_usage['volumes']['in_use'] + 1,
@@ -100,10 +100,10 @@
# Admin can delete the resource quota set for a tenant
tenant_name = data_utils.rand_name('quota_tenant_')
identity_client = self.os_adm.identity_client
- tenant = identity_client.create_tenant(tenant_name)[1]
+ tenant = identity_client.create_tenant(tenant_name)
tenant_id = tenant['id']
self.addCleanup(identity_client.delete_tenant, tenant_id)
- _, quota_set_default = self.quotas_client.get_default_quota_set(
+ quota_set_default = self.quotas_client.get_default_quota_set(
tenant_id)
volume_default = quota_set_default['volumes']
@@ -111,7 +111,7 @@
volumes=(int(volume_default) + 5))
self.quotas_client.delete_quota_set(tenant_id)
- _, quota_set_new = self.quotas_client.get_quota_set(tenant_id)
+ quota_set_new = self.quotas_client.get_quota_set(tenant_id)
self.assertEqual(volume_default, quota_set_new['volumes'])
diff --git a/tempest/api/volume/admin/test_volume_quotas_negative.py b/tempest/api/volume/admin/test_volume_quotas_negative.py
index c367ebb..5cf6af0 100644
--- a/tempest/api/volume/admin/test_volume_quotas_negative.py
+++ b/tempest/api/volume/admin/test_volume_quotas_negative.py
@@ -31,7 +31,7 @@
# NOTE(gfidente): no need to restore original quota set
# after the tests as they only work with tenant isolation.
- _, quota_set = cls.quotas_client.update_quota_set(
+ cls.quotas_client.update_quota_set(
cls.demo_tenant_id,
**cls.shared_quota_set)
@@ -62,7 +62,7 @@
**self.shared_quota_set)
new_quota_set = {'gigabytes': 2, 'volumes': 2, 'snapshots': 1}
- _, quota_set = self.quotas_client.update_quota_set(
+ self.quotas_client.update_quota_set(
self.demo_tenant_id,
**new_quota_set)
self.assertRaises(exceptions.OverLimit,
@@ -70,7 +70,7 @@
size=1)
new_quota_set = {'gigabytes': 2, 'volumes': 1, 'snapshots': 2}
- _, quota_set = self.quotas_client.update_quota_set(
+ self.quotas_client.update_quota_set(
self.demo_tenant_id,
**self.shared_quota_set)
self.assertRaises(exceptions.OverLimit,
diff --git a/tempest/api/volume/admin/test_volume_services.py b/tempest/api/volume/admin/test_volume_services.py
index fffc5cb..46db70f 100644
--- a/tempest/api/volume/admin/test_volume_services.py
+++ b/tempest/api/volume/admin/test_volume_services.py
@@ -27,19 +27,19 @@
@classmethod
def resource_setup(cls):
super(VolumesServicesV2TestJSON, cls).resource_setup()
- _, cls.services = cls.admin_volume_services_client.list_services()
+ cls.services = cls.admin_volume_services_client.list_services()
cls.host_name = cls.services[0]['host']
cls.binary_name = cls.services[0]['binary']
@test.attr(type='gate')
def test_list_services(self):
- _, services = self.admin_volume_services_client.list_services()
+ services = self.admin_volume_services_client.list_services()
self.assertNotEqual(0, len(services))
@test.attr(type='gate')
def test_get_service_by_service_binary_name(self):
params = {'binary': self.binary_name}
- _, services = self.admin_volume_services_client.list_services(params)
+ services = self.admin_volume_services_client.list_services(params)
self.assertNotEqual(0, len(services))
for service in services:
self.assertEqual(self.binary_name, service['binary'])
@@ -50,7 +50,7 @@
service['host'] == self.host_name]
params = {'host': self.host_name}
- _, services = self.admin_volume_services_client.list_services(params)
+ services = self.admin_volume_services_client.list_services(params)
# we could have a periodic job checkin between the 2 service
# lookups, so only compare binary lists.
@@ -64,7 +64,7 @@
def test_get_service_by_service_and_host_name(self):
params = {'host': self.host_name, 'binary': self.binary_name}
- _, services = self.admin_volume_services_client.list_services(params)
+ services = self.admin_volume_services_client.list_services(params)
self.assertEqual(1, len(services))
self.assertEqual(self.host_name, services[0]['host'])
self.assertEqual(self.binary_name, services[0]['binary'])
diff --git a/tempest/api/volume/admin/test_volume_types.py b/tempest/api/volume/admin/test_volume_types.py
index a481224..58f1551 100644
--- a/tempest/api/volume/admin/test_volume_types.py
+++ b/tempest/api/volume/admin/test_volume_types.py
@@ -34,7 +34,7 @@
@test.attr(type='smoke')
def test_volume_type_list(self):
# List Volume types.
- _, body = self.volume_types_client.list_volume_types()
+ body = self.volume_types_client.list_volume_types()
self.assertIsInstance(body, list)
@test.attr(type='smoke')
@@ -49,14 +49,14 @@
extra_specs = {"storage_protocol": proto,
"vendor_name": vendor}
body = {}
- _, body = self.volume_types_client.create_volume_type(
+ body = self.volume_types_client.create_volume_type(
vol_type_name,
extra_specs=extra_specs)
self.assertIn('id', body)
self.addCleanup(self._delete_volume_type, body['id'])
self.assertIn('name', body)
params = {self.name_field: vol_name, 'volume_type': vol_type_name}
- _, volume = self.volumes_client.create_volume(
+ volume = self.volumes_client.create_volume(
size=1, **params)
self.assertIn('id', volume)
self.addCleanup(self._delete_volume, volume['id'])
@@ -67,7 +67,7 @@
self.assertTrue(volume['id'] is not None,
"Field volume id is empty or not found.")
self.volumes_client.wait_for_volume_status(volume['id'], 'available')
- _, fetched_volume = self.volumes_client.get_volume(volume['id'])
+ fetched_volume = self.volumes_client.get_volume(volume['id'])
self.assertEqual(vol_name, fetched_volume[self.name_field],
'The fetched Volume is different '
'from the created Volume')
@@ -87,7 +87,7 @@
vendor = CONF.volume.vendor_name
extra_specs = {"storage_protocol": proto,
"vendor_name": vendor}
- _, body = self.volume_types_client.create_volume_type(
+ body = self.volume_types_client.create_volume_type(
name,
extra_specs=extra_specs)
self.assertIn('id', body)
@@ -98,7 +98,7 @@
"to the requested name")
self.assertTrue(body['id'] is not None,
"Field volume_type id is empty or not found.")
- _, fetched_volume_type = self.volume_types_client.get_volume_type(
+ fetched_volume_type = self.volume_types_client.get_volume_type(
body['id'])
self.assertEqual(name, fetched_volume_type['name'],
'The fetched Volume_type is different '
@@ -116,11 +116,11 @@
provider = "LuksEncryptor"
control_location = "front-end"
name = data_utils.rand_name("volume-type-")
- _, body = self.volume_types_client.create_volume_type(name)
+ body = self.volume_types_client.create_volume_type(name)
self.addCleanup(self._delete_volume_type, body['id'])
# Create encryption type
- _, encryption_type = self.volume_types_client.create_encryption_type(
+ encryption_type = self.volume_types_client.create_encryption_type(
body['id'], provider=provider,
control_location=control_location)
self.assertIn('volume_type_id', encryption_type)
@@ -132,7 +132,7 @@
"equal to the requested control_location")
# Get encryption type
- _, fetched_encryption_type = (
+ fetched_encryption_type = (
self.volume_types_client.get_encryption_type(
encryption_type['volume_type_id']))
self.assertEqual(provider,
@@ -150,7 +150,7 @@
resource = {"id": encryption_type['volume_type_id'],
"type": "encryption-type"}
self.volume_types_client.wait_for_resource_deletion(resource)
- _, deleted_encryption_type = (
+ deleted_encryption_type = (
self.volume_types_client.get_encryption_type(
encryption_type['volume_type_id']))
self.assertEmpty(deleted_encryption_type)
diff --git a/tempest/api/volume/admin/test_volume_types_extra_specs.py b/tempest/api/volume/admin/test_volume_types_extra_specs.py
index 3b9f6bb..460a6c3 100644
--- a/tempest/api/volume/admin/test_volume_types_extra_specs.py
+++ b/tempest/api/volume/admin/test_volume_types_extra_specs.py
@@ -25,7 +25,7 @@
def resource_setup(cls):
super(VolumeTypesExtraSpecsV2Test, cls).resource_setup()
vol_type_name = data_utils.rand_name('Volume-type-')
- _, cls.volume_type = cls.volume_types_client.create_volume_type(
+ cls.volume_type = cls.volume_types_client.create_volume_type(
vol_type_name)
@classmethod
@@ -37,11 +37,11 @@
def test_volume_type_extra_specs_list(self):
# List Volume types extra specs.
extra_specs = {"spec1": "val1"}
- _, body = self.volume_types_client.create_volume_type_extra_specs(
+ body = self.volume_types_client.create_volume_type_extra_specs(
self.volume_type['id'], extra_specs)
self.assertEqual(extra_specs, body,
"Volume type extra spec incorrectly created")
- _, body = self.volume_types_client.list_volume_types_extra_specs(
+ body = self.volume_types_client.list_volume_types_extra_specs(
self.volume_type['id'])
self.assertIsInstance(body, dict)
self.assertIn('spec1', body)
@@ -50,13 +50,13 @@
def test_volume_type_extra_specs_update(self):
# Update volume type extra specs
extra_specs = {"spec2": "val1"}
- _, body = self.volume_types_client.create_volume_type_extra_specs(
+ body = self.volume_types_client.create_volume_type_extra_specs(
self.volume_type['id'], extra_specs)
self.assertEqual(extra_specs, body,
"Volume type extra spec incorrectly created")
extra_spec = {"spec2": "val2"}
- _, body = self.volume_types_client.update_volume_type_extra_specs(
+ body = self.volume_types_client.update_volume_type_extra_specs(
self.volume_type['id'],
extra_spec.keys()[0],
extra_spec)
@@ -68,7 +68,7 @@
def test_volume_type_extra_spec_create_get_delete(self):
# Create/Get/Delete volume type extra spec.
extra_specs = {"spec3": "val1"}
- _, body = self.volume_types_client.create_volume_type_extra_specs(
+ body = self.volume_types_client.create_volume_type_extra_specs(
self.volume_type['id'],
extra_specs)
self.assertEqual(extra_specs, body,
diff --git a/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py b/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
index 40af37e..fff0199 100644
--- a/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
+++ b/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
@@ -29,7 +29,7 @@
super(ExtraSpecsNegativeV2Test, cls).resource_setup()
vol_type_name = data_utils.rand_name('Volume-type-')
cls.extra_specs = {"spec1": "val1"}
- _, cls.volume_type = cls.volume_types_client.create_volume_type(
+ cls.volume_type = cls.volume_types_client.create_volume_type(
vol_type_name,
extra_specs=cls.extra_specs)
diff --git a/tempest/api/volume/admin/test_volumes_actions.py b/tempest/api/volume/admin/test_volumes_actions.py
index 8db6106..4feba73 100644
--- a/tempest/api/volume/admin/test_volumes_actions.py
+++ b/tempest/api/volume/admin/test_volumes_actions.py
@@ -31,8 +31,8 @@
cls.name_field = cls.special_fields['name_field']
params = {cls.name_field: vol_name}
- _, cls.volume = cls.client.create_volume(size=1,
- **params)
+ cls.volume = cls.client.create_volume(size=1,
+ **params)
cls.client.wait_for_volume_status(cls.volume['id'], 'available')
@classmethod
@@ -45,9 +45,9 @@
def _reset_volume_status(self, volume_id, status):
# Reset the volume status
- _, body = self.admin_volume_client.reset_volume_status(volume_id,
- status)
- return _, body
+ body = self.admin_volume_client.reset_volume_status(volume_id,
+ status)
+ return body
def tearDown(self):
# Set volume's status to available after test
@@ -58,8 +58,8 @@
# Create a temp volume for force delete tests
vol_name = utils.rand_name('Volume')
params = {self.name_field: vol_name}
- _, temp_volume = self.client.create_volume(size=1,
- **params)
+ temp_volume = self.client.create_volume(size=1,
+ **params)
self.client.wait_for_volume_status(temp_volume['id'], 'available')
return temp_volume
@@ -68,16 +68,15 @@
# Create volume, reset volume status, and force delete temp volume
temp_volume = self._create_temp_volume()
if status:
- _, body = self._reset_volume_status(temp_volume['id'], status)
- _, volume_delete = self.admin_volume_client.\
- force_delete_volume(temp_volume['id'])
+ self._reset_volume_status(temp_volume['id'], status)
+ self.admin_volume_client.force_delete_volume(temp_volume['id'])
self.client.wait_for_resource_deletion(temp_volume['id'])
@test.attr(type='gate')
def test_volume_reset_status(self):
# test volume reset status : available->error->available
- _, body = self._reset_volume_status(self.volume['id'], 'error')
- _, volume_get = self.admin_volume_client.get_volume(
+ self._reset_volume_status(self.volume['id'], 'error')
+ volume_get = self.admin_volume_client.get_volume(
self.volume['id'])
self.assertEqual('error', volume_get['status'])
diff --git a/tempest/api/volume/admin/test_volumes_backup.py b/tempest/api/volume/admin/test_volumes_backup.py
index 1357d31..0739480 100644
--- a/tempest/api/volume/admin/test_volumes_backup.py
+++ b/tempest/api/volume/admin/test_volumes_backup.py
@@ -40,8 +40,8 @@
# Create backup
backup_name = data_utils.rand_name('Backup')
create_backup = self.backups_adm_client.create_backup
- _, backup = create_backup(self.volume['id'],
- name=backup_name)
+ backup = create_backup(self.volume['id'],
+ name=backup_name)
self.addCleanup(self.backups_adm_client.delete_backup,
backup['id'])
self.assertEqual(backup_name, backup['name'])
@@ -51,16 +51,16 @@
'available')
# Get a given backup
- _, backup = self.backups_adm_client.get_backup(backup['id'])
+ backup = self.backups_adm_client.get_backup(backup['id'])
self.assertEqual(backup_name, backup['name'])
# Get all backups with detail
- _, backups = self.backups_adm_client.list_backups_with_detail()
+ backups = self.backups_adm_client.list_backups_with_detail()
self.assertIn((backup['name'], backup['id']),
[(m['name'], m['id']) for m in backups])
# Restore backup
- _, restore = self.backups_adm_client.restore_backup(backup['id'])
+ restore = self.backups_adm_client.restore_backup(backup['id'])
# Delete backup
self.addCleanup(self.admin_volume_client.delete_volume,
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index 52e48f3..127a216 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -97,7 +97,7 @@
name_field = cls.special_fields['name_field']
kwargs[name_field] = name
- _, volume = cls.volumes_client.create_volume(size, **kwargs)
+ volume = cls.volumes_client.create_volume(size, **kwargs)
cls.volumes.append(volume)
cls.volumes_client.wait_for_volume_status(volume['id'], 'available')
@@ -106,8 +106,8 @@
@classmethod
def create_snapshot(cls, volume_id=1, **kwargs):
"""Wrapper utility that returns a test snapshot."""
- _, snapshot = cls.snapshots_client.create_snapshot(volume_id,
- **kwargs)
+ snapshot = cls.snapshots_client.create_snapshot(volume_id,
+ **kwargs)
cls.snapshots.append(snapshot)
cls.snapshots_client.wait_for_snapshot_status(snapshot['id'],
'available')
@@ -198,8 +198,8 @@
"""create a test Qos-Specs."""
name = name or data_utils.rand_name(cls.__name__ + '-QoS')
consumer = consumer or 'front-end'
- _, qos_specs = cls.volume_qos_client.create_qos(name, consumer,
- **kwargs)
+ qos_specs = cls.volume_qos_client.create_qos(name, consumer,
+ **kwargs)
cls.qos_specs.append(qos_specs['id'])
return qos_specs
diff --git a/tempest/api/volume/test_availability_zone.py b/tempest/api/volume/test_availability_zone.py
index c3d5d02..bd3d2a1 100644
--- a/tempest/api/volume/test_availability_zone.py
+++ b/tempest/api/volume/test_availability_zone.py
@@ -31,7 +31,7 @@
@test.attr(type='gate')
def test_get_availability_zone_list(self):
# List of availability zone
- _, availability_zone = self.client.get_availability_zone_list()
+ availability_zone = self.client.get_availability_zone_list()
self.assertTrue(len(availability_zone) > 0)
diff --git a/tempest/api/volume/test_extensions.py b/tempest/api/volume/test_extensions.py
index 0f6c2d6..dbbdea4 100644
--- a/tempest/api/volume/test_extensions.py
+++ b/tempest/api/volume/test_extensions.py
@@ -30,7 +30,7 @@
@test.attr(type='gate')
def test_list_extensions(self):
# List of all extensions
- _, extensions = self.volumes_extension_client.list_extensions()
+ extensions = self.volumes_extension_client.list_extensions()
if len(CONF.volume_feature_enabled.api_extensions) == 0:
raise self.skipException('There are not any extensions configured')
extension_list = [extension.get('alias') for extension in extensions]
diff --git a/tempest/api/volume/test_qos.py b/tempest/api/volume/test_qos.py
index a719b79..60c327b 100644
--- a/tempest/api/volume/test_qos.py
+++ b/tempest/api/volume/test_qos.py
@@ -47,12 +47,12 @@
self.volume_qos_client.wait_for_resource_deletion(body['id'])
# validate the deletion
- _, list_qos = self.volume_qos_client.list_qos()
+ list_qos = self.volume_qos_client.list_qos()
self.assertNotIn(body, list_qos)
def _create_test_volume_type(self):
vol_type_name = utils.rand_name("volume-type")
- _, vol_type = self.volume_types_client.create_volume_type(
+ vol_type = self.volume_types_client.create_volume_type(
vol_type_name)
self.addCleanup(self.volume_types_client.delete_volume_type,
vol_type['id'])
@@ -63,7 +63,7 @@
self.created_qos['id'], vol_type_id)
def _test_get_association_qos(self):
- _, body = self.volume_qos_client.get_association_qos(
+ body = self.volume_qos_client.get_association_qos(
self.created_qos['id'])
associations = []
@@ -97,24 +97,24 @@
@test.attr(type='smoke')
def test_get_qos(self):
"""Tests the detail of a given qos-specs"""
- _, body = self.volume_qos_client.get_qos(self.created_qos['id'])
+ body = self.volume_qos_client.get_qos(self.created_qos['id'])
self.assertEqual(self.qos_name, body['name'])
self.assertEqual(self.qos_consumer, body['consumer'])
@test.attr(type='smoke')
def test_list_qos(self):
"""Tests the list of all qos-specs"""
- _, body = self.volume_qos_client.list_qos()
+ body = self.volume_qos_client.list_qos()
self.assertIn(self.created_qos, body)
@test.attr(type='smoke')
def test_set_unset_qos_key(self):
"""Test the addition of a specs key to qos-specs"""
args = {'iops_bytes': '500'}
- _, body = self.volume_qos_client.set_qos_key(self.created_qos['id'],
- iops_bytes='500')
+ body = self.volume_qos_client.set_qos_key(self.created_qos['id'],
+ iops_bytes='500')
self.assertEqual(args, body)
- _, body = self.volume_qos_client.get_qos(self.created_qos['id'])
+ body = self.volume_qos_client.get_qos(self.created_qos['id'])
self.assertEqual(args['iops_bytes'], body['specs']['iops_bytes'])
# test the deletion of a specs key from qos-specs
@@ -123,7 +123,7 @@
operation = 'qos-key-unset'
self.volume_qos_client.wait_for_qos_operations(self.created_qos['id'],
operation, keys)
- _, body = self.volume_qos_client.get_qos(self.created_qos['id'])
+ body = self.volume_qos_client.get_qos(self.created_qos['id'])
self.assertNotIn(keys[0], body['specs'])
@test.attr(type='smoke')
diff --git a/tempest/api/volume/test_snapshot_metadata.py b/tempest/api/volume/test_snapshot_metadata.py
index 0dceb3d..03474ba 100644
--- a/tempest/api/volume/test_snapshot_metadata.py
+++ b/tempest/api/volume/test_snapshot_metadata.py
@@ -42,15 +42,15 @@
"key3": "value3"}
expected = {"key2": "value2",
"key3": "value3"}
- _, body = self.client.create_snapshot_metadata(self.snapshot_id,
- metadata)
+ body = self.client.create_snapshot_metadata(self.snapshot_id,
+ metadata)
# Get the metadata of the snapshot
- _, body = self.client.get_snapshot_metadata(self.snapshot_id)
+ body = self.client.get_snapshot_metadata(self.snapshot_id)
self.assertEqual(metadata, body)
# Delete one item metadata of the snapshot
self.client.delete_snapshot_metadata_item(
self.snapshot_id, "key1")
- _, body = self.client.get_snapshot_metadata(self.snapshot_id)
+ body = self.client.get_snapshot_metadata(self.snapshot_id)
self.assertEqual(expected, body)
@test.attr(type='gate')
@@ -62,16 +62,16 @@
update = {"key3": "value3_update",
"key4": "value4"}
# Create metadata for the snapshot
- _, body = self.client.create_snapshot_metadata(self.snapshot_id,
- metadata)
+ body = self.client.create_snapshot_metadata(self.snapshot_id,
+ metadata)
# Get the metadata of the snapshot
- _, body = self.client.get_snapshot_metadata(self.snapshot_id)
+ body = self.client.get_snapshot_metadata(self.snapshot_id)
self.assertEqual(metadata, body)
# Update metadata item
- _, body = self.client.update_snapshot_metadata(
+ body = self.client.update_snapshot_metadata(
self.snapshot_id, update)
# Get the metadata of the snapshot
- _, body = self.client.get_snapshot_metadata(self.snapshot_id)
+ body = self.client.get_snapshot_metadata(self.snapshot_id)
self.assertEqual(update, body)
@test.attr(type='gate')
@@ -85,16 +85,16 @@
"key2": "value2",
"key3": "value3_update"}
# Create metadata for the snapshot
- _, body = self.client.create_snapshot_metadata(self.snapshot_id,
- metadata)
+ body = self.client.create_snapshot_metadata(self.snapshot_id,
+ metadata)
# Get the metadata of the snapshot
- _, body = self.client.get_snapshot_metadata(self.snapshot_id)
+ body = self.client.get_snapshot_metadata(self.snapshot_id)
self.assertEqual(metadata, body)
# Update metadata item
- _, body = self.client.update_snapshot_metadata_item(
+ body = self.client.update_snapshot_metadata_item(
self.snapshot_id, "key3", update_item)
# Get the metadata of the snapshot
- _, body = self.client.get_snapshot_metadata(self.snapshot_id)
+ body = self.client.get_snapshot_metadata(self.snapshot_id)
self.assertEqual(expect, body)
diff --git a/tempest/api/volume/test_volume_metadata.py b/tempest/api/volume/test_volume_metadata.py
index ac5d016..4739fd2 100644
--- a/tempest/api/volume/test_volume_metadata.py
+++ b/tempest/api/volume/test_volume_metadata.py
@@ -41,15 +41,15 @@
"key3": "value3",
"key4": "<value&special_chars>"}
- _, body = self.volumes_client.create_volume_metadata(self.volume_id,
- metadata)
+ body = self.volumes_client.create_volume_metadata(self.volume_id,
+ metadata)
# Get the metadata of the volume
- _, body = self.volumes_client.get_volume_metadata(self.volume_id)
+ body = self.volumes_client.get_volume_metadata(self.volume_id)
self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
# Delete one item metadata of the volume
self.volumes_client.delete_volume_metadata_item(
self.volume_id, "key1")
- _, body = self.volumes_client.get_volume_metadata(self.volume_id)
+ body = self.volumes_client.get_volume_metadata(self.volume_id)
self.assertNotIn("key1", body)
del metadata["key1"]
self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
@@ -65,16 +65,16 @@
"key1": "value1_update"}
# Create metadata for the volume
- _, body = self.volumes_client.create_volume_metadata(
+ body = self.volumes_client.create_volume_metadata(
self.volume_id, metadata)
# Get the metadata of the volume
- _, body = self.volumes_client.get_volume_metadata(self.volume_id)
+ body = self.volumes_client.get_volume_metadata(self.volume_id)
self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
# Update metadata
- _, body = self.volumes_client.update_volume_metadata(
+ body = self.volumes_client.update_volume_metadata(
self.volume_id, update)
# Get the metadata of the volume
- _, body = self.volumes_client.get_volume_metadata(self.volume_id)
+ body = self.volumes_client.get_volume_metadata(self.volume_id)
self.assertThat(body.items(), matchers.ContainsAll(update.items()))
@test.attr(type='gate')
@@ -88,14 +88,14 @@
"key2": "value2",
"key3": "value3_update"}
# Create metadata for the volume
- _, body = self.volumes_client.create_volume_metadata(
+ body = self.volumes_client.create_volume_metadata(
self.volume_id, metadata)
self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
# Update metadata item
- _, body = self.volumes_client.update_volume_metadata_item(
+ body = self.volumes_client.update_volume_metadata_item(
self.volume_id, "key3", update_item)
# Get the metadata of the volume
- _, body = self.volumes_client.get_volume_metadata(self.volume_id)
+ body = self.volumes_client.get_volume_metadata(self.volume_id)
self.assertThat(body.items(), matchers.ContainsAll(expect.items()))
diff --git a/tempest/api/volume/test_volume_transfers.py b/tempest/api/volume/test_volume_transfers.py
index 2011c1b..b2961bd 100644
--- a/tempest/api/volume/test_volume_transfers.py
+++ b/tempest/api/volume/test_volume_transfers.py
@@ -58,24 +58,24 @@
self.addCleanup(self._delete_volume, volume['id'])
# Create a volume transfer
- _, transfer = self.client.create_volume_transfer(volume['id'])
+ transfer = self.client.create_volume_transfer(volume['id'])
transfer_id = transfer['id']
auth_key = transfer['auth_key']
self.client.wait_for_volume_status(volume['id'],
'awaiting-transfer')
# Get a volume transfer
- _, body = self.client.get_volume_transfer(transfer_id)
+ body = self.client.get_volume_transfer(transfer_id)
self.assertEqual(volume['id'], body['volume_id'])
# List volume transfers, the result should be greater than
# or equal to 1
- _, body = self.client.list_volume_transfers()
+ body = self.client.list_volume_transfers()
self.assertThat(len(body), matchers.GreaterThan(0))
# Accept a volume transfer by alt_tenant
- _, body = self.alt_client.accept_volume_transfer(transfer_id,
- auth_key)
+ body = self.alt_client.accept_volume_transfer(transfer_id,
+ auth_key)
self.alt_client.wait_for_volume_status(volume['id'], 'available')
def test_create_list_delete_volume_transfer(self):
@@ -84,13 +84,13 @@
self.addCleanup(self._delete_volume, volume['id'])
# Create a volume transfer
- _, body = self.client.create_volume_transfer(volume['id'])
+ body = self.client.create_volume_transfer(volume['id'])
transfer_id = body['id']
self.client.wait_for_volume_status(volume['id'],
'awaiting-transfer')
# List all volume transfers (looking for the one we created)
- _, body = self.client.list_volume_transfers()
+ body = self.client.list_volume_transfers()
for transfer in body:
if volume['id'] == transfer['volume_id']:
break
diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py
index 4fd27b1..ceabb1c 100644
--- a/tempest/api/volume/test_volumes_actions.py
+++ b/tempest/api/volume/test_volumes_actions.py
@@ -57,11 +57,11 @@
def test_attach_detach_volume_to_instance(self):
# Volume is attached and detached successfully from an instance
mountpoint = '/dev/vdc'
- _, body = self.client.attach_volume(self.volume['id'],
- self.server['id'],
- mountpoint)
+ self.client.attach_volume(self.volume['id'],
+ self.server['id'],
+ mountpoint)
self.client.wait_for_volume_status(self.volume['id'], 'in-use')
- _, body = self.client.detach_volume(self.volume['id'])
+ self.client.detach_volume(self.volume['id'])
self.client.wait_for_volume_status(self.volume['id'], 'available')
@test.stresstest(class_setup_per='process')
@@ -70,9 +70,9 @@
def test_get_volume_attachment(self):
# Verify that a volume's attachment information is retrieved
mountpoint = '/dev/vdc'
- _, body = self.client.attach_volume(self.volume['id'],
- self.server['id'],
- mountpoint)
+ self.client.attach_volume(self.volume['id'],
+ self.server['id'],
+ mountpoint)
self.client.wait_for_volume_status(self.volume['id'], 'in-use')
# NOTE(gfidente): added in reverse order because functions will be
# called in reverse order to the order they are added (LIFO)
@@ -80,7 +80,7 @@
self.volume['id'],
'available')
self.addCleanup(self.client.detach_volume, self.volume['id'])
- _, volume = self.client.get_volume(self.volume['id'])
+ volume = self.client.get_volume(self.volume['id'])
self.assertIn('attachments', volume)
attachment = self.client.get_attachment_from_volume(volume)
self.assertEqual(mountpoint, attachment['device'])
@@ -96,9 +96,9 @@
# there is no way to delete it from Cinder, so we delete it from Glance
# using the Glance image_client and from Cinder via tearDownClass.
image_name = data_utils.rand_name('Image-')
- _, body = self.client.upload_volume(self.volume['id'],
- image_name,
- CONF.volume.disk_format)
+ body = self.client.upload_volume(self.volume['id'],
+ image_name,
+ CONF.volume.disk_format)
image_id = body["image_id"]
self.addCleanup(self.image_client.delete_image, image_id)
self.image_client.wait_for_image_status(image_id, 'active')
@@ -107,14 +107,14 @@
@test.attr(type='gate')
def test_reserve_unreserve_volume(self):
# Mark volume as reserved.
- _, body = self.client.reserve_volume(self.volume['id'])
+ body = self.client.reserve_volume(self.volume['id'])
# To get the volume info
- _, body = self.client.get_volume(self.volume['id'])
+ body = self.client.get_volume(self.volume['id'])
self.assertIn('attaching', body['status'])
# Unmark volume as reserved.
- _, body = self.client.unreserve_volume(self.volume['id'])
+ body = self.client.unreserve_volume(self.volume['id'])
# To get the volume info
- _, body = self.client.get_volume(self.volume['id'])
+ body = self.client.get_volume(self.volume['id'])
self.assertIn('available', body['status'])
def _is_true(self, val):
@@ -124,20 +124,19 @@
def test_volume_readonly_update(self):
# Update volume readonly true
readonly = True
- _, body = self.client.update_volume_readonly(self.volume['id'],
- readonly)
+ self.client.update_volume_readonly(self.volume['id'],
+ readonly)
# Get Volume information
- _, fetched_volume = self.client.get_volume(self.volume['id'])
+ fetched_volume = self.client.get_volume(self.volume['id'])
bool_flag = self._is_true(fetched_volume['metadata']['readonly'])
self.assertEqual(True, bool_flag)
# Update volume readonly false
readonly = False
- _, body = self.client.update_volume_readonly(self.volume['id'],
- readonly)
+ self.client.update_volume_readonly(self.volume['id'], readonly)
# Get Volume information
- _, fetched_volume = self.client.get_volume(self.volume['id'])
+ fetched_volume = self.client.get_volume(self.volume['id'])
bool_flag = self._is_true(fetched_volume['metadata']['readonly'])
self.assertEqual(False, bool_flag)
diff --git a/tempest/api/volume/test_volumes_extend.py b/tempest/api/volume/test_volumes_extend.py
index 2b816ef..ebe6084 100644
--- a/tempest/api/volume/test_volumes_extend.py
+++ b/tempest/api/volume/test_volumes_extend.py
@@ -32,9 +32,9 @@
# Extend Volume Test.
self.volume = self.create_volume()
extend_size = int(self.volume['size']) + 1
- _, body = self.client.extend_volume(self.volume['id'], extend_size)
+ self.client.extend_volume(self.volume['id'], extend_size)
self.client.wait_for_volume_status(self.volume['id'], 'available')
- _, volume = self.client.get_volume(self.volume['id'])
+ volume = self.client.get_volume(self.volume['id'])
self.assertEqual(int(volume['size']), extend_size)
diff --git a/tempest/api/volume/test_volumes_get.py b/tempest/api/volume/test_volumes_get.py
index a9c10aa..6d9c438 100644
--- a/tempest/api/volume/test_volumes_get.py
+++ b/tempest/api/volume/test_volumes_get.py
@@ -54,7 +54,7 @@
# Create a volume
kwargs[self.name_field] = v_name
kwargs['metadata'] = metadata
- _, volume = self.client.create_volume(**kwargs)
+ volume = self.client.create_volume(**kwargs)
self.assertIn('id', volume)
self.addCleanup(self._delete_volume, volume['id'])
self.client.wait_for_volume_status(volume['id'], 'available')
@@ -65,7 +65,7 @@
self.assertTrue(volume['id'] is not None,
"Field volume id is empty or not found.")
# Get Volume information
- _, fetched_volume = self.client.get_volume(volume['id'])
+ fetched_volume = self.client.get_volume(volume['id'])
self.assertEqual(v_name,
fetched_volume[self.name_field],
'The fetched Volume name is different '
@@ -90,18 +90,18 @@
# Update Volume
# Test volume update when display_name is same with original value
params = {self.name_field: v_name}
- _, update_volume = self.client.update_volume(volume['id'], **params)
+ self.client.update_volume(volume['id'], **params)
# Test volume update when display_name is new
new_v_name = data_utils.rand_name('new-Volume')
new_desc = 'This is the new description of volume'
params = {self.name_field: new_v_name,
self.descrip_field: new_desc}
- _, update_volume = self.client.update_volume(volume['id'], **params)
+ update_volume = self.client.update_volume(volume['id'], **params)
# Assert response body for update_volume method
self.assertEqual(new_v_name, update_volume[self.name_field])
self.assertEqual(new_desc, update_volume[self.descrip_field])
# Assert response body for get_volume method
- _, updated_volume = self.client.get_volume(volume['id'])
+ updated_volume = self.client.get_volume(volume['id'])
self.assertEqual(volume['id'], updated_volume['id'])
self.assertEqual(new_v_name, updated_volume[self.name_field])
self.assertEqual(new_desc, updated_volume[self.descrip_field])
@@ -116,15 +116,14 @@
new_v_desc = data_utils.rand_name('@#$%^* description')
params = {self.descrip_field: new_v_desc,
'availability_zone': volume['availability_zone']}
- _, new_volume = self.client.create_volume(size=1, **params)
+ new_volume = self.client.create_volume(size=1, **params)
self.assertIn('id', new_volume)
self.addCleanup(self._delete_volume, new_volume['id'])
self.client.wait_for_volume_status(new_volume['id'], 'available')
params = {self.name_field: volume[self.name_field],
self.descrip_field: volume[self.descrip_field]}
- _, update_volume = self.client.update_volume(new_volume['id'],
- **params)
+ self.client.update_volume(new_volume['id'], **params)
# NOTE(jdg): Revert back to strict true/false checking
# after fix for bug #1227837 merges
diff --git a/tempest/api/volume/test_volumes_list.py b/tempest/api/volume/test_volumes_list.py
index 9c0d238..91beae9 100644
--- a/tempest/api/volume/test_volumes_list.py
+++ b/tempest/api/volume/test_volumes_list.py
@@ -66,7 +66,7 @@
cls.metadata = {'Type': 'work'}
for i in range(3):
volume = cls.create_volume(metadata=cls.metadata)
- _, volume = cls.client.get_volume(volume['id'])
+ volume = cls.client.get_volume(volume['id'])
cls.volume_list.append(volume)
cls.volume_id_list.append(volume['id'])
@@ -84,10 +84,10 @@
and validates result.
"""
if with_detail:
- _, fetched_vol_list = \
+ fetched_vol_list = \
self.client.list_volumes_with_detail(params=params)
else:
- _, fetched_vol_list = self.client.list_volumes(params=params)
+ fetched_vol_list = self.client.list_volumes(params=params)
# Validating params of fetched volumes
# In v2, only list detail view includes items in params.
@@ -111,7 +111,7 @@
def test_volume_list(self):
# Get a list of Volumes
# Fetch all volumes
- _, fetched_list = self.client.list_volumes()
+ fetched_list = self.client.list_volumes()
self.assertVolumesIn(fetched_list, self.volume_list,
fields=self.VOLUME_FIELDS)
@@ -119,14 +119,14 @@
def test_volume_list_with_details(self):
# Get a list of Volumes with details
# Fetch all Volumes
- _, fetched_list = self.client.list_volumes_with_detail()
+ fetched_list = self.client.list_volumes_with_detail()
self.assertVolumesIn(fetched_list, self.volume_list)
@test.attr(type='gate')
def test_volume_list_by_name(self):
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
params = {self.name: volume[self.name]}
- _, fetched_vol = self.client.list_volumes(params)
+ fetched_vol = self.client.list_volumes(params)
self.assertEqual(1, len(fetched_vol), str(fetched_vol))
self.assertEqual(fetched_vol[0][self.name],
volume[self.name])
@@ -135,7 +135,7 @@
def test_volume_list_details_by_name(self):
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
params = {self.name: volume[self.name]}
- _, fetched_vol = self.client.list_volumes_with_detail(params)
+ fetched_vol = self.client.list_volumes_with_detail(params)
self.assertEqual(1, len(fetched_vol), str(fetched_vol))
self.assertEqual(fetched_vol[0][self.name],
volume[self.name])
@@ -143,7 +143,7 @@
@test.attr(type='gate')
def test_volumes_list_by_status(self):
params = {'status': 'available'}
- _, fetched_list = self.client.list_volumes(params)
+ fetched_list = self.client.list_volumes(params)
self._list_by_param_value_and_assert(params)
self.assertVolumesIn(fetched_list, self.volume_list,
fields=self.VOLUME_FIELDS)
@@ -151,7 +151,7 @@
@test.attr(type='gate')
def test_volumes_list_details_by_status(self):
params = {'status': 'available'}
- _, fetched_list = self.client.list_volumes_with_detail(params)
+ fetched_list = self.client.list_volumes_with_detail(params)
for volume in fetched_list:
self.assertEqual('available', volume['status'])
self.assertVolumesIn(fetched_list, self.volume_list)
@@ -161,7 +161,7 @@
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
zone = volume['availability_zone']
params = {'availability_zone': zone}
- _, fetched_list = self.client.list_volumes(params)
+ fetched_list = self.client.list_volumes(params)
self._list_by_param_value_and_assert(params)
self.assertVolumesIn(fetched_list, self.volume_list,
fields=self.VOLUME_FIELDS)
@@ -171,7 +171,7 @@
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
zone = volume['availability_zone']
params = {'availability_zone': zone}
- _, fetched_list = self.client.list_volumes_with_detail(params)
+ fetched_list = self.client.list_volumes_with_detail(params)
for volume in fetched_list:
self.assertEqual(zone, volume['availability_zone'])
self.assertVolumesIn(fetched_list, self.volume_list)
diff --git a/tempest/api/volume/test_volumes_negative.py b/tempest/api/volume/test_volumes_negative.py
index 5d3fdef..dc8d8e2 100644
--- a/tempest/api/volume/test_volumes_negative.py
+++ b/tempest/api/volume/test_volumes_negative.py
@@ -224,38 +224,40 @@
@test.attr(type=['negative', 'gate'])
def test_reserve_volume_with_negative_volume_status(self):
# Mark volume as reserved.
- _, body = self.client.reserve_volume(self.volume['id'])
+ self.client.reserve_volume(self.volume['id'])
# Mark volume which is marked as reserved before
self.assertRaises(exceptions.BadRequest,
self.client.reserve_volume,
self.volume['id'])
# Unmark volume as reserved.
- _, body = self.client.unreserve_volume(self.volume['id'])
+ self.client.unreserve_volume(self.volume['id'])
@test.attr(type=['negative', 'gate'])
def test_list_volumes_with_nonexistent_name(self):
v_name = data_utils.rand_name('Volume-')
params = {self.name_field: v_name}
- _, fetched_volume = self.client.list_volumes(params)
+ fetched_volume = self.client.list_volumes(params)
self.assertEqual(0, len(fetched_volume))
@test.attr(type=['negative', 'gate'])
def test_list_volumes_detail_with_nonexistent_name(self):
v_name = data_utils.rand_name('Volume-')
params = {self.name_field: v_name}
- _, fetched_volume = self.client.list_volumes_with_detail(params)
+ fetched_volume = \
+ self.client.list_volumes_with_detail(params)
self.assertEqual(0, len(fetched_volume))
@test.attr(type=['negative', 'gate'])
def test_list_volumes_with_invalid_status(self):
params = {'status': 'null'}
- _, fetched_volume = self.client.list_volumes(params)
+ fetched_volume = self.client.list_volumes(params)
self.assertEqual(0, len(fetched_volume))
@test.attr(type=['negative', 'gate'])
def test_list_volumes_detail_with_invalid_status(self):
params = {'status': 'null'}
- _, fetched_volume = self.client.list_volumes_with_detail(params)
+ fetched_volume = \
+ self.client.list_volumes_with_detail(params)
self.assertEqual(0, len(fetched_volume))
diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py
index b7e9422..179eb09 100644
--- a/tempest/api/volume/test_volumes_snapshots.py
+++ b/tempest/api/volume/test_volumes_snapshots.py
@@ -44,11 +44,11 @@
and validates result.
"""
if with_detail:
- _, fetched_snap_list = \
+ fetched_snap_list = \
self.snapshots_client.\
list_snapshots_with_detail(params=params)
else:
- _, fetched_snap_list = \
+ fetched_snap_list = \
self.snapshots_client.list_snapshots(params=params)
# Validating params of fetched snapshots
@@ -94,14 +94,14 @@
snapshot = self.create_snapshot(self.volume_origin['id'], **params)
# Get the snap and check for some of its details
- _, snap_get = self.snapshots_client.get_snapshot(snapshot['id'])
+ snap_get = self.snapshots_client.get_snapshot(snapshot['id'])
self.assertEqual(self.volume_origin['id'],
snap_get['volume_id'],
"Referred volume origin mismatch")
# Compare also with the output from the list action
tracking_data = (snapshot['id'], snapshot[self.name_field])
- _, snaps_list = self.snapshots_client.list_snapshots()
+ snaps_list = self.snapshots_client.list_snapshots()
snaps_data = [(f['id'], f[self.name_field]) for f in snaps_list]
self.assertIn(tracking_data, snaps_data)
@@ -110,13 +110,13 @@
new_desc = 'This is the new description of snapshot.'
params = {self.name_field: new_s_name,
self.descrip_field: new_desc}
- _, update_snapshot = \
+ update_snapshot = \
self.snapshots_client.update_snapshot(snapshot['id'], **params)
# Assert response body for update_snapshot method
self.assertEqual(new_s_name, update_snapshot[self.name_field])
self.assertEqual(new_desc, update_snapshot[self.descrip_field])
# Assert response body for get_snapshot method
- _, updated_snapshot = \
+ updated_snapshot = \
self.snapshots_client.get_snapshot(snapshot['id'])
self.assertEqual(new_s_name, updated_snapshot[self.name_field])
self.assertEqual(new_desc, updated_snapshot[self.descrip_field])
@@ -172,7 +172,7 @@
# create a snap based volume and deletes it
snapshot = self.create_snapshot(self.volume_origin['id'])
# NOTE(gfidente): size is required also when passing snapshot_id
- _, volume = self.volumes_client.create_volume(
+ volume = self.volumes_client.create_volume(
size=1,
snapshot_id=snapshot['id'])
self.volumes_client.wait_for_volume_status(volume['id'], 'available')
diff --git a/tempest/api/volume/v2/test_volumes_list.py b/tempest/api/volume/v2/test_volumes_list.py
index c20f3d8..bc14b2c 100644
--- a/tempest/api/volume/v2/test_volumes_list.py
+++ b/tempest/api/volume/v2/test_volumes_list.py
@@ -41,7 +41,7 @@
cls.metadata = {'Type': 'work'}
for i in range(3):
volume = cls.create_volume(metadata=cls.metadata)
- _, volume = cls.client.get_volume(volume['id'])
+ volume = cls.client.get_volume(volume['id'])
cls.volume_list.append(volume)
cls.volume_id_list.append(volume['id'])
@@ -65,7 +65,7 @@
'sort_dir': sort_dir,
'sort_key': sort_key
}
- _, fetched_volume = self.client.list_volumes_with_detail(params)
+ fetched_volume = self.client.list_volumes_with_detail(params)
self.assertEqual(limit, len(fetched_volume),
"The count of volumes is %s, expected:%s " %
(len(fetched_volume), limit))
diff --git a/tempest/api_schema/request/compute/servers.py b/tempest/api_schema/request/compute/servers.py
deleted file mode 100644
index 731649c..0000000
--- a/tempest/api_schema/request/compute/servers.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# (c) 2014 Deutsche Telekom AG
-# 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.
-
-common_get_console_output = {
- "name": "get-console-output",
- "http-method": "POST",
- "url": "servers/%s/action",
- "resources": [
- {"name": "server", "expected_result": 404}
- ],
- "json-schema": {
- "type": "object",
- "properties": {
- "os-getConsoleOutput": {
- "type": "object",
- "properties": {
- "length": {
- "type": ["integer", "string"],
- "minimum": 0
- }
- }
- }
- },
- "additionalProperties": False
- }
-}
diff --git a/tempest/api_schema/request/compute/v2/servers.py b/tempest/api_schema/request/compute/v2/servers.py
deleted file mode 100644
index c9002ed..0000000
--- a/tempest/api_schema/request/compute/v2/servers.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# (c) 2014 Deutsche Telekom AG
-# 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 copy
-
-from tempest.api_schema.request.compute import servers
-
-get_console_output = copy.deepcopy(servers.common_get_console_output)
diff --git a/tempest/auth.py b/tempest/auth.py
index 2550cfb..9687905 100644
--- a/tempest/auth.py
+++ b/tempest/auth.py
@@ -499,7 +499,6 @@
ATTRIBUTES = []
TYPES = {
'identity_admin': ('identity', 'admin'),
- 'compute_admin': ('compute_admin', None),
'user': ('identity', None),
'alt_user': ('identity', 'alt')
}
diff --git a/tempest/cli/simple_read_only/compute/test_nova_manage.py b/tempest/cli/simple_read_only/compute/test_nova_manage.py
deleted file mode 100644
index 34ec671..0000000
--- a/tempest/cli/simple_read_only/compute/test_nova_manage.py
+++ /dev/null
@@ -1,96 +0,0 @@
-# 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_lib import exceptions
-
-from tempest import cli
-from tempest import config
-from tempest.openstack.common import log as logging
-
-
-CONF = config.CONF
-LOG = logging.getLogger(__name__)
-
-
-class SimpleReadOnlyNovaManageTest(cli.ClientTestBase):
-
- """
- This is a first pass at a simple read only nova-manage test. This
- only exercises client commands that are read only.
-
- This should test commands:
- * with and without optional parameters
- * initially just check return codes, and later test command outputs
-
- """
-
- @classmethod
- def resource_setup(cls):
- if not CONF.service_available.nova:
- msg = ("%s skipped as Nova is not available" % cls.__name__)
- raise cls.skipException(msg)
- if not CONF.cli.has_manage:
- msg = ("%s skipped as *-manage commands not available"
- % cls.__name__)
- raise cls.skipException(msg)
- super(SimpleReadOnlyNovaManageTest, cls).resource_setup()
-
- def nova_manage(self, *args, **kwargs):
- return self.clients.nova_manage(*args, **kwargs)
-
- def test_admin_fake_action(self):
- self.assertRaises(exceptions.CommandFailed,
- self.nova_manage,
- 'this-does-nova-exist')
-
- # NOTE(jogo): Commands in order listed in 'nova-manage -h'
-
- # test flags
- def test_help_flag(self):
- self.nova_manage('', '-h')
-
- def test_version_flag(self):
- # Bug 1159957: nova-manage --version writes to stderr
- self.assertNotEqual("", self.nova_manage('', '--version',
- merge_stderr=True))
- self.assertEqual(self.nova_manage('version'),
- self.nova_manage('', '--version', merge_stderr=True))
-
- def test_debug_flag(self):
- self.assertNotEqual("", self.nova_manage('service list',
- '--debug'))
-
- def test_verbose_flag(self):
- self.assertNotEqual("", self.nova_manage('service list',
- '--verbose'))
-
- # test actions
- def test_version(self):
- self.assertNotEqual("", self.nova_manage('version'))
-
- def test_db_sync(self):
- # make sure command doesn't error out
- self.nova_manage('db sync')
-
- def test_db_version(self):
- self.assertNotEqual("", self.nova_manage('db version'))
-
- def test_cell_list(self):
- # make sure command doesn't error out
- self.nova_manage('cell list')
-
- def test_host_list(self):
- # make sure command doesn't error out
- self.nova_manage('host list')
diff --git a/tempest/cli/simple_read_only/data_processing/test_sahara.py b/tempest/cli/simple_read_only/data_processing/test_sahara.py
index 1f2403c..c06c2c9 100644
--- a/tempest/cli/simple_read_only/data_processing/test_sahara.py
+++ b/tempest/cli/simple_read_only/data_processing/test_sahara.py
@@ -16,6 +16,7 @@
import re
from tempest_lib import exceptions
+import testtools
from tempest import cli
from tempest import config
@@ -59,8 +60,12 @@
'title'
])
+ @testtools.skipUnless(CONF.data_processing_feature_enabled.plugins,
+ 'No plugins defined')
def test_sahara_plugins_show(self):
- result = self.sahara('plugin-show', params='--name vanilla')
+ name_param = '--name %s' % \
+ (CONF.data_processing_feature_enabled.plugins[0])
+ result = self.sahara('plugin-show', params=name_param)
plugin = self.parser.listing(result)
self.assertTableStruct(plugin, [
'Property',
diff --git a/tempest/clients.py b/tempest/clients.py
index 261b27c..5da0c8c 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -13,8 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+import copy
+
from tempest import auth
-from tempest.common import rest_client
+from tempest.common import negative_rest_client
from tempest import config
from tempest import manager
from tempest.openstack.common import log as logging
@@ -83,12 +85,8 @@
MessagingClientJSON
from tempest.services.network.json.network_client import NetworkClientJSON
from tempest.services.object_storage.account_client import AccountClient
-from tempest.services.object_storage.account_client import \
- AccountClientCustomizedHeader
from tempest.services.object_storage.container_client import ContainerClient
from tempest.services.object_storage.object_client import ObjectClient
-from tempest.services.object_storage.object_client import \
- ObjectClientCustomizedHeader
from tempest.services.orchestration.json.orchestration_client import \
OrchestrationClient
from tempest.services.telemetry.json.telemetry_client import \
@@ -137,95 +135,147 @@
Top level manager for OpenStack tempest clients
"""
+ default_params = {
+ 'disable_ssl_certificate_validation':
+ CONF.identity.disable_ssl_certificate_validation,
+ 'ca_certs': CONF.identity.ca_certificates_file,
+ 'trace_requests': CONF.debug.trace_requests
+ }
+
+ # NOTE: Tempest uses timeout values of compute API if project specific
+ # timeout values don't exist.
+ default_params_with_timeout_values = {
+ 'build_interval': CONF.compute.build_interval,
+ 'build_timeout': CONF.compute.build_timeout
+ }
+ default_params_with_timeout_values.update(default_params)
+
def __init__(self, credentials=None, interface='json', service=None):
# Set interface and client type first
self.interface = interface
# super cares for credentials validation
super(Manager, self).__init__(credentials=credentials)
- self._set_compute_clients(self.interface)
- self._set_identity_clients(self.interface)
- self._set_volume_clients(self.interface)
+ self._set_compute_clients()
+ self._set_identity_clients()
+ self._set_volume_clients()
+ self._set_object_storage_clients()
self.baremetal_client = BaremetalClientJSON(self.auth_provider)
- self.network_client = NetworkClientJSON(self.auth_provider)
+ self.network_client = NetworkClientJSON(
+ self.auth_provider,
+ CONF.network.catalog_type,
+ CONF.network.region or CONF.identity.region,
+ endpoint_type=CONF.network.endpoint_type,
+ build_interval=CONF.network.build_interval,
+ build_timeout=CONF.network.build_timeout,
+ **self.default_params)
self.database_flavors_client = DatabaseFlavorsClientJSON(
- self.auth_provider)
+ self.auth_provider,
+ CONF.database.catalog_type,
+ CONF.identity.region,
+ **self.default_params_with_timeout_values)
self.database_versions_client = DatabaseVersionsClientJSON(
- self.auth_provider)
- self.messaging_client = MessagingClientJSON(self.auth_provider)
+ self.auth_provider,
+ CONF.database.catalog_type,
+ CONF.identity.region,
+ **self.default_params_with_timeout_values)
+ self.messaging_client = MessagingClientJSON(
+ self.auth_provider,
+ CONF.messaging.catalog_type,
+ CONF.identity.region,
+ **self.default_params_with_timeout_values)
if CONF.service_available.ceilometer:
self.telemetry_client = TelemetryClientJSON(
- self.auth_provider)
- self.negative_client = rest_client.NegativeRestClient(
- self.auth_provider)
- self.negative_client.service = service
+ self.auth_provider,
+ CONF.telemetry.catalog_type,
+ CONF.identity.region,
+ endpoint_type=CONF.telemetry.endpoint_type,
+ **self.default_params_with_timeout_values)
+ if CONF.service_available.glance:
+ self.image_client = ImageClientJSON(self.auth_provider)
+ self.image_client_v2 = ImageClientV2JSON(self.auth_provider)
+ self.orchestration_client = OrchestrationClient(
+ self.auth_provider,
+ CONF.orchestration.catalog_type,
+ CONF.orchestration.region or CONF.identity.region,
+ endpoint_type=CONF.orchestration.endpoint_type,
+ build_interval=CONF.orchestration.build_interval,
+ build_timeout=CONF.orchestration.build_timeout,
+ **self.default_params)
+ self.negative_client = negative_rest_client.NegativeRestClient(
+ self.auth_provider, service)
# TODO(andreaf) EC2 client still do their auth, v2 only
ec2_client_args = (self.credentials.username,
self.credentials.password,
CONF.identity.uri,
self.credentials.tenant_name)
-
- # common clients
- self.account_client = AccountClient(self.auth_provider)
- if CONF.service_available.glance:
- self.image_client = ImageClientJSON(self.auth_provider)
- self.image_client_v2 = ImageClientV2JSON(self.auth_provider)
- self.container_client = ContainerClient(self.auth_provider)
- self.object_client = ObjectClient(self.auth_provider)
- self.orchestration_client = OrchestrationClient(
- self.auth_provider)
self.ec2api_client = botoclients.APIClientEC2(*ec2_client_args)
self.s3_client = botoclients.ObjectClientS3(*ec2_client_args)
- self.custom_object_client = ObjectClientCustomizedHeader(
- self.auth_provider)
- self.custom_account_client = \
- AccountClientCustomizedHeader(self.auth_provider)
self.data_processing_client = DataProcessingClient(
self.auth_provider)
- def _set_compute_clients(self, type):
- self._set_compute_json_clients()
+ def _set_compute_clients(self):
+ params = {
+ 'service': CONF.compute.catalog_type,
+ 'region': CONF.compute.region or CONF.identity.region,
+ 'endpoint_type': CONF.compute.endpoint_type,
+ 'build_interval': CONF.compute.build_interval,
+ 'build_timeout': CONF.compute.build_timeout
+ }
+ params.update(self.default_params)
- # Common compute clients
- self.agents_client = AgentsClientJSON(self.auth_provider)
- self.networks_client = NetworksClientJSON(self.auth_provider)
- self.migrations_client = MigrationsClientJSON(self.auth_provider)
+ self.agents_client = AgentsClientJSON(self.auth_provider, **params)
+ self.networks_client = NetworksClientJSON(self.auth_provider, **params)
+ self.migrations_client = MigrationsClientJSON(self.auth_provider,
+ **params)
self.security_group_default_rules_client = (
- SecurityGroupDefaultRulesClientJSON(self.auth_provider))
-
- def _set_compute_json_clients(self):
- self.certificates_client = CertificatesClientJSON(self.auth_provider)
- self.servers_client = ServersClientJSON(self.auth_provider)
- self.limits_client = LimitsClientJSON(self.auth_provider)
- self.images_client = ImagesClientJSON(self.auth_provider)
- self.keypairs_client = KeyPairsClientJSON(self.auth_provider)
- self.quotas_client = QuotasClientJSON(self.auth_provider)
- self.quota_classes_client = QuotaClassesClientJSON(self.auth_provider)
- self.flavors_client = FlavorsClientJSON(self.auth_provider)
- self.extensions_client = ExtensionsClientJSON(self.auth_provider)
- self.volumes_extensions_client = VolumesExtensionsClientJSON(
- self.auth_provider)
- self.floating_ips_client = FloatingIPsClientJSON(self.auth_provider)
+ SecurityGroupDefaultRulesClientJSON(self.auth_provider, **params))
+ self.certificates_client = CertificatesClientJSON(self.auth_provider,
+ **params)
+ self.servers_client = ServersClientJSON(self.auth_provider, **params)
+ self.limits_client = LimitsClientJSON(self.auth_provider, **params)
+ self.images_client = ImagesClientJSON(self.auth_provider, **params)
+ self.keypairs_client = KeyPairsClientJSON(self.auth_provider, **params)
+ self.quotas_client = QuotasClientJSON(self.auth_provider, **params)
+ self.quota_classes_client = QuotaClassesClientJSON(self.auth_provider,
+ **params)
+ self.flavors_client = FlavorsClientJSON(self.auth_provider, **params)
+ self.extensions_client = ExtensionsClientJSON(self.auth_provider,
+ **params)
+ self.floating_ips_client = FloatingIPsClientJSON(self.auth_provider,
+ **params)
self.security_groups_client = SecurityGroupsClientJSON(
- self.auth_provider)
- self.interfaces_client = InterfacesClientJSON(self.auth_provider)
- self.fixed_ips_client = FixedIPsClientJSON(self.auth_provider)
+ self.auth_provider, **params)
+ self.interfaces_client = InterfacesClientJSON(self.auth_provider,
+ **params)
+ self.fixed_ips_client = FixedIPsClientJSON(self.auth_provider,
+ **params)
self.availability_zone_client = AvailabilityZoneClientJSON(
- self.auth_provider)
- self.aggregates_client = AggregatesClientJSON(self.auth_provider)
- self.services_client = ServicesClientJSON(self.auth_provider)
- self.tenant_usages_client = TenantUsagesClientJSON(self.auth_provider)
- self.hosts_client = HostsClientJSON(self.auth_provider)
- self.hypervisor_client = HypervisorClientJSON(self.auth_provider)
+ self.auth_provider, **params)
+ self.aggregates_client = AggregatesClientJSON(self.auth_provider,
+ **params)
+ self.services_client = ServicesClientJSON(self.auth_provider, **params)
+ self.tenant_usages_client = TenantUsagesClientJSON(self.auth_provider,
+ **params)
+ self.hosts_client = HostsClientJSON(self.auth_provider, **params)
+ self.hypervisor_client = HypervisorClientJSON(self.auth_provider,
+ **params)
self.instance_usages_audit_log_client = \
- InstanceUsagesAuditLogClientJSON(self.auth_provider)
+ InstanceUsagesAuditLogClientJSON(self.auth_provider, **params)
- def _set_identity_clients(self, type):
- self._set_identity_json_clients()
+ # NOTE: The following client needs special timeout values because
+ # the API is a proxy for the other component.
+ params_volume = copy.deepcopy(params)
+ params_volume.update({
+ 'build_interval': CONF.volume.build_interval,
+ 'build_timeout': CONF.volume.build_timeout
+ })
+ self.volumes_extensions_client = VolumesExtensionsClientJSON(
+ self.auth_provider, **params_volume)
- def _set_identity_json_clients(self):
+ def _set_identity_clients(self):
self.identity_client = IdentityClientJSON(self.auth_provider)
self.identity_v3_client = IdentityV3ClientJSON(self.auth_provider)
self.endpoints_client = EndPointClientJSON(self.auth_provider)
@@ -237,20 +287,12 @@
self.token_v3_client = V3TokenClientJSON()
self.credentials_client = CredentialsClientJSON(self.auth_provider)
- def _set_volume_clients(self, type):
- self._set_volume_json_clients()
- # Common volume clients
- # NOTE : As XML clients are not implemented for Qos-specs.
- # So, setting the qos_client here. Once client are implemented,
- # qos_client would be moved to its respective if/else.
- # Bug : 1312553
+ def _set_volume_clients(self):
self.volume_qos_client = QosSpecsClientJSON(self.auth_provider)
self.volume_qos_v2_client = QosSpecsV2ClientJSON(
self.auth_provider)
self.volume_services_v2_client = VolumesServicesV2ClientJSON(
self.auth_provider)
-
- def _set_volume_json_clients(self):
self.backups_client = BackupsClientJSON(self.auth_provider)
self.backups_v2_client = BackupsClientV2JSON(self.auth_provider)
self.snapshots_client = SnapshotsClientJSON(self.auth_provider)
@@ -276,6 +318,18 @@
self.volume_types_v2_client = VolumeTypesV2ClientJSON(
self.auth_provider)
+ def _set_object_storage_clients(self):
+ params = {
+ 'service': CONF.object_storage.catalog_type,
+ 'region': CONF.object_storage.region or CONF.identity.region,
+ 'endpoint_type': CONF.object_storage.endpoint_type
+ }
+ params.update(self.default_params_with_timeout_values)
+
+ self.account_client = AccountClient(self.auth_provider, **params)
+ self.container_client = ContainerClient(self.auth_provider, **params)
+ self.object_client = ObjectClient(self.auth_provider, **params)
+
class AdminManager(Manager):
@@ -289,18 +343,3 @@
credentials=auth.get_default_credentials('identity_admin'),
interface=interface,
service=service)
-
-
-class ComputeAdminManager(Manager):
-
- """
- Manager object that uses the compute_admin credentials for its
- managed client objects
- """
-
- def __init__(self, interface='json', service=None):
- base = super(ComputeAdminManager, self)
- base.__init__(
- credentials=auth.get_default_credentials('compute_admin'),
- interface=interface,
- service=service)
diff --git a/tempest/cmd/cleanup.py b/tempest/cmd/cleanup.py
index 28f0aa8..28992b9 100755
--- a/tempest/cmd/cleanup.py
+++ b/tempest/cmd/cleanup.py
@@ -180,7 +180,7 @@
CONF.identity.admin_username)
self.admin_id = user['id']
- _, roles = id_cl.list_roles()
+ roles = id_cl.list_roles()
for role in roles:
if role['name'] == CONF.identity.admin_role:
self.admin_role_id = role['id']
@@ -215,7 +215,7 @@
def _add_admin(self, tenant_id):
id_cl = self.admin_mgr.identity_client
needs_role = True
- _, roles = id_cl.list_user_roles(tenant_id, self.admin_id)
+ roles = id_cl.list_user_roles(tenant_id, self.admin_id)
for role in roles:
if role['id'] == self.admin_role_id:
needs_role = False
diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py
index db862c7..a0bbb70 100644
--- a/tempest/cmd/cleanup_service.py
+++ b/tempest/cmd/cleanup_service.py
@@ -142,7 +142,7 @@
def list(self):
client = self.client
- __, snaps = client.list_snapshots()
+ snaps = client.list_snapshots()
LOG.debug("List count, %s Snapshots" % len(snaps))
return snaps
@@ -218,7 +218,7 @@
def list(self):
client = self.client
- _, stacks = client.list_stacks()
+ stacks = client.list_stacks()
LOG.debug("List count, %s Stacks" % len(stacks))
return stacks
@@ -323,7 +323,7 @@
def list(self):
client = self.client
- _, vols = client.list_volumes()
+ vols = client.list_volumes()
LOG.debug("List count, %s Volumes" % len(vols))
return vols
@@ -845,7 +845,7 @@
def list(self):
client = self.client
- _, images = client.list_images({"all_tenants": True})
+ images = client.list_images({"all_tenants": True})
if not self.is_save_state:
images = [image for image in images if image['id']
not in self.saved_state_json['images'].keys()]
@@ -886,7 +886,7 @@
def list(self):
client = self.client
- _, users = client.get_users()
+ users = client.get_users()
if not self.is_save_state:
users = [user for user in users if user['id']
@@ -929,7 +929,7 @@
def list(self):
client = self.client
try:
- _, roles = client.list_roles()
+ roles = client.list_roles()
# reconcile roles with saved state and never list admin role
if not self.is_save_state:
roles = [role for role in roles if
@@ -967,7 +967,7 @@
def list(self):
client = self.client
- _, tenants = client.list_tenants()
+ tenants = client.list_tenants()
if not self.is_save_state:
tenants = [tenant for tenant in tenants if (tenant['id']
not in self.saved_state_json['tenants'].keys()
@@ -1009,7 +1009,7 @@
def list(self):
client = self.client
- _, domains = client.list_domains()
+ domains = client.list_domains()
if not self.is_save_state:
domains = [domain for domain in domains if domain['id']
not in self.saved_state_json['domains'].keys()]
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index c7ec359..9fb982c 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -144,25 +144,70 @@
servers = None
def __init__(self, user, pw, tenant):
+ default_params = {
+ 'disable_ssl_certificate_validation':
+ CONF.identity.disable_ssl_certificate_validation,
+ 'ca_certs': CONF.identity.ca_certificates_file,
+ 'trace_requests': CONF.debug.trace_requests
+ }
+ default_params_with_timeout_values = {
+ 'build_interval': CONF.compute.build_interval,
+ 'build_timeout': CONF.compute.build_timeout
+ }
+ default_params_with_timeout_values.update(default_params)
+
+ compute_params = {
+ 'service': CONF.compute.catalog_type,
+ 'region': CONF.compute.region or CONF.identity.region,
+ 'endpoint_type': CONF.compute.endpoint_type,
+ 'build_interval': CONF.compute.build_interval,
+ 'build_timeout': CONF.compute.build_timeout
+ }
+ compute_params.update(default_params)
+
+ object_storage_params = {
+ 'service': CONF.object_storage.catalog_type,
+ 'region': CONF.object_storage.region or CONF.identity.region,
+ 'endpoint_type': CONF.object_storage.endpoint_type
+ }
+ object_storage_params.update(default_params)
+
_creds = tempest.auth.KeystoneV2Credentials(
username=user,
password=pw,
tenant_name=tenant)
_auth = tempest.auth.KeystoneV2AuthProvider(_creds)
self.identity = identity_client.IdentityClientJSON(_auth)
- self.servers = servers_client.ServersClientJSON(_auth)
- self.objects = object_client.ObjectClient(_auth)
- self.containers = container_client.ContainerClient(_auth)
+ self.servers = servers_client.ServersClientJSON(_auth,
+ **compute_params)
+ self.flavors = flavors_client.FlavorsClientJSON(_auth,
+ **compute_params)
+ self.secgroups = security_groups_client.SecurityGroupsClientJSON(
+ _auth, **compute_params)
+ self.objects = object_client.ObjectClient(_auth,
+ **object_storage_params)
+ self.containers = container_client.ContainerClient(
+ _auth, **object_storage_params)
self.images = image_client.ImageClientV2JSON(_auth)
- self.flavors = flavors_client.FlavorsClientJSON(_auth)
- self.telemetry = telemetry_client.TelemetryClientJSON(_auth)
- self.secgroups = security_groups_client.SecurityGroupsClientJSON(_auth)
+ self.telemetry = telemetry_client.TelemetryClientJSON(
+ _auth,
+ CONF.telemetry.catalog_type,
+ CONF.identity.region,
+ endpoint_type=CONF.telemetry.endpoint_type,
+ **default_params_with_timeout_values)
self.volumes = volumes_client.VolumesClientJSON(_auth)
- self.networks = network_client.NetworkClientJSON(_auth)
+ self.networks = network_client.NetworkClientJSON(
+ _auth,
+ CONF.network.catalog_type,
+ CONF.network.region or CONF.identity.region,
+ endpoint_type=CONF.network.endpoint_type,
+ build_interval=CONF.network.build_interval,
+ build_timeout=CONF.network.build_timeout,
+ **default_params)
def load_resources(fname):
- """Load the expected resources from a yaml flie."""
+ """Load the expected resources from a yaml file."""
return yaml.load(open(fname, 'r'))
@@ -196,7 +241,7 @@
Don't create the tenants if they already exist.
"""
admin = keystone_admin()
- _, body = admin.identity.list_tenants()
+ body = admin.identity.list_tenants()
existing = [x['name'] for x in body]
for tenant in tenants:
if tenant not in existing:
@@ -209,7 +254,7 @@
admin = keystone_admin()
for tenant in tenants:
tenant_id = admin.identity.get_tenant_by_name(tenant)['id']
- r, body = admin.identity.delete_tenant(tenant_id)
+ admin.identity.delete_tenant(tenant_id)
##############
#
@@ -237,7 +282,7 @@
def _assign_swift_role(user):
admin = keystone_admin()
- resp, roles = admin.identity.list_roles()
+ roles = admin.identity.list_roles()
role = next(r for r in roles if r['name'] == 'Member')
LOG.debug(USERS[user])
try:
@@ -281,7 +326,7 @@
tenant_id = admin.identity.get_tenant_by_name(user['tenant'])['id']
user_id = admin.identity.get_user_by_username(tenant_id,
user['name'])['id']
- r, body = admin.identity.delete_user(user_id)
+ admin.identity.delete_user(user_id)
def collect_users(users):
@@ -345,7 +390,7 @@
LOG.info("checking users")
for name, user in self.users.iteritems():
client = keystone_admin()
- _, found = client.identity.get_user(user['id'])
+ found = client.identity.get_user(user['id'])
self.assertEqual(found['name'], user['name'])
self.assertEqual(found['tenantId'], user['tenant_id'])
@@ -398,7 +443,7 @@
self._ping_ip(addr, 60)
def check_secgroups(self):
- """Check that the security groups are still existing."""
+ """Check that the security groups still exist."""
LOG.info("Checking security groups")
for secgroup in self.res['secgroups']:
client = client_for_user(secgroup['owner'])
@@ -528,7 +573,7 @@
def _get_image_by_name(client, name):
- r, body = client.images.image_list()
+ body = client.images.image_list()
for image in body:
if name == image['name']:
return image
@@ -551,19 +596,19 @@
extras = {}
if image['format'] == 'ami':
name, fname = _resolve_image(image, 'aki')
- r, aki = client.images.create_image(
+ aki = client.images.create_image(
'javelin_' + name, 'aki', 'aki')
client.images.store_image(aki.get('id'), open(fname, 'r'))
extras['kernel_id'] = aki.get('id')
name, fname = _resolve_image(image, 'ari')
- r, ari = client.images.create_image(
+ ari = client.images.create_image(
'javelin_' + name, 'ari', 'ari')
client.images.store_image(ari.get('id'), open(fname, 'r'))
extras['ramdisk_id'] = ari.get('id')
_, fname = _resolve_image(image, 'file')
- r, body = client.images.create_image(
+ body = client.images.create_image(
image['name'], image['format'], image['format'], **extras)
image_id = body.get('id')
client.images.store_image(image_id, open(fname, 'r'))
@@ -836,7 +881,7 @@
#######################
def _get_volume_by_name(client, name):
- r, body = client.volumes.list_volumes()
+ body = client.volumes.list_volumes()
for volume in body:
if name == volume['display_name']:
return volume
@@ -857,8 +902,8 @@
size = volume['gb']
v_name = volume['name']
- resp, body = client.volumes.create_volume(size=size,
- display_name=v_name)
+ body = client.volumes.create_volume(size=size,
+ display_name=v_name)
client.volumes.wait_for_volume_status(body['id'], 'available')
diff --git a/tempest/cmd/verify_tempest_config.py b/tempest/cmd/verify_tempest_config.py
index 974ee2e..65a3a95 100755
--- a/tempest/cmd/verify_tempest_config.py
+++ b/tempest/cmd/verify_tempest_config.py
@@ -59,7 +59,7 @@
def verify_glance_api_versions(os, update):
# Check glance api versions
- __, versions = os.image_client.get_versions()
+ versions = os.image_client.get_versions()
if CONF.image_feature_enabled.api_v1 != ('v1.1' in versions or 'v1.0' in
versions):
print_and_or_update('api_v1', 'image_feature_enabled',
@@ -154,7 +154,7 @@
def verify_extensions(os, service, results):
extensions_client = get_extension_client(os, service)
- if service == 'neutron':
+ if service == 'neutron' or service == 'cinder':
resp = extensions_client.list_extensions()
else:
__, resp = extensions_client.list_extensions()
@@ -250,9 +250,9 @@
'database': 'trove'
}
# Get catalog list for endpoints to use for validation
- __, endpoints = os.endpoints_client.list_endpoints()
+ endpoints = os.endpoints_client.list_endpoints()
for endpoint in endpoints:
- __, service = os.service_client.get_service(endpoint['service_id'])
+ service = os.service_client.get_service(endpoint['service_id'])
services.append(service['type'])
# Pull all catalog types from config file and compare against endpoint list
for cfgname in dir(CONF._config):
@@ -327,7 +327,7 @@
CONF_PARSER = moves.configparser.SafeConfigParser()
CONF_PARSER.optionxform = str
CONF_PARSER.readfp(conf_file)
- os = clients.ComputeAdminManager(interface='json')
+ os = clients.AdminManager(interface='json')
services = check_service_availability(os, update)
results = {}
for service in ['nova', 'cinder', 'neutron', 'swift']:
@@ -335,7 +335,7 @@
continue
results = verify_extensions(os, service, results)
- # Verify API verisons of all services in the keystone catalog and keystone
+ # Verify API versions of all services in the keystone catalog and keystone
# itself.
services.append('keystone')
for service in services:
diff --git a/tempest/common/glance_http.py b/tempest/common/glance_http.py
index 5f35c85..92ed8f1 100644
--- a/tempest/common/glance_http.py
+++ b/tempest/common/glance_http.py
@@ -67,7 +67,7 @@
_kwargs = {'timeout': float(kwargs.get('timeout', 600))}
if scheme == 'https':
- _kwargs['cacert'] = kwargs.get('cacert', None)
+ _kwargs['ca_certs'] = kwargs.get('ca_certs', None)
_kwargs['cert_file'] = kwargs.get('cert_file', None)
_kwargs['key_file'] = kwargs.get('key_file', None)
_kwargs['insecure'] = kwargs.get('insecure', False)
@@ -232,7 +232,7 @@
with native Python 3.3 code.
"""
def __init__(self, host, port=None, key_file=None, cert_file=None,
- cacert=None, timeout=None, insecure=False,
+ ca_certs=None, timeout=None, insecure=False,
ssl_compression=True):
httplib.HTTPSConnection.__init__(self, host, port,
key_file=key_file,
@@ -242,7 +242,7 @@
self.timeout = timeout
self.insecure = insecure
self.ssl_compression = ssl_compression
- self.cacert = cacert
+ self.ca_certs = ca_certs
self.setcontext()
@staticmethod
@@ -326,11 +326,11 @@
msg = 'Unable to load key from "%s" %s' % (self.key_file, e)
raise exc.SSLConfigurationError(msg)
- if self.cacert:
+ if self.ca_certs:
try:
- self.context.load_verify_locations(self.cacert)
+ self.context.load_verify_locations(self.ca_certs)
except Exception as e:
- msg = 'Unable to load CA from "%s"' % (self.cacert, e)
+ msg = 'Unable to load CA from "%s"' % (self.ca_certs, e)
raise exc.SSLConfigurationError(msg)
else:
self.context.set_default_verify_paths()
diff --git a/tempest/common/http.py b/tempest/common/http.py
deleted file mode 100644
index b3793bc..0000000
--- a/tempest/common/http.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright 2013 OpenStack Foundation
-# Copyright 2013 Citrix Systems, Inc.
-# 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 httplib2
-
-
-class ClosingHttp(httplib2.Http):
- def request(self, *args, **kwargs):
- original_headers = kwargs.get('headers', {})
- new_headers = dict(original_headers, connection='close')
- new_kwargs = dict(kwargs, headers=new_headers)
- return super(ClosingHttp, self).request(*args, **new_kwargs)
diff --git a/tempest/common/isolated_creds.py b/tempest/common/isolated_creds.py
index 9a9ef82..a663931 100644
--- a/tempest/common/isolated_creds.py
+++ b/tempest/common/isolated_creds.py
@@ -52,26 +52,26 @@
return os.identity_client, os.network_client
def _create_tenant(self, name, description):
- _, tenant = self.identity_admin_client.create_tenant(
+ tenant = self.identity_admin_client.create_tenant(
name=name, description=description)
return tenant
def _get_tenant_by_name(self, name):
- _, tenant = self.identity_admin_client.get_tenant_by_name(name)
+ tenant = self.identity_admin_client.get_tenant_by_name(name)
return tenant
def _create_user(self, username, password, tenant, email):
- _, user = self.identity_admin_client.create_user(
+ user = self.identity_admin_client.create_user(
username, password, tenant['id'], email)
return user
def _get_user(self, tenant, username):
- _, user = self.identity_admin_client.get_user_by_username(
+ user = self.identity_admin_client.get_user_by_username(
tenant['id'], username)
return user
def _list_roles(self):
- _, roles = self.identity_admin_client.list_roles()
+ roles = self.identity_admin_client.list_roles()
return roles
def _assign_user_role(self, tenant, user, role_name):
@@ -124,6 +124,8 @@
self._assign_user_role(tenant, user, swift_operator_role)
if admin:
self._assign_user_role(tenant, user, CONF.identity.admin_role)
+ for role in CONF.auth.tempest_roles:
+ self._assign_user_role(tenant, user, role)
return self._get_credentials(user, tenant)
def _get_credentials(self, user, tenant):
diff --git a/tempest/common/negative_rest_client.py b/tempest/common/negative_rest_client.py
new file mode 100644
index 0000000..a02e494
--- /dev/null
+++ b/tempest/common/negative_rest_client.py
@@ -0,0 +1,71 @@
+# (c) 2014 Deutsche Telekom AG
+# Copyright 2014 Red Hat, Inc.
+# Copyright 2014 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.
+
+from tempest.common import service_client
+from tempest import config
+
+CONF = config.CONF
+
+
+class NegativeRestClient(service_client.ServiceClient):
+ """
+ Version of RestClient that does not raise exceptions.
+ """
+ def __init__(self, auth_provider, service):
+ region = self._get_region(service)
+ super(NegativeRestClient, self).__init__(auth_provider,
+ service, region)
+
+ def _get_region(self, service):
+ """
+ Returns the region for a specific service
+ """
+ service_region = None
+ for cfgname in dir(CONF._config):
+ # Find all config.FOO.catalog_type and assume FOO is a service.
+ cfg = getattr(CONF, cfgname)
+ catalog_type = getattr(cfg, 'catalog_type', None)
+ if catalog_type == service:
+ service_region = getattr(cfg, 'region', None)
+ if not service_region:
+ service_region = CONF.identity.region
+ return service_region
+
+ def _error_checker(self, method, url,
+ headers, body, resp, resp_body):
+ pass
+
+ def send_request(self, method, url_template, resources, body=None):
+ url = url_template % tuple(resources)
+ if method == "GET":
+ resp, body = self.get(url)
+ elif method == "POST":
+ resp, body = self.post(url, body)
+ elif method == "PUT":
+ resp, body = self.put(url, body)
+ elif method == "PATCH":
+ resp, body = self.patch(url, body)
+ elif method == "HEAD":
+ resp, body = self.head(url)
+ elif method == "DELETE":
+ resp, body = self.delete(url)
+ elif method == "COPY":
+ resp, body = self.copy(url)
+ else:
+ assert False
+
+ return resp, body
diff --git a/tempest/common/rest_client.py b/tempest/common/rest_client.py
deleted file mode 100644
index c54f698..0000000
--- a/tempest/common/rest_client.py
+++ /dev/null
@@ -1,651 +0,0 @@
-# Copyright 2012 OpenStack Foundation
-# 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.
-
-import collections
-import json
-import logging as real_logging
-import re
-import time
-
-import jsonschema
-import six
-
-from tempest.common import http
-from tempest.common.utils import misc as misc_utils
-from tempest import config
-from tempest import exceptions
-from tempest.openstack.common import log as logging
-
-CONF = config.CONF
-
-# redrive rate limited calls at most twice
-MAX_RECURSION_DEPTH = 2
-
-# All the successful HTTP status codes from RFC 7231 & 4918
-HTTP_SUCCESS = (200, 201, 202, 203, 204, 205, 206, 207)
-
-
-class ResponseBody(dict):
- """Class that wraps an http response and dict body into a single value.
-
- Callers that receive this object will normally use it as a dict but
- can extract the response if needed.
- """
-
- def __init__(self, response, body=None):
- body_data = body or {}
- self.update(body_data)
- self.response = response
-
- def __str__(self):
- body = super.__str__(self)
- return "response: %s\nBody: %s" % (self.response, body)
-
-
-class ResponseBodyList(list):
- """Class that wraps an http response and list body into a single value.
-
- Callers that receive this object will normally use it as a list but
- can extract the response if needed.
- """
-
- def __init__(self, response, body=None):
- body_data = body or []
- self.extend(body_data)
- self.response = response
-
- def __str__(self):
- body = super.__str__(self)
- return "response: %s\nBody: %s" % (self.response, body)
-
-
-class RestClient(object):
-
- TYPE = "json"
-
- LOG = logging.getLogger(__name__)
-
- def __init__(self, auth_provider):
- self.auth_provider = auth_provider
-
- self.endpoint_url = None
- self.service = None
- # The version of the API this client implements
- self.api_version = None
- self._skip_path = False
- self.build_interval = CONF.compute.build_interval
- self.build_timeout = CONF.compute.build_timeout
- self.general_header_lc = set(('cache-control', 'connection',
- 'date', 'pragma', 'trailer',
- 'transfer-encoding', 'via',
- 'warning'))
- self.response_header_lc = set(('accept-ranges', 'age', 'etag',
- 'location', 'proxy-authenticate',
- 'retry-after', 'server',
- 'vary', 'www-authenticate'))
- dscv = CONF.identity.disable_ssl_certificate_validation
- ca_certs = CONF.identity.ca_certificates_file
- self.http_obj = http.ClosingHttp(
- disable_ssl_certificate_validation=dscv, ca_certs=ca_certs)
-
- def _get_type(self):
- return self.TYPE
-
- def get_headers(self, accept_type=None, send_type=None):
- if accept_type is None:
- accept_type = self._get_type()
- if send_type is None:
- send_type = self._get_type()
- return {'Content-Type': 'application/%s' % send_type,
- 'Accept': 'application/%s' % accept_type}
-
- def __str__(self):
- STRING_LIMIT = 80
- str_format = ("config:%s, service:%s, base_url:%s, "
- "filters: %s, build_interval:%s, build_timeout:%s"
- "\ntoken:%s..., \nheaders:%s...")
- return str_format % (CONF, self.service, self.base_url,
- self.filters, self.build_interval,
- self.build_timeout,
- str(self.token)[0:STRING_LIMIT],
- str(self.get_headers())[0:STRING_LIMIT])
-
- def _get_region(self, service):
- """
- Returns the region for a specific service
- """
- service_region = None
- for cfgname in dir(CONF._config):
- # Find all config.FOO.catalog_type and assume FOO is a service.
- cfg = getattr(CONF, cfgname)
- catalog_type = getattr(cfg, 'catalog_type', None)
- if catalog_type == service:
- service_region = getattr(cfg, 'region', None)
- if not service_region:
- service_region = CONF.identity.region
- return service_region
-
- def _get_endpoint_type(self, service):
- """
- Returns the endpoint type for a specific service
- """
- # If the client requests a specific endpoint type, then be it
- if self.endpoint_url:
- return self.endpoint_url
- endpoint_type = None
- for cfgname in dir(CONF._config):
- # Find all config.FOO.catalog_type and assume FOO is a service.
- cfg = getattr(CONF, cfgname)
- catalog_type = getattr(cfg, 'catalog_type', None)
- if catalog_type == service:
- endpoint_type = getattr(cfg, 'endpoint_type', 'publicURL')
- break
- return endpoint_type
-
- @property
- def user(self):
- return self.auth_provider.credentials.username
-
- @property
- def user_id(self):
- return self.auth_provider.credentials.user_id
-
- @property
- def tenant_name(self):
- return self.auth_provider.credentials.tenant_name
-
- @property
- def tenant_id(self):
- return self.auth_provider.credentials.tenant_id
-
- @property
- def password(self):
- return self.auth_provider.credentials.password
-
- @property
- def base_url(self):
- return self.auth_provider.base_url(filters=self.filters)
-
- @property
- def token(self):
- return self.auth_provider.get_token()
-
- @property
- def filters(self):
- _filters = dict(
- service=self.service,
- endpoint_type=self._get_endpoint_type(self.service),
- region=self._get_region(self.service)
- )
- if self.api_version is not None:
- _filters['api_version'] = self.api_version
- if self._skip_path:
- _filters['skip_path'] = self._skip_path
- return _filters
-
- def skip_path(self):
- """
- When set, ignore the path part of the base URL from the catalog
- """
- self._skip_path = True
-
- def reset_path(self):
- """
- When reset, use the base URL from the catalog as-is
- """
- self._skip_path = False
-
- @classmethod
- def expected_success(cls, expected_code, read_code):
- assert_msg = ("This function only allowed to use for HTTP status"
- "codes which explicitly defined in the RFC 7231 & 4918."
- "{0} is not a defined Success Code!"
- ).format(expected_code)
- if isinstance(expected_code, list):
- for code in expected_code:
- assert code in HTTP_SUCCESS, assert_msg
- else:
- assert expected_code in HTTP_SUCCESS, assert_msg
-
- # NOTE(afazekas): the http status code above 400 is processed by
- # the _error_checker method
- if read_code < 400:
- pattern = """Unexpected http success status code {0},
- The expected status code is {1}"""
- if ((not isinstance(expected_code, list) and
- (read_code != expected_code)) or
- (isinstance(expected_code, list) and
- (read_code not in expected_code))):
- details = pattern.format(read_code, expected_code)
- raise exceptions.InvalidHttpSuccessCode(details)
-
- def post(self, url, body, headers=None, extra_headers=False):
- return self.request('POST', url, extra_headers, headers, body)
-
- def get(self, url, headers=None, extra_headers=False):
- return self.request('GET', url, extra_headers, headers)
-
- def delete(self, url, headers=None, body=None, extra_headers=False):
- return self.request('DELETE', url, extra_headers, headers, body)
-
- def patch(self, url, body, headers=None, extra_headers=False):
- return self.request('PATCH', url, extra_headers, headers, body)
-
- def put(self, url, body, headers=None, extra_headers=False):
- return self.request('PUT', url, extra_headers, headers, body)
-
- def head(self, url, headers=None, extra_headers=False):
- return self.request('HEAD', url, extra_headers, headers)
-
- def copy(self, url, headers=None, extra_headers=False):
- return self.request('COPY', url, extra_headers, headers)
-
- def get_versions(self):
- resp, body = self.get('')
- body = self._parse_resp(body)
- versions = map(lambda x: x['id'], body)
- return resp, versions
-
- def _get_request_id(self, resp):
- for i in ('x-openstack-request-id', 'x-compute-request-id'):
- if i in resp:
- return resp[i]
- return ""
-
- def _safe_body(self, body, maxlen=4096):
- # convert a structure into a string safely
- try:
- text = six.text_type(body)
- except UnicodeDecodeError:
- # if this isn't actually text, return marker that
- return "<BinaryData: removed>"
- if len(text) > maxlen:
- return text[:maxlen]
- else:
- return text
-
- def _log_request_start(self, method, req_url, req_headers=None,
- req_body=None):
- if req_headers is None:
- req_headers = {}
- caller_name = misc_utils.find_test_caller()
- trace_regex = CONF.debug.trace_requests
- if trace_regex and re.search(trace_regex, caller_name):
- self.LOG.debug('Starting Request (%s): %s %s' %
- (caller_name, method, req_url))
-
- def _log_request_full(self, method, req_url, resp,
- secs="", req_headers=None,
- req_body=None, resp_body=None,
- caller_name=None, extra=None):
- if 'X-Auth-Token' in req_headers:
- req_headers['X-Auth-Token'] = '<omitted>'
- log_fmt = """Request (%s): %s %s %s%s
- Request - Headers: %s
- Body: %s
- Response - Headers: %s
- Body: %s"""
-
- self.LOG.debug(
- log_fmt % (
- caller_name,
- resp['status'],
- method,
- req_url,
- secs,
- str(req_headers),
- self._safe_body(req_body),
- str(resp),
- self._safe_body(resp_body)),
- extra=extra)
-
- def _log_request(self, method, req_url, resp,
- secs="", req_headers=None,
- req_body=None, resp_body=None):
- if req_headers is None:
- req_headers = {}
- # if we have the request id, put it in the right part of the log
- extra = dict(request_id=self._get_request_id(resp))
- # NOTE(sdague): while we still have 6 callers to this function
- # we're going to just provide work around on who is actually
- # providing timings by gracefully adding no content if they don't.
- # Once we're down to 1 caller, clean this up.
- caller_name = misc_utils.find_test_caller()
- if secs:
- secs = " %.3fs" % secs
- if not self.LOG.isEnabledFor(real_logging.DEBUG):
- self.LOG.info(
- 'Request (%s): %s %s %s%s' % (
- caller_name,
- resp['status'],
- method,
- req_url,
- secs),
- extra=extra)
-
- # Also look everything at DEBUG if you want to filter this
- # out, don't run at debug.
- self._log_request_full(method, req_url, resp, secs, req_headers,
- req_body, resp_body, caller_name, extra)
-
- def _parse_resp(self, body):
- body = json.loads(body)
-
- # We assume, that if the first value of the deserialized body's
- # item set is a dict or a list, that we just return the first value
- # of deserialized body.
- # Essentially "cutting out" the first placeholder element in a body
- # that looks like this:
- #
- # {
- # "users": [
- # ...
- # ]
- # }
- try:
- # Ensure there are not more than one top-level keys
- if len(body.keys()) > 1:
- return body
- # Just return the "wrapped" element
- first_key, first_item = body.items()[0]
- if isinstance(first_item, (dict, list)):
- return first_item
- except (ValueError, IndexError):
- pass
- return body
-
- def response_checker(self, method, resp, resp_body):
- if (resp.status in set((204, 205, 304)) or resp.status < 200 or
- method.upper() == 'HEAD') and resp_body:
- raise exceptions.ResponseWithNonEmptyBody(status=resp.status)
- # NOTE(afazekas):
- # If the HTTP Status Code is 205
- # 'The response MUST NOT include an entity.'
- # A HTTP entity has an entity-body and an 'entity-header'.
- # In the HTTP response specification (Section 6) the 'entity-header'
- # 'generic-header' and 'response-header' are in OR relation.
- # All headers not in the above two group are considered as entity
- # header in every interpretation.
-
- if (resp.status == 205 and
- 0 != len(set(resp.keys()) - set(('status',)) -
- self.response_header_lc - self.general_header_lc)):
- raise exceptions.ResponseWithEntity()
- # NOTE(afazekas)
- # Now the swift sometimes (delete not empty container)
- # returns with non json error response, we can create new rest class
- # for swift.
- # Usually RFC2616 says error responses SHOULD contain an explanation.
- # The warning is normal for SHOULD/SHOULD NOT case
-
- # Likely it will cause an error
- if method != 'HEAD' and not resp_body and resp.status >= 400:
- self.LOG.warning("status >= 400 response with empty body")
-
- def _request(self, method, url, headers=None, body=None):
- """A simple HTTP request interface."""
- # Authenticate the request with the auth provider
- req_url, req_headers, req_body = self.auth_provider.auth_request(
- method, url, headers, body, self.filters)
-
- # Do the actual request, and time it
- start = time.time()
- self._log_request_start(method, req_url)
- resp, resp_body = self.http_obj.request(
- req_url, method, headers=req_headers, body=req_body)
- end = time.time()
- self._log_request(method, req_url, resp, secs=(end - start),
- req_headers=req_headers, req_body=req_body,
- resp_body=resp_body)
-
- # Verify HTTP response codes
- self.response_checker(method, resp, resp_body)
-
- return resp, resp_body
-
- def request(self, method, url, extra_headers=False, headers=None,
- body=None):
- # if extra_headers is True
- # default headers would be added to headers
- retry = 0
-
- if headers is None:
- # NOTE(vponomaryov): if some client do not need headers,
- # it should explicitly pass empty dict
- headers = self.get_headers()
- elif extra_headers:
- try:
- headers = headers.copy()
- headers.update(self.get_headers())
- except (ValueError, TypeError):
- headers = self.get_headers()
-
- resp, resp_body = self._request(method, url,
- headers=headers, body=body)
-
- while (resp.status == 413 and
- 'retry-after' in resp and
- not self.is_absolute_limit(
- resp, self._parse_resp(resp_body)) and
- retry < MAX_RECURSION_DEPTH):
- retry += 1
- delay = int(resp['retry-after'])
- time.sleep(delay)
- resp, resp_body = self._request(method, url,
- headers=headers, body=body)
- self._error_checker(method, url, headers, body,
- resp, resp_body)
- return resp, resp_body
-
- def _error_checker(self, method, url,
- headers, body, resp, resp_body):
-
- # NOTE(mtreinish): Check for httplib response from glance_http. The
- # object can't be used here because importing httplib breaks httplib2.
- # If another object from a class not imported were passed here as
- # resp this could possibly fail
- if str(type(resp)) == "<type 'instance'>":
- ctype = resp.getheader('content-type')
- else:
- try:
- ctype = resp['content-type']
- # NOTE(mtreinish): Keystone delete user responses doesn't have a
- # content-type header. (They don't have a body) So just pretend it
- # is set.
- except KeyError:
- ctype = 'application/json'
-
- # It is not an error response
- if resp.status < 400:
- return
-
- JSON_ENC = ['application/json', 'application/json; charset=utf-8']
- # NOTE(mtreinish): This is for compatibility with Glance and swift
- # APIs. These are the return content types that Glance api v1
- # (and occasionally swift) are using.
- TXT_ENC = ['text/plain', 'text/html', 'text/html; charset=utf-8',
- 'text/plain; charset=utf-8']
-
- if ctype.lower() in JSON_ENC:
- parse_resp = True
- elif ctype.lower() in TXT_ENC:
- parse_resp = False
- else:
- raise exceptions.InvalidContentType(str(resp.status))
-
- if resp.status == 401 or resp.status == 403:
- raise exceptions.Unauthorized(resp_body)
-
- if resp.status == 404:
- raise exceptions.NotFound(resp_body)
-
- if resp.status == 400:
- if parse_resp:
- resp_body = self._parse_resp(resp_body)
- raise exceptions.BadRequest(resp_body)
-
- if resp.status == 409:
- if parse_resp:
- resp_body = self._parse_resp(resp_body)
- raise exceptions.Conflict(resp_body)
-
- if resp.status == 413:
- if parse_resp:
- resp_body = self._parse_resp(resp_body)
- if self.is_absolute_limit(resp, resp_body):
- raise exceptions.OverLimit(resp_body)
- else:
- raise exceptions.RateLimitExceeded(resp_body)
-
- if resp.status == 422:
- if parse_resp:
- resp_body = self._parse_resp(resp_body)
- raise exceptions.UnprocessableEntity(resp_body)
-
- if resp.status in (500, 501):
- message = resp_body
- if parse_resp:
- try:
- resp_body = self._parse_resp(resp_body)
- except ValueError:
- # If response body is a non-json string message.
- # Use resp_body as is and raise InvalidResponseBody
- # exception.
- raise exceptions.InvalidHTTPResponseBody(message)
- else:
- if isinstance(resp_body, dict):
- # I'm seeing both computeFault
- # and cloudServersFault come back.
- # Will file a bug to fix, but leave as is for now.
- if 'cloudServersFault' in resp_body:
- message = resp_body['cloudServersFault']['message']
- elif 'computeFault' in resp_body:
- message = resp_body['computeFault']['message']
- elif 'error' in resp_body:
- message = resp_body['error']['message']
- elif 'message' in resp_body:
- message = resp_body['message']
- else:
- message = resp_body
-
- if resp.status == 501:
- raise exceptions.NotImplemented(message)
- else:
- raise exceptions.ServerFault(message)
-
- if resp.status >= 400:
- raise exceptions.UnexpectedResponseCode(str(resp.status))
-
- def is_absolute_limit(self, resp, resp_body):
- if (not isinstance(resp_body, collections.Mapping) or
- 'retry-after' not in resp):
- return True
- over_limit = resp_body.get('overLimit', None)
- if not over_limit:
- return True
- return 'exceed' in over_limit.get('message', 'blabla')
-
- def wait_for_resource_deletion(self, id):
- """Waits for a resource to be deleted."""
- start_time = int(time.time())
- while True:
- if self.is_resource_deleted(id):
- return
- if int(time.time()) - start_time >= self.build_timeout:
- message = ('Failed to delete %(resource_type)s %(id)s within '
- 'the required time (%(timeout)s s).' %
- {'resource_type': self.resource_type, 'id': id,
- 'timeout': self.build_timeout})
- caller = misc_utils.find_test_caller()
- if caller:
- message = '(%s) %s' % (caller, message)
- raise exceptions.TimeoutException(message)
- time.sleep(self.build_interval)
-
- def is_resource_deleted(self, id):
- """
- Subclasses override with specific deletion detection.
- """
- message = ('"%s" does not implement is_resource_deleted'
- % self.__class__.__name__)
- raise NotImplementedError(message)
-
- @property
- def resource_type(self):
- """Returns the primary type of resource this client works with."""
- return 'resource'
-
- @classmethod
- def validate_response(cls, schema, resp, body):
- # Only check the response if the status code is a success code
- # TODO(cyeoh): Eventually we should be able to verify that a failure
- # code if it exists is something that we expect. This is explicitly
- # declared in the V3 API and so we should be able to export this in
- # the response schema. For now we'll ignore it.
- if resp.status in HTTP_SUCCESS:
- cls.expected_success(schema['status_code'], resp.status)
-
- # Check the body of a response
- body_schema = schema.get('response_body')
- if body_schema:
- try:
- jsonschema.validate(body, body_schema)
- except jsonschema.ValidationError as ex:
- msg = ("HTTP response body is invalid (%s)") % ex
- raise exceptions.InvalidHTTPResponseBody(msg)
- else:
- if body:
- msg = ("HTTP response body should not exist (%s)") % body
- raise exceptions.InvalidHTTPResponseBody(msg)
-
- # Check the header of a response
- header_schema = schema.get('response_header')
- if header_schema:
- try:
- jsonschema.validate(resp, header_schema)
- except jsonschema.ValidationError as ex:
- msg = ("HTTP response header is invalid (%s)") % ex
- raise exceptions.InvalidHTTPResponseHeader(msg)
-
-
-class NegativeRestClient(RestClient):
- """
- Version of RestClient that does not raise exceptions.
- """
- def _error_checker(self, method, url,
- headers, body, resp, resp_body):
- pass
-
- def send_request(self, method, url_template, resources, body=None):
- url = url_template % tuple(resources)
- if method == "GET":
- resp, body = self.get(url)
- elif method == "POST":
- resp, body = self.post(url, body)
- elif method == "PUT":
- resp, body = self.put(url, body)
- elif method == "PATCH":
- resp, body = self.patch(url, body)
- elif method == "HEAD":
- resp, body = self.head(url)
- elif method == "DELETE":
- resp, body = self.delete(url)
- elif method == "COPY":
- resp, body = self.copy(url)
- else:
- assert False
-
- return resp, body
diff --git a/tempest/common/service_client.py b/tempest/common/service_client.py
new file mode 100644
index 0000000..d2f67e3
--- /dev/null
+++ b/tempest/common/service_client.py
@@ -0,0 +1,125 @@
+# Copyright 2015 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.
+
+from tempest_lib.common import rest_client
+from tempest_lib import exceptions as lib_exceptions
+
+from tempest import config
+from tempest import exceptions
+
+CONF = config.CONF
+
+
+class ServiceClient(rest_client.RestClient):
+
+ def __init__(self, auth_provider, service, region,
+ endpoint_type=None, build_interval=None, build_timeout=None,
+ disable_ssl_certificate_validation=None, ca_certs=None,
+ trace_requests=None):
+
+ # TODO(oomichi): This params setting should be removed after all
+ # service clients pass these values, and we can make ServiceClient
+ # free from CONF values.
+ dscv = (disable_ssl_certificate_validation or
+ CONF.identity.disable_ssl_certificate_validation)
+ params = {
+ 'disable_ssl_certificate_validation': dscv,
+ 'ca_certs': ca_certs or CONF.identity.ca_certificates_file,
+ 'trace_requests': trace_requests or CONF.debug.trace_requests
+ }
+
+ if endpoint_type is not None:
+ params.update({'endpoint_type': endpoint_type})
+ if build_interval is not None:
+ params.update({'build_interval': build_interval})
+ if build_timeout is not None:
+ params.update({'build_timeout': build_timeout})
+ super(ServiceClient, self).__init__(auth_provider, service, region,
+ **params)
+
+ def request(self, method, url, extra_headers=False, headers=None,
+ body=None):
+ # TODO(oomichi): This translation is just for avoiding a single
+ # huge patch to migrate rest_client module to tempest-lib.
+ # Ideally(in the future), we need to remove this translation and
+ # replace each API tests with tempest-lib's exceptions.
+ try:
+ return super(ServiceClient, self).request(
+ method, url,
+ extra_headers=extra_headers,
+ headers=headers, body=body)
+ except lib_exceptions.Unauthorized as ex:
+ raise exceptions.Unauthorized(ex)
+ except lib_exceptions.NotFound as ex:
+ raise exceptions.NotFound(ex)
+ except lib_exceptions.BadRequest as ex:
+ raise exceptions.BadRequest(ex)
+ except lib_exceptions.Conflict as ex:
+ raise exceptions.Conflict(ex)
+ except lib_exceptions.OverLimit as ex:
+ raise exceptions.OverLimit(ex)
+ except lib_exceptions.RateLimitExceeded as ex:
+ raise exceptions.RateLimitExceeded(ex)
+ except lib_exceptions.InvalidContentType as ex:
+ raise exceptions.InvalidContentType(ex)
+ except lib_exceptions.UnprocessableEntity as ex:
+ raise exceptions.UnprocessableEntity(ex)
+ except lib_exceptions.InvalidHTTPResponseBody as ex:
+ raise exceptions.InvalidHTTPResponseBody(ex)
+ except lib_exceptions.NotImplemented as ex:
+ raise exceptions.NotImplemented(ex)
+ except lib_exceptions.ServerFault as ex:
+ raise exceptions.ServerFault(ex)
+ except lib_exceptions.UnexpectedResponseCode as ex:
+ raise exceptions.UnexpectedResponseCode(ex)
+ # TODO(oomichi): This is just a workaround for failing gate tests
+ # when separating Forbidden from Unauthorized in tempest-lib.
+ # We will need to remove this translation and replace negative tests
+ # with lib_exceptions.Forbidden in the future.
+ except lib_exceptions.Forbidden as ex:
+ raise exceptions.Unauthorized(ex)
+
+
+class ResponseBody(dict):
+ """Class that wraps an http response and dict body into a single value.
+
+ Callers that receive this object will normally use it as a dict but
+ can extract the response if needed.
+ """
+
+ def __init__(self, response, body=None):
+ body_data = body or {}
+ self.update(body_data)
+ self.response = response
+
+ def __str__(self):
+ body = super.__str__(self)
+ return "response: %s\nBody: %s" % (self.response, body)
+
+
+class ResponseBodyList(list):
+ """Class that wraps an http response and list body into a single value.
+
+ Callers that receive this object will normally use it as a list but
+ can extract the response if needed.
+ """
+
+ def __init__(self, response, body=None):
+ body_data = body or []
+ self.extend(body_data)
+ self.response = response
+
+ def __str__(self):
+ body = super.__str__(self)
+ return "response: %s\nBody: %s" % (self.response, body)
diff --git a/tempest/common/utils/linux/remote_client.py b/tempest/common/utils/linux/remote_client.py
index d8bfef8..6e61c55 100644
--- a/tempest/common/utils/linux/remote_client.py
+++ b/tempest/common/utils/linux/remote_client.py
@@ -97,6 +97,10 @@
cmd = "/bin/ip addr | awk '/ether/ {print $2}'"
return self.exec_command(cmd)
+ def get_nic_name(self, address):
+ cmd = "/bin/ip -o addr | awk '/%s/ {print $2}'" % address
+ return self.exec_command(cmd)
+
def get_ip_list(self):
cmd = "/bin/ip address"
return self.exec_command(cmd)
@@ -116,3 +120,47 @@
# Get pid(s) of a process/program
cmd = "ps -ef | grep %s | grep -v 'grep' | awk {'print $1'}" % pr_name
return self.exec_command(cmd).split('\n')
+
+ def get_dns_servers(self):
+ cmd = 'cat /etc/resolv.conf'
+ resolve_file = self.exec_command(cmd).strip().split('\n')
+ entries = (l.split() for l in resolve_file)
+ dns_servers = [l[1] for l in entries
+ if len(l) and l[0] == 'nameserver']
+ return dns_servers
+
+ def send_signal(self, pid, signum):
+ cmd = 'sudo /bin/kill -{sig} {pid}'.format(pid=pid, sig=signum)
+ return self.exec_command(cmd)
+
+ def _renew_lease_udhcpc(self, fixed_ip=None):
+ """Renews DHCP lease via udhcpc client. """
+ file_path = '/var/run/udhcpc.'
+ nic_name = self.get_nic_name(fixed_ip)
+ nic_name = nic_name.strip().lower()
+ pid = self.exec_command('cat {path}{nic}.pid'.
+ format(path=file_path, nic=nic_name))
+ pid = pid.strip()
+ self.send_signal(pid, 'USR1')
+
+ def _renew_lease_dhclient(self, fixed_ip=None):
+ """Renews DHCP lease via dhclient client. """
+ cmd = "sudo /sbin/dhclient -r && /sbin/dhclient"
+ self.exec_command(cmd)
+
+ def renew_lease(self, fixed_ip=None):
+ """Wrapper method for renewing DHCP lease via given client
+
+ Supporting:
+ * udhcpc
+ * dhclient
+ """
+ # TODO(yfried): add support for dhcpcd
+ suported_clients = ['udhcpc', 'dhclient']
+ dhcp_client = CONF.scenario.dhcp_client
+ if dhcp_client not in suported_clients:
+ raise exceptions.InvalidConfiguration('%s DHCP client unsupported'
+ % dhcp_client)
+ if dhcp_client == 'udhcpc' and not fixed_ip:
+ raise ValueError("need to set 'fixed_ip' for udhcpc client")
+ return getattr(self, '_renew_lease_' + dhcp_client)(fixed_ip=fixed_ip)
\ No newline at end of file
diff --git a/tempest/common/waiters.py b/tempest/common/waiters.py
index 3066667..c77c81e 100644
--- a/tempest/common/waiters.py
+++ b/tempest/common/waiters.py
@@ -101,12 +101,12 @@
The client should have a get_image(image_id) method to get the image.
The client should also have build_interval and build_timeout attributes.
"""
- resp, image = client.get_image(image_id)
+ image = client.get_image(image_id)
start = int(time.time())
while image['status'] != status:
time.sleep(client.build_interval)
- resp, image = client.get_image(image_id)
+ image = client.get_image(image_id)
status_curr = image['status']
if status_curr == 'ERROR':
raise exceptions.AddImageException(image_id=image_id)
diff --git a/tempest/config.py b/tempest/config.py
index 4f5eae0..70f972f 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -59,6 +59,9 @@
"It requires at least `2 * CONC` distinct accounts "
"configured in `test_accounts_file`, with CONC == the "
"number of concurrent test processes."),
+ cfg.ListOpt('tempest_roles',
+ help="Roles to assign to all users created by tempest",
+ default=[])
]
identity_group = cfg.OptGroup(name='identity',
@@ -187,7 +190,7 @@
default=300,
help="Timeout in seconds to wait for an instance to build. "
"Other services that do not define build_timeout will "
- "inherit this value, for example the image service."),
+ "inherit this value."),
cfg.BoolOpt('run_ssh',
default=False,
help="Should the tests ssh to instances?"),
@@ -350,23 +353,6 @@
]
-compute_admin_group = cfg.OptGroup(name='compute-admin',
- title="Compute Admin Options")
-
-ComputeAdminGroup = [
- cfg.StrOpt('username',
- help="Administrative Username to use for Nova API requests."),
- cfg.StrOpt('tenant_name',
- help="Administrative Tenant name to use for Nova API "
- "requests."),
- cfg.StrOpt('password',
- help="API key to use when authenticating as admin.",
- secret=True),
- cfg.StrOpt('domain_name',
- help="Domain name for authentication as admin (Keystone V3)."
- "The same domain applies to user and project"),
-]
-
image_group = cfg.OptGroup(name='image',
title="Image Service Options")
@@ -388,7 +374,15 @@
cfg.StrOpt('http_image',
default='http://download.cirros-cloud.net/0.3.1/'
'cirros-0.3.1-x86_64-uec.tar.gz',
- help='http accessible image')
+ help='http accessible image'),
+ cfg.IntOpt('build_timeout',
+ default=300,
+ help="Timeout in seconds to wait for an image to "
+ "become available."),
+ cfg.IntOpt('build_interval',
+ default=1,
+ help="Time in seconds between image operation status "
+ "checks.")
]
image_feature_group = cfg.OptGroup(name='image-feature-enabled',
@@ -607,7 +601,7 @@
'publicURL', 'adminURL', 'internalURL'],
help="The endpoint type to use for the object-store service."),
cfg.IntOpt('container_sync_timeout',
- default=120,
+ default=600,
help="Number of seconds to time on waiting for a container "
"to container synchronization complete."),
cfg.IntOpt('container_sync_interval',
@@ -621,6 +615,17 @@
cfg.StrOpt('reseller_admin_role',
default='ResellerAdmin',
help="User role that has reseller admin"),
+ cfg.StrOpt('realm_name',
+ default='realm1',
+ help="Name of sync realm. A sync realm is a set of clusters "
+ "that have agreed to allow container syncing with each "
+ "other. Set the same realm name as Swift's "
+ "container-sync-realms.conf"),
+ cfg.StrOpt('cluster_name',
+ default='name1',
+ help="One name of cluster which is set in the realm whose name "
+ "is set in 'realm_name' item in this file. Set the "
+ "same cluster name as Swift's container-sync-realms.conf"),
]
object_storage_feature_group = cfg.OptGroup(
@@ -749,6 +754,17 @@
]
+data_processing_feature_group = cfg.OptGroup(
+ name="data_processing-feature-enabled",
+ title="Enabled Data Processing features")
+
+DataProcessingFeaturesGroup = [
+ cfg.ListOpt('plugins',
+ default=["vanilla", "hdp"],
+ help="List of enabled data processing plugins")
+]
+
+
boto_group = cfg.OptGroup(name='boto',
title='EC2/S3 options')
BotoGroup = [
@@ -866,7 +882,14 @@
'large_ops_number',
default=0,
help="specifies how many resources to request at once. Used "
- "for large operations testing.")
+ "for large operations testing."),
+ # TODO(yfried): add support for dhcpcd
+ cfg.StrOpt('dhcp_client',
+ default='udhcpc',
+ choices=["udhcpc", "dhclient"],
+ help='DHCP client used by images to renew DCHP lease. '
+ 'If left empty, update operation will be skipped. '
+ 'Supported clients: "udhcpc", "dhclient"')
]
@@ -1049,8 +1072,8 @@
(telemetry_group, TelemetryGroup),
(dashboard_group, DashboardGroup),
(data_processing_group, DataProcessingGroup),
+ (data_processing_feature_group, DataProcessingFeaturesGroup),
(boto_group, BotoGroup),
- (compute_admin_group, ComputeAdminGroup),
(stress_group, StressGroup),
(scenario_group, ScenarioGroup),
(service_available_group, ServiceAvailableGroup),
@@ -1120,8 +1143,9 @@
self.telemetry = cfg.CONF.telemetry
self.dashboard = cfg.CONF.dashboard
self.data_processing = cfg.CONF.data_processing
+ self.data_processing_feature_enabled = cfg.CONF[
+ 'data_processing-feature-enabled']
self.boto = cfg.CONF.boto
- self.compute_admin = cfg.CONF['compute-admin']
self.stress = cfg.CONF.stress
self.scenario = cfg.CONF.scenario
self.service_available = cfg.CONF.service_available
@@ -1130,17 +1154,11 @@
self.input_scenario = cfg.CONF['input-scenario']
self.cli = cfg.CONF.cli
self.negative = cfg.CONF.negative
- if not self.compute_admin.username:
- self.compute_admin.username = self.identity.admin_username
- self.compute_admin.password = self.identity.admin_password
- self.compute_admin.tenant_name = self.identity.admin_tenant_name
cfg.CONF.set_default('domain_name', self.identity.admin_domain_name,
group='identity')
cfg.CONF.set_default('alt_domain_name',
self.identity.admin_domain_name,
group='identity')
- cfg.CONF.set_default('domain_name', self.identity.admin_domain_name,
- group='compute-admin')
def __init__(self, parse_conf=True, config_path=None):
"""Initialize a configuration from a conf directory and conf file."""
diff --git a/tempest/exceptions.py b/tempest/exceptions.py
index 9b2b4d4..86f488a 100644
--- a/tempest/exceptions.py
+++ b/tempest/exceptions.py
@@ -51,10 +51,6 @@
pass
-class RFCViolation(RestClientException):
- message = "RFC Violation"
-
-
class InvalidConfiguration(TempestException):
message = "Invalid Configuration"
@@ -63,18 +59,6 @@
message = "Invalid Credentials"
-class InvalidHttpSuccessCode(RestClientException):
- message = "The success code is different than the expected one"
-
-
-class NotFound(RestClientException):
- message = "Object not found"
-
-
-class Unauthorized(RestClientException):
- message = 'Unauthorized'
-
-
class InvalidServiceTag(TempestException):
message = "Invalid service tag"
@@ -123,15 +107,7 @@
"'%(resource_status_reason)s'")
-class BadRequest(RestClientException):
- message = "Bad request"
-
-
-class UnprocessableEntity(RestClientException):
- message = "Unprocessable entity"
-
-
-class AuthenticationFailure(RestClientException):
+class AuthenticationFailure(TempestException):
message = ("Authentication with user %(user)s and password "
"%(password)s failed auth using tenant %(tenant)s.")
@@ -140,22 +116,6 @@
message = "Endpoint not found"
-class RateLimitExceeded(RestClientException):
- message = "Rate limit exceeded"
-
-
-class OverLimit(RestClientException):
- message = "Quota exceeded"
-
-
-class ServerFault(RestClientException):
- message = "Got server fault"
-
-
-class NotImplemented(RestClientException):
- message = "Got NotImplemented error"
-
-
class ImageFault(TempestException):
message = "Got image fault"
@@ -164,10 +124,6 @@
message = "Got identity error"
-class Conflict(RestClientException):
- message = "An object with that identifier already exists"
-
-
class SSHTimeout(TempestException):
message = ("Connection to the %(host)s via SSH timed out.\n"
"User: %(user)s, Password: %(password)s")
@@ -187,6 +143,50 @@
message = "%(num)d cleanUp operation failed"
+class RFCViolation(RestClientException):
+ message = "RFC Violation"
+
+
+class InvalidHttpSuccessCode(RestClientException):
+ message = "The success code is different than the expected one"
+
+
+class NotFound(RestClientException):
+ message = "Object not found"
+
+
+class Unauthorized(RestClientException):
+ message = 'Unauthorized'
+
+
+class BadRequest(RestClientException):
+ message = "Bad request"
+
+
+class UnprocessableEntity(RestClientException):
+ message = "Unprocessable entity"
+
+
+class RateLimitExceeded(RestClientException):
+ message = "Rate limit exceeded"
+
+
+class OverLimit(RestClientException):
+ message = "Quota exceeded"
+
+
+class ServerFault(RestClientException):
+ message = "Got server fault"
+
+
+class NotImplemented(RestClientException):
+ message = "Got NotImplemented error"
+
+
+class Conflict(RestClientException):
+ message = "An object with that identifier already exists"
+
+
class ResponseWithNonEmptyBody(RFCViolation):
message = ("RFC Violation! Response with %(status)d HTTP Status Code "
"MUST NOT have a body")
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 9cb24b9..5b092c3 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -210,7 +210,7 @@
imageRef=None, volume_type=None, wait_on_delete=True):
if name is None:
name = data_utils.rand_name(self.__class__.__name__)
- _, volume = self.volumes_client.create_volume(
+ volume = self.volumes_client.create_volume(
size=size, display_name=name, snapshot_id=snapshot_id,
imageRef=imageRef, volume_type=volume_type)
@@ -230,7 +230,7 @@
self.volumes_client.wait_for_volume_status(volume['id'], 'available')
# The volume retrieved on creation has a non-up-to-date status.
# Retrieval after it becomes active ensures correct details.
- _, volume = self.volumes_client.get_volume(volume['id'])
+ volume = self.volumes_client.get_volume(volume['id'])
return volume
def _create_loginable_secgroup_rule(self, secgroup_id=None):
@@ -338,7 +338,7 @@
'is_public': 'False',
}
params.update(properties)
- _, image = self.image_client.create_image(**params)
+ image = self.image_client.create_image(**params)
self.addCleanup(self.image_client.delete_image, image['id'])
self.assertEqual("queued", image['status'])
self.image_client.update_image(image['id'], data=image_file)
@@ -399,15 +399,15 @@
if name is None:
name = data_utils.rand_name('scenario-snapshot-')
LOG.debug("Creating a snapshot image for server: %s", server['name'])
- resp, image = _images_client.create_image(server['id'], name)
- image_id = resp['location'].split('images/')[1]
+ image = _images_client.create_image(server['id'], name)
+ image_id = image.response['location'].split('images/')[1]
_image_client.wait_for_image_status(image_id, 'active')
self.addCleanup_with_wait(
waiter_callable=_image_client.wait_for_resource_deletion,
thing_id=image_id, thing_id_param='id',
cleanup_callable=self.delete_wrapper,
cleanup_args=[_image_client.delete_image, image_id])
- _, snapshot_image = _image_client.get_image_meta(image_id)
+ snapshot_image = _image_client.get_image_meta(image_id)
image_name = snapshot_image['name']
self.assertEqual(name, image_name)
LOG.debug("Created snapshot image %s for server %s",
@@ -416,19 +416,19 @@
def nova_volume_attach(self):
# TODO(andreaf) Device should be here CONF.compute.volume_device_name
- _, volume = self.servers_client.attach_volume(
- self.server['id'], self.volume['id'], '/dev/vdb')
+ volume = self.servers_client.attach_volume(
+ self.server['id'], self.volume['id'], '/dev/vdb')[1]
self.assertEqual(self.volume['id'], volume['id'])
self.volumes_client.wait_for_volume_status(volume['id'], 'in-use')
# Refresh the volume after the attachment
- _, self.volume = self.volumes_client.get_volume(volume['id'])
+ self.volume = self.volumes_client.get_volume(volume['id'])
def nova_volume_detach(self):
self.servers_client.detach_volume(self.server['id'], self.volume['id'])
self.volumes_client.wait_for_volume_status(self.volume['id'],
'available')
- _, volume = self.volumes_client.get_volume(self.volume['id'])
+ volume = self.volumes_client.get_volume(self.volume['id'])
self.assertEqual('available', volume['status'])
def rebuild_server(self, server_id, image=None,
@@ -789,7 +789,8 @@
tenant_id=tenant_id)
# Add rules to the security group
- rules = self._create_loginable_secgroup_rule(secgroup=secgroup)
+ rules = self._create_loginable_secgroup_rule(client=client,
+ secgroup=secgroup)
for rule in rules:
self.assertEqual(tenant_id, rule.tenant_id)
self.assertEqual(secgroup.id, rule.security_group_id)
@@ -1012,12 +1013,16 @@
router.update(admin_state_up=admin_state_up)
self.assertEqual(admin_state_up, router.admin_state_up)
- def create_networks(self, client=None, tenant_id=None):
+ def create_networks(self, client=None, tenant_id=None,
+ dns_nameservers=None):
"""Create a network with a subnet connected to a router.
The baremetal driver is a special case since all nodes are
on the same shared network.
+ :param client: network client to create resources with.
+ :param tenant_id: id of tenant to create resources in.
+ :param dns_nameservers: list of dns servers to send to subnet.
:returns: network, subnet, router
"""
if CONF.baremetal.driver_enabled:
@@ -1033,7 +1038,12 @@
else:
network = self._create_network(client=client, tenant_id=tenant_id)
router = self._get_router(client=client, tenant_id=tenant_id)
- subnet = self._create_subnet(network=network, client=client)
+
+ subnet_kwargs = dict(network=network, client=client)
+ # use explicit check because empty list is a valid option
+ if dns_nameservers is not None:
+ subnet_kwargs['dns_nameservers'] = dns_nameservers
+ subnet = self._create_subnet(**subnet_kwargs)
subnet.add_to_router(router.id)
return network, subnet, router
@@ -1216,7 +1226,7 @@
name = 'generic'
randomized_name = data_utils.rand_name('scenario-type-' + name + '-')
LOG.debug("Creating a volume type: %s", randomized_name)
- _, body = client.create_volume_type(
+ body = client.create_volume_type(
randomized_name)
self.assertIn('id', body)
self.addCleanup(client.delete_volume_type, body['id'])
diff --git a/tempest/scenario/orchestration/test_server_cfn_init.py b/tempest/scenario/orchestration/test_server_cfn_init.py
index f09f00c..18b759e 100644
--- a/tempest/scenario/orchestration/test_server_cfn_init.py
+++ b/tempest/scenario/orchestration/test_server_cfn_init.py
@@ -52,13 +52,13 @@
# create the stack
self.template = self._load_template(__file__, self.template_name)
- _, stack = self.client.create_stack(
+ stack = self.client.create_stack(
name=self.stack_name,
template=self.template,
parameters=self.parameters)
stack = stack['stack']
- _, self.stack = self.client.get_stack(stack['id'])
+ self.stack = self.client.get_stack(stack['id'])
self.stack_identifier = '%s/%s' % (self.stack_name, self.stack['id'])
self.addCleanup(self.delete_wrapper,
self.orchestration_client.delete_stack,
@@ -77,7 +77,7 @@
self.client.wait_for_resource_status(
sid, 'SmokeServer', 'CREATE_COMPLETE')
- _, server_resource = self.client.get_resource(sid, 'SmokeServer')
+ server_resource = self.client.get_resource(sid, 'SmokeServer')
server_id = server_resource['physical_resource_id']
_, server = self.servers_client.get_server(server_id)
server_ip =\
@@ -104,7 +104,7 @@
self.client.wait_for_stack_status(sid, 'CREATE_COMPLETE')
- _, stack = self.client.get_stack(sid)
+ stack = self.client.get_stack(sid)
# This is an assert of great significance, as it means the following
# has happened:
diff --git a/tempest/scenario/test_aggregates_basic_ops.py b/tempest/scenario/test_aggregates_basic_ops.py
index 75769ce..469ac4a 100644
--- a/tempest/scenario/test_aggregates_basic_ops.py
+++ b/tempest/scenario/test_aggregates_basic_ops.py
@@ -43,7 +43,7 @@
return cls.admin_credentials()
def _create_aggregate(self, **kwargs):
- _, aggregate = self.aggregates_client.create_aggregate(**kwargs)
+ aggregate = self.aggregates_client.create_aggregate(**kwargs)
self.addCleanup(self._delete_aggregate, aggregate)
aggregate_name = kwargs['name']
availability_zone = kwargs['availability_zone']
@@ -55,23 +55,23 @@
self.aggregates_client.delete_aggregate(aggregate['id'])
def _get_host_name(self):
- _, hosts = self.hosts_client.list_hosts()
+ hosts = self.hosts_client.list_hosts()
self.assertTrue(len(hosts) >= 1)
computes = [x for x in hosts if x['service'] == 'compute']
return computes[0]['host_name']
def _add_host(self, aggregate_id, host):
- _, aggregate = self.aggregates_client.add_host(aggregate_id, host)
+ aggregate = self.aggregates_client.add_host(aggregate_id, host)
self.addCleanup(self._remove_host, aggregate['id'], host)
self.assertIn(host, aggregate['hosts'])
def _remove_host(self, aggregate_id, host):
- _, aggregate = self.aggregates_client.remove_host(aggregate_id, host)
+ aggregate = self.aggregates_client.remove_host(aggregate_id, host)
self.assertNotIn(host, aggregate['hosts'])
def _check_aggregate_details(self, aggregate, aggregate_name, azone,
hosts, metadata):
- _, aggregate = self.aggregates_client.get_aggregate(aggregate['id'])
+ aggregate = self.aggregates_client.get_aggregate(aggregate['id'])
self.assertEqual(aggregate_name, aggregate['name'])
self.assertEqual(azone, aggregate['availability_zone'])
self.assertEqual(hosts, aggregate['hosts'])
@@ -81,15 +81,15 @@
aggregate['metadata'][meta_key])
def _set_aggregate_metadata(self, aggregate, meta):
- _, aggregate = self.aggregates_client.set_metadata(aggregate['id'],
- meta)
+ aggregate = self.aggregates_client.set_metadata(aggregate['id'],
+ meta)
for key, value in meta.items():
self.assertEqual(meta[key], aggregate['metadata'][key])
def _update_aggregate(self, aggregate, aggregate_name,
availability_zone):
- _, aggregate = self.aggregates_client.update_aggregate(
+ aggregate = self.aggregates_client.update_aggregate(
aggregate['id'], name=aggregate_name,
availability_zone=availability_zone)
self.assertEqual(aggregate['name'], aggregate_name)
diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py
index 16a65c9..5ea48e0 100644
--- a/tempest/scenario/test_minimum_basic.py
+++ b/tempest/scenario/test_minimum_basic.py
@@ -68,21 +68,21 @@
self.volume = self.create_volume()
def cinder_list(self):
- _, volumes = self.volumes_client.list_volumes()
+ volumes = self.volumes_client.list_volumes()
self.assertIn(self.volume['id'], [x['id'] for x in volumes])
def cinder_show(self):
- _, volume = self.volumes_client.get_volume(self.volume['id'])
+ volume = self.volumes_client.get_volume(self.volume['id'])
self.assertEqual(self.volume, volume)
def nova_volume_attach(self):
volume_device_path = '/dev/' + CONF.compute.volume_device_name
- _, volume = self.servers_client.attach_volume(
- self.server['id'], self.volume['id'], volume_device_path)
+ volume = self.servers_client.attach_volume(
+ self.server['id'], self.volume['id'], volume_device_path)[1]
self.assertEqual(self.volume['id'], volume['id'])
self.volumes_client.wait_for_volume_status(volume['id'], 'in-use')
# Refresh the volume after the attachment
- _, self.volume = self.volumes_client.get_volume(volume['id'])
+ self.volume = self.volumes_client.get_volume(volume['id'])
def nova_reboot(self):
self.servers_client.reboot(self.server['id'], 'SOFT')
@@ -98,7 +98,7 @@
self.volumes_client.wait_for_volume_status(self.volume['id'],
'available')
- _, volume = self.volumes_client.get_volume(self.volume['id'])
+ volume = self.volumes_client.get_volume(self.volume['id'])
self.assertEqual('available', volume['status'])
def create_and_add_security_group(self):
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index 30c3b9d..ebc6b15 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -100,10 +100,10 @@
self.keypairs = {}
self.servers = []
- def _setup_network_and_servers(self):
+ def _setup_network_and_servers(self, **kwargs):
self.security_group = \
self._create_security_group(tenant_id=self.tenant_id)
- self.network, self.subnet, self.router = self.create_networks()
+ self.network, self.subnet, self.router = self.create_networks(**kwargs)
self.check_networks()
name = data_utils.rand_name('server-smoke')
@@ -425,3 +425,63 @@
self.check_public_network_connectivity(
should_connect=True, msg="after updating "
"admin_state_up of router to True")
+
+ def _check_dns_server(self, ssh_client, dns_servers):
+ servers = ssh_client.get_dns_servers()
+ self.assertEqual(set(dns_servers), set(servers),
+ 'Looking for servers: {trgt_serv}. '
+ 'Retrieved DNS nameservers: {act_serv} '
+ 'From host: {host}.'
+ .format(host=ssh_client.ssh_client.host,
+ act_serv=servers,
+ trgt_serv=dns_servers))
+
+ @test.skip_because(bug="1412325")
+ @testtools.skipUnless(CONF.scenario.dhcp_client,
+ "DHCP client is not available.")
+ @test.attr(type='smoke')
+ @test.services('compute', 'network')
+ def test_subnet_details(self):
+ """Tests that subnet's extra configuration details are affecting
+ the VMs
+
+ NOTE: Neutron subnets push data to servers via dhcp-agent, so any
+ update in subnet requires server to actively renew its DHCP lease.
+
+ 1. Configure subnet with dns nameserver
+ 2. retrieve the VM's configured dns and verify it matches the one
+ configured for the subnet.
+ 3. update subnet's dns
+ 4. retrieve the VM's configured dns and verify it matches the new one
+ configured for the subnet.
+
+ TODO(yfried): add host_routes
+
+ any resolution check would be testing either:
+ * l3 forwarding (tested in test_network_basic_ops)
+ * Name resolution of an external DNS nameserver - out of scope for
+ Tempest
+ """
+ # this test check only updates (no actual resolution) so using
+ # arbitrary ip addresses as nameservers, instead of parsing CONF
+ initial_dns_server = '1.2.3.4'
+ alt_dns_server = '9.8.7.6'
+ self._setup_network_and_servers(dns_nameservers=[initial_dns_server])
+ self.check_public_network_connectivity(should_connect=True)
+
+ floating_ip, server = self.floating_ip_tuple
+ ip_address = floating_ip.floating_ip_address
+ private_key = self._get_server_key(server)
+ ssh_client = self._ssh_to_server(ip_address, private_key)
+
+ self._check_dns_server(ssh_client, [initial_dns_server])
+
+ self.subnet.update(dns_nameservers=[alt_dns_server])
+ # asserts that Neutron DB has updated the nameservers
+ self.assertEqual([alt_dns_server], self.subnet.dns_nameservers,
+ "Failed to update subnet's nameservers")
+
+ # server needs to renew its dhcp lease in order to get the new dns
+ # definitions from subnet
+ ssh_client.renew_lease(fixed_ip=floating_ip['fixed_ip_address'])
+ self._check_dns_server(ssh_client, [alt_dns_server])
diff --git a/tempest/scenario/test_network_v6.py b/tempest/scenario/test_network_v6.py
index 1a82e78..dc82217 100644
--- a/tempest/scenario/test_network_v6.py
+++ b/tempest/scenario/test_network_v6.py
@@ -60,7 +60,7 @@
self.sec_grp = self._create_security_group(tenant_id=self.tenant_id)
self.srv_kwargs = {
'key_name': self.keypair['name'],
- 'security_groups': [self.sec_grp]}
+ 'security_groups': [{'name': self.sec_grp['name']}]}
def prepare_network(self, address6_mode):
"""Creates network with
diff --git a/tempest/scenario/test_security_groups_basic_ops.py b/tempest/scenario/test_security_groups_basic_ops.py
index 5e2a9d0..83739fd 100644
--- a/tempest/scenario/test_security_groups_basic_ops.py
+++ b/tempest/scenario/test_security_groups_basic_ops.py
@@ -70,8 +70,12 @@
* test that cross-tenant traffic is enabled once an appropriate
rule has been created on destination tenant.
* test that reverse traffic is still blocked
- * test than revesre traffic is enabled once an appropriate rule has
+ * test than reverse traffic is enabled once an appropriate rule has
been created on source tenant
+ 7._test_port_update_new_security_group:
+ * test that traffic is blocked with default security group
+ * test that traffic is enabled after updating port with new security
+ group having appropriate rule
assumptions:
1. alt_tenant/user existed and is different from primary_tenant/user
@@ -81,7 +85,7 @@
to it, and cross tenant check will be done on the private IP of the
destination tenant
or
- * not defined (empty string), in which case each tanant will have
+ * not defined (empty string), in which case each tenant will have
its own router connected to the public network
"""
@@ -452,7 +456,57 @@
# in-tenant check
self._test_in_tenant_block(self.primary_tenant)
self._test_in_tenant_allow(self.primary_tenant)
+ except Exception:
+ for tenant in self.tenants.values():
+ self._log_console_output(servers=tenant.servers)
+ raise
+ @test.attr(type='smoke')
+ @test.services('compute', 'network')
+ def test_port_update_new_security_group(self):
+ """
+ This test verifies the traffic after updating the vm port with new
+ security group having appropriate rule.
+ """
+ new_tenant = self.primary_tenant
+
+ # Create empty security group and add icmp rule in it
+ new_sg = self._create_empty_security_group(
+ namestart='secgroup_new-',
+ tenant_id=new_tenant.creds.tenant_id,
+ client=new_tenant.manager.network_client)
+ icmp_rule = dict(
+ protocol='icmp',
+ direction='ingress',
+ )
+ self._create_security_group_rule(
+ secgroup=new_sg,
+ client=new_tenant.manager.network_client,
+ **icmp_rule)
+ new_tenant.security_groups.update(new_sg=new_sg)
+
+ # Create server with default security group
+ name = 'server-{tenant}-gen-1-'.format(
+ tenant=new_tenant.creds.tenant_name
+ )
+ name = data_utils.rand_name(name)
+ server = self._create_server(name, new_tenant)
+
+ # Check connectivity failure with default security group
+ try:
+ access_point_ssh = self._connect_to_access_point(new_tenant)
+ self._check_connectivity(access_point=access_point_ssh,
+ ip=self._get_server_ip(server),
+ should_succeed=False)
+ server_id = server['id']
+ port_id = self._list_ports(device_id=server_id)[0]['id']
+
+ # update port with new security group and check connectivity
+ self.network_client.update_port(port_id, security_groups=[
+ new_tenant.security_groups['new_sg'].id])
+ self._check_connectivity(
+ access_point=access_point_ssh,
+ ip=self._get_server_ip(server))
except Exception:
for tenant in self.tenants.values():
self._log_console_output(servers=tenant.servers)
diff --git a/tempest/scenario/test_swift_basic_ops.py b/tempest/scenario/test_swift_basic_ops.py
index 312fbc6..660b586 100644
--- a/tempest/scenario/test_swift_basic_ops.py
+++ b/tempest/scenario/test_swift_basic_ops.py
@@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.common import http
from tempest import config
from tempest.openstack.common import log as logging
from tempest.scenario import manager
@@ -65,12 +64,9 @@
obj_name, _ = self.upload_object_to_container(container_name)
obj_url = '%s/%s/%s' % (self.object_client.base_url,
container_name, obj_name)
- dscv = CONF.identity.disable_ssl_certificate_validation
- ca_certs = CONF.identity.ca_certificates_file
- http_client = http.ClosingHttp(
- disable_ssl_certificate_validation=dscv, ca_certs=ca_certs)
- resp, _ = http_client.request(obj_url, 'GET')
+ resp, _ = self.object_client.raw_request(obj_url, 'GET')
self.assertEqual(resp.status, 401)
+
self.change_container_acl(container_name, '.r:*')
- resp, _ = http_client.request(obj_url, 'GET')
+ resp, _ = self.object_client.raw_request(obj_url, 'GET')
self.assertEqual(resp.status, 200)
diff --git a/tempest/scenario/test_volume_boot_pattern.py b/tempest/scenario/test_volume_boot_pattern.py
index c584a6e..910fd79 100644
--- a/tempest/scenario/test_volume_boot_pattern.py
+++ b/tempest/scenario/test_volume_boot_pattern.py
@@ -66,7 +66,7 @@
def _create_snapshot_from_volume(self, vol_id):
snap_name = data_utils.rand_name('snapshot')
- _, snap = self.snapshots_client.create_snapshot(
+ snap = self.snapshots_client.create_snapshot(
volume_id=vol_id,
force=True,
display_name=snap_name)
diff --git a/tempest/scenario/utils.py b/tempest/scenario/utils.py
index e6624a3..7967949 100644
--- a/tempest/scenario/utils.py
+++ b/tempest/scenario/utils.py
@@ -46,7 +46,7 @@
self.flavors_client = os.flavors_client
def ssh_user(self, image_id):
- _, _image = self.images_client.get_image(image_id)
+ _image = self.images_client.get_image(image_id)
for regex, user in self.ssh_users:
# First match wins
if re.match(regex, _image['name']) is not None:
@@ -59,14 +59,14 @@
string=str(image['name']))
def is_sshable_image(self, image_id):
- _, _image = self.images_client.get_image(image_id)
+ _image = self.images_client.get_image(image_id)
return self._is_sshable_image(_image)
def _is_flavor_enough(self, flavor, image):
return image['minDisk'] <= flavor['disk']
def is_flavor_enough(self, flavor_id, image_id):
- _, _image = self.images_client.get_image(image_id)
+ _image = self.images_client.get_image(image_id)
_, _flavor = self.flavors_client.get_flavor_details(flavor_id)
return self._is_flavor_enough(_flavor, _image)
@@ -120,7 +120,7 @@
if not CONF.service_available.glance:
return []
if not hasattr(self, '_scenario_images'):
- _, images = self.images_client.list_images()
+ images = self.images_client.list_images()
self._scenario_images = [
(self._normalize_name(i['name']), dict(image_ref=i['id']))
for i in images if re.search(self.image_pattern,
diff --git a/tempest/services/baremetal/base.py b/tempest/services/baremetal/base.py
index 4933300..a0ffd28 100644
--- a/tempest/services/baremetal/base.py
+++ b/tempest/services/baremetal/base.py
@@ -16,7 +16,7 @@
import six
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest import config
CONF = config.CONF
@@ -42,15 +42,18 @@
return wrapper
-class BaremetalClient(rest_client.RestClient):
+class BaremetalClient(service_client.ServiceClient):
"""
Base Tempest REST client for Ironic API.
"""
def __init__(self, auth_provider):
- super(BaremetalClient, self).__init__(auth_provider)
- self.service = CONF.baremetal.catalog_type
+ super(BaremetalClient, self).__init__(
+ auth_provider,
+ CONF.baremetal.catalog_type,
+ CONF.identity.region,
+ endpoint_type=CONF.baremetal.endpoint_type)
self.uri_prefix = ''
def serialize(self, object_type, object_dict):
diff --git a/tempest/services/baremetal/v1/base_v1.py b/tempest/services/baremetal/v1/base_v1.py
index 9359808..9435dbf 100644
--- a/tempest/services/baremetal/v1/base_v1.py
+++ b/tempest/services/baremetal/v1/base_v1.py
@@ -114,6 +114,19 @@
"""
return self._show_request('ports', uuid)
+ @base.handle_errors
+ def show_port_by_address(self, address):
+ """
+ Gets a specific port by address.
+
+ :param address: MAC address of the port.
+ :return: Serialized port as a dictionary.
+
+ """
+ uri = '/ports/detail?address=%s' % address
+
+ return self._show_request('ports', uuid=None, uri=uri)
+
def show_driver(self, driver_name):
"""
Gets a specific driver.
diff --git a/tempest/services/compute/json/agents_client.py b/tempest/services/compute/json/agents_client.py
index eacd367..e17495f 100644
--- a/tempest/services/compute/json/agents_client.py
+++ b/tempest/services/compute/json/agents_client.py
@@ -17,10 +17,10 @@
from tempest.api_schema.response.compute import agents as common_schema
from tempest.api_schema.response.compute.v2 import agents as schema
-from tempest.services.compute.json import base
+from tempest.common import service_client
-class AgentsClientJSON(base.ComputeClient):
+class AgentsClientJSON(service_client.ServiceClient):
"""
Tests Agents API
"""
@@ -33,7 +33,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(common_schema.list_agents, resp, body)
- return resp, body['agents']
+ return service_client.ResponseBodyList(resp, body['agents'])
def create_agent(self, **kwargs):
"""Create an agent build."""
@@ -41,16 +41,16 @@
resp, body = self.post('os-agents', post_body)
body = json.loads(body)
self.validate_response(schema.create_agent, resp, body)
- return resp, body['agent']
+ return service_client.ResponseBody(resp, body['agent'])
def delete_agent(self, agent_id):
"""Delete an existing agent build."""
resp, body = self.delete("os-agents/%s" % str(agent_id))
self.validate_response(schema.delete_agent, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def update_agent(self, agent_id, **kwargs):
"""Update an agent build."""
put_body = json.dumps({'para': kwargs})
resp, body = self.put('os-agents/%s' % str(agent_id), put_body)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
diff --git a/tempest/services/compute/json/aggregates_client.py b/tempest/services/compute/json/aggregates_client.py
index 1539259..94ea713 100644
--- a/tempest/services/compute/json/aggregates_client.py
+++ b/tempest/services/compute/json/aggregates_client.py
@@ -17,25 +17,25 @@
from tempest.api_schema.response.compute import aggregates as schema
from tempest.api_schema.response.compute.v2 import aggregates as v2_schema
+from tempest.common import service_client
from tempest import exceptions
-from tempest.services.compute.json import base
-class AggregatesClientJSON(base.ComputeClient):
+class AggregatesClientJSON(service_client.ServiceClient):
def list_aggregates(self):
"""Get aggregate list."""
resp, body = self.get("os-aggregates")
body = json.loads(body)
self.validate_response(schema.list_aggregates, resp, body)
- return resp, body['aggregates']
+ return service_client.ResponseBodyList(resp, body['aggregates'])
def get_aggregate(self, aggregate_id):
"""Get details of the given aggregate."""
resp, body = self.get("os-aggregates/%s" % str(aggregate_id))
body = json.loads(body)
self.validate_response(schema.get_aggregate, resp, body)
- return resp, body['aggregate']
+ return service_client.ResponseBody(resp, body['aggregate'])
def create_aggregate(self, **kwargs):
"""Creates a new aggregate."""
@@ -44,7 +44,7 @@
body = json.loads(body)
self.validate_response(v2_schema.create_aggregate, resp, body)
- return resp, body['aggregate']
+ return service_client.ResponseBody(resp, body['aggregate'])
def update_aggregate(self, aggregate_id, name, availability_zone=None):
"""Update a aggregate."""
@@ -57,13 +57,13 @@
body = json.loads(body)
self.validate_response(schema.update_aggregate, resp, body)
- return resp, body['aggregate']
+ return service_client.ResponseBody(resp, body['aggregate'])
def delete_aggregate(self, aggregate_id):
"""Deletes the given aggregate."""
resp, body = self.delete("os-aggregates/%s" % str(aggregate_id))
self.validate_response(v2_schema.delete_aggregate, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def is_resource_deleted(self, id):
try:
@@ -87,7 +87,7 @@
post_body)
body = json.loads(body)
self.validate_response(schema.aggregate_add_remove_host, resp, body)
- return resp, body['aggregate']
+ return service_client.ResponseBody(resp, body['aggregate'])
def remove_host(self, aggregate_id, host):
"""Removes a host from the given aggregate."""
@@ -99,7 +99,7 @@
post_body)
body = json.loads(body)
self.validate_response(schema.aggregate_add_remove_host, resp, body)
- return resp, body['aggregate']
+ return service_client.ResponseBody(resp, body['aggregate'])
def set_metadata(self, aggregate_id, meta):
"""Replaces the aggregate's existing metadata with new metadata."""
@@ -111,4 +111,4 @@
post_body)
body = json.loads(body)
self.validate_response(schema.aggregate_set_metadata, resp, body)
- return resp, body['aggregate']
+ return service_client.ResponseBody(resp, body['aggregate'])
diff --git a/tempest/services/compute/json/availability_zone_client.py b/tempest/services/compute/json/availability_zone_client.py
index b8bda68..e37c9d9 100644
--- a/tempest/services/compute/json/availability_zone_client.py
+++ b/tempest/services/compute/json/availability_zone_client.py
@@ -16,10 +16,10 @@
import json
from tempest.api_schema.response.compute.v2 import availability_zone as schema
-from tempest.services.compute.json import base
+from tempest.common import service_client
-class AvailabilityZoneClientJSON(base.ComputeClient):
+class AvailabilityZoneClientJSON(service_client.ServiceClient):
def get_availability_zone_list(self):
resp, body = self.get('os-availability-zone')
diff --git a/tempest/services/compute/json/base.py b/tempest/services/compute/json/base.py
deleted file mode 100644
index b712452..0000000
--- a/tempest/services/compute/json/base.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright 2014 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.
-
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
-
-
-class ComputeClient(rest_client.RestClient):
- """
- Base compute client class
- """
-
- def __init__(self, auth_provider,
- build_interval=None, build_timeout=None):
- if build_interval is None:
- build_interval = CONF.compute.build_interval
- if build_timeout is None:
- build_timeout = CONF.compute.build_timeout
-
- super(ComputeClient, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_type
- self.build_interval = build_interval
- self.build_timeout = build_timeout
diff --git a/tempest/services/compute/json/certificates_client.py b/tempest/services/compute/json/certificates_client.py
index 123f0b9..b705c37 100644
--- a/tempest/services/compute/json/certificates_client.py
+++ b/tempest/services/compute/json/certificates_client.py
@@ -17,10 +17,10 @@
from tempest.api_schema.response.compute import certificates as schema
from tempest.api_schema.response.compute.v2 import certificates as v2schema
-from tempest.services.compute.json import base
+from tempest.common import service_client
-class CertificatesClientJSON(base.ComputeClient):
+class CertificatesClientJSON(service_client.ServiceClient):
def get_certificate(self, id):
url = "os-certificates/%s" % (id)
diff --git a/tempest/services/compute/json/extensions_client.py b/tempest/services/compute/json/extensions_client.py
index 69ad7c0..d3148b4 100644
--- a/tempest/services/compute/json/extensions_client.py
+++ b/tempest/services/compute/json/extensions_client.py
@@ -16,10 +16,10 @@
import json
from tempest.api_schema.response.compute.v2 import extensions as schema
-from tempest.services.compute.json import base
+from tempest.common import service_client
-class ExtensionsClientJSON(base.ComputeClient):
+class ExtensionsClientJSON(service_client.ServiceClient):
def list_extensions(self):
url = 'extensions'
diff --git a/tempest/services/compute/json/fixed_ips_client.py b/tempest/services/compute/json/fixed_ips_client.py
index 8fd24b6..5797c16 100644
--- a/tempest/services/compute/json/fixed_ips_client.py
+++ b/tempest/services/compute/json/fixed_ips_client.py
@@ -16,10 +16,10 @@
import json
from tempest.api_schema.response.compute.v2 import fixed_ips as schema
-from tempest.services.compute.json import base
+from tempest.common import service_client
-class FixedIPsClientJSON(base.ComputeClient):
+class FixedIPsClientJSON(service_client.ServiceClient):
def get_fixed_ip_details(self, fixed_ip):
url = "os-fixed-ips/%s" % (fixed_ip)
diff --git a/tempest/services/compute/json/flavors_client.py b/tempest/services/compute/json/flavors_client.py
index 6276d3c..b42ea40 100644
--- a/tempest/services/compute/json/flavors_client.py
+++ b/tempest/services/compute/json/flavors_client.py
@@ -21,10 +21,10 @@
from tempest.api_schema.response.compute import flavors_extra_specs \
as schema_extra_specs
from tempest.api_schema.response.compute.v2 import flavors as v2schema
-from tempest.services.compute.json import base
+from tempest.common import service_client
-class FlavorsClientJSON(base.ComputeClient):
+class FlavorsClientJSON(service_client.ServiceClient):
def list_flavors(self, params=None):
url = 'flavors'
diff --git a/tempest/services/compute/json/floating_ips_client.py b/tempest/services/compute/json/floating_ips_client.py
index 788b4d2..9c586e3 100644
--- a/tempest/services/compute/json/floating_ips_client.py
+++ b/tempest/services/compute/json/floating_ips_client.py
@@ -17,11 +17,11 @@
import urllib
from tempest.api_schema.response.compute.v2 import floating_ips as schema
+from tempest.common import service_client
from tempest import exceptions
-from tempest.services.compute.json import base
-class FloatingIPsClientJSON(base.ComputeClient):
+class FloatingIPsClientJSON(service_client.ServiceClient):
def list_floating_ips(self, params=None):
"""Returns a list of all floating IPs filtered by any parameters."""
diff --git a/tempest/services/compute/json/hosts_client.py b/tempest/services/compute/json/hosts_client.py
index 5d306f9..b06378b 100644
--- a/tempest/services/compute/json/hosts_client.py
+++ b/tempest/services/compute/json/hosts_client.py
@@ -17,10 +17,10 @@
from tempest.api_schema.response.compute import hosts as schema
from tempest.api_schema.response.compute.v2 import hosts as v2_schema
-from tempest.services.compute.json import base
+from tempest.common import service_client
-class HostsClientJSON(base.ComputeClient):
+class HostsClientJSON(service_client.ServiceClient):
def list_hosts(self, params=None):
"""Lists all hosts."""
@@ -32,7 +32,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_hosts, resp, body)
- return resp, body['hosts']
+ return service_client.ResponseBodyList(resp, body['hosts'])
def show_host_detail(self, hostname):
"""Show detail information for the host."""
@@ -40,7 +40,7 @@
resp, body = self.get("os-hosts/%s" % str(hostname))
body = json.loads(body)
self.validate_response(schema.show_host_detail, resp, body)
- return resp, body['host']
+ return service_client.ResponseBodyList(resp, body['host'])
def update_host(self, hostname, **kwargs):
"""Update a host."""
@@ -55,7 +55,7 @@
resp, body = self.put("os-hosts/%s" % str(hostname), request_body)
body = json.loads(body)
self.validate_response(v2_schema.update_host, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def startup_host(self, hostname):
"""Startup a host."""
@@ -63,7 +63,7 @@
resp, body = self.get("os-hosts/%s/startup" % str(hostname))
body = json.loads(body)
self.validate_response(v2_schema.startup_host, resp, body)
- return resp, body['host']
+ return service_client.ResponseBody(resp, body['host'])
def shutdown_host(self, hostname):
"""Shutdown a host."""
@@ -71,7 +71,7 @@
resp, body = self.get("os-hosts/%s/shutdown" % str(hostname))
body = json.loads(body)
self.validate_response(v2_schema.shutdown_host, resp, body)
- return resp, body['host']
+ return service_client.ResponseBody(resp, body['host'])
def reboot_host(self, hostname):
"""reboot a host."""
@@ -79,4 +79,4 @@
resp, body = self.get("os-hosts/%s/reboot" % str(hostname))
body = json.loads(body)
self.validate_response(v2_schema.reboot_host, resp, body)
- return resp, body['host']
+ return service_client.ResponseBody(resp, body['host'])
diff --git a/tempest/services/compute/json/hypervisor_client.py b/tempest/services/compute/json/hypervisor_client.py
index 52b50c8..380b5ce 100644
--- a/tempest/services/compute/json/hypervisor_client.py
+++ b/tempest/services/compute/json/hypervisor_client.py
@@ -17,10 +17,10 @@
from tempest.api_schema.response.compute import hypervisors as common_schema
from tempest.api_schema.response.compute.v2 import hypervisors as v2schema
-from tempest.services.compute.json import base
+from tempest.common import service_client
-class HypervisorClientJSON(base.ComputeClient):
+class HypervisorClientJSON(service_client.ServiceClient):
def get_hypervisor_list(self):
"""List hypervisors information."""
@@ -28,7 +28,7 @@
body = json.loads(body)
self.validate_response(common_schema.common_hypervisors_detail,
resp, body)
- return resp, body['hypervisors']
+ return service_client.ResponseBodyList(resp, body['hypervisors'])
def get_hypervisor_list_details(self):
"""Show detailed hypervisors information."""
@@ -36,7 +36,7 @@
body = json.loads(body)
self.validate_response(common_schema.common_list_hypervisors_detail,
resp, body)
- return resp, body['hypervisors']
+ return service_client.ResponseBodyList(resp, body['hypervisors'])
def get_hypervisor_show_details(self, hyper_id):
"""Display the details of the specified hypervisor."""
@@ -44,28 +44,28 @@
body = json.loads(body)
self.validate_response(common_schema.common_show_hypervisor,
resp, body)
- return resp, body['hypervisor']
+ return service_client.ResponseBody(resp, body['hypervisor'])
def get_hypervisor_servers(self, hyper_name):
"""List instances belonging to the specified hypervisor."""
resp, body = self.get('os-hypervisors/%s/servers' % hyper_name)
body = json.loads(body)
self.validate_response(v2schema.hypervisors_servers, resp, body)
- return resp, body['hypervisors']
+ return service_client.ResponseBodyList(resp, body['hypervisors'])
def get_hypervisor_stats(self):
"""Get hypervisor statistics over all compute nodes."""
resp, body = self.get('os-hypervisors/statistics')
body = json.loads(body)
self.validate_response(common_schema.hypervisor_statistics, resp, body)
- return resp, body['hypervisor_statistics']
+ return service_client.ResponseBody(resp, body['hypervisor_statistics'])
def get_hypervisor_uptime(self, hyper_id):
"""Display the uptime of the specified hypervisor."""
resp, body = self.get('os-hypervisors/%s/uptime' % hyper_id)
body = json.loads(body)
self.validate_response(common_schema.hypervisor_uptime, resp, body)
- return resp, body['hypervisor']
+ return service_client.ResponseBody(resp, body['hypervisor'])
def search_hypervisor(self, hyper_name):
"""Search specified hypervisor."""
@@ -73,4 +73,4 @@
body = json.loads(body)
self.validate_response(common_schema.common_hypervisors_detail,
resp, body)
- return resp, body['hypervisors']
+ return service_client.ResponseBodyList(resp, body['hypervisors'])
diff --git a/tempest/services/compute/json/images_client.py b/tempest/services/compute/json/images_client.py
index a4cfe57..a5755da 100644
--- a/tempest/services/compute/json/images_client.py
+++ b/tempest/services/compute/json/images_client.py
@@ -17,12 +17,12 @@
import urllib
from tempest.api_schema.response.compute.v2 import images as schema
+from tempest.common import service_client
from tempest.common import waiters
from tempest import exceptions
-from tempest.services.compute.json import base
-class ImagesClientJSON(base.ComputeClient):
+class ImagesClientJSON(service_client.ServiceClient):
def create_image(self, server_id, name, meta=None):
"""Creates an image of the original server."""
@@ -40,7 +40,7 @@
resp, body = self.post('servers/%s/action' % str(server_id),
post_body)
self.validate_response(schema.create_image, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def list_images(self, params=None):
"""Returns a list of all images filtered by any parameters."""
@@ -51,7 +51,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_images, resp, body)
- return resp, body['images']
+ return service_client.ResponseBodyList(resp, body['images'])
def list_images_with_detail(self, params=None):
"""Returns a detailed list of images filtered by any parameters."""
@@ -62,7 +62,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_images_details, resp, body)
- return resp, body['images']
+ return service_client.ResponseBodyList(resp, body['images'])
def get_image(self, image_id):
"""Returns the details of a single image."""
@@ -70,13 +70,13 @@
self.expected_success(200, resp.status)
body = json.loads(body)
self.validate_response(schema.get_image, resp, body)
- return resp, body['image']
+ return service_client.ResponseBody(resp, body['image'])
def delete_image(self, image_id):
"""Deletes the provided image."""
resp, body = self.delete("images/%s" % str(image_id))
self.validate_response(schema.delete, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def wait_for_image_status(self, image_id, status):
"""Waits for an image to reach a given status."""
@@ -87,7 +87,7 @@
resp, body = self.get("images/%s/metadata" % str(image_id))
body = json.loads(body)
self.validate_response(schema.image_metadata, resp, body)
- return resp, body['metadata']
+ return service_client.ResponseBody(resp, body['metadata'])
def set_image_metadata(self, image_id, meta):
"""Sets the metadata for an image."""
@@ -95,7 +95,7 @@
resp, body = self.put('images/%s/metadata' % str(image_id), post_body)
body = json.loads(body)
self.validate_response(schema.image_metadata, resp, body)
- return resp, body['metadata']
+ return service_client.ResponseBody(resp, body['metadata'])
def update_image_metadata(self, image_id, meta):
"""Updates the metadata for an image."""
@@ -103,14 +103,14 @@
resp, body = self.post('images/%s/metadata' % str(image_id), post_body)
body = json.loads(body)
self.validate_response(schema.image_metadata, resp, body)
- return resp, body['metadata']
+ return service_client.ResponseBody(resp, body['metadata'])
def get_image_metadata_item(self, image_id, key):
"""Returns the value for a specific image metadata key."""
resp, body = self.get("images/%s/metadata/%s" % (str(image_id), key))
body = json.loads(body)
self.validate_response(schema.image_meta_item, resp, body)
- return resp, body['meta']
+ return service_client.ResponseBody(resp, body['meta'])
def set_image_metadata_item(self, image_id, key, meta):
"""Sets the value for a specific image metadata key."""
@@ -119,14 +119,14 @@
post_body)
body = json.loads(body)
self.validate_response(schema.image_meta_item, resp, body)
- return resp, body['meta']
+ return service_client.ResponseBody(resp, body['meta'])
def delete_image_metadata_item(self, image_id, key):
"""Deletes a single image metadata key/value pair."""
resp, body = self.delete("images/%s/metadata/%s" %
(str(image_id), key))
self.validate_response(schema.delete, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def is_resource_deleted(self, id):
try:
diff --git a/tempest/services/compute/json/instance_usage_audit_log_client.py b/tempest/services/compute/json/instance_usage_audit_log_client.py
index f79c3de..80d7334 100644
--- a/tempest/services/compute/json/instance_usage_audit_log_client.py
+++ b/tempest/services/compute/json/instance_usage_audit_log_client.py
@@ -17,10 +17,10 @@
from tempest.api_schema.response.compute.v2 import instance_usage_audit_logs \
as schema
-from tempest.services.compute.json import base
+from tempest.common import service_client
-class InstanceUsagesAuditLogClientJSON(base.ComputeClient):
+class InstanceUsagesAuditLogClientJSON(service_client.ServiceClient):
def list_instance_usage_audit_logs(self):
url = 'os-instance_usage_audit_log'
diff --git a/tempest/services/compute/json/interfaces_client.py b/tempest/services/compute/json/interfaces_client.py
index f1e2660..595b23c 100644
--- a/tempest/services/compute/json/interfaces_client.py
+++ b/tempest/services/compute/json/interfaces_client.py
@@ -19,11 +19,11 @@
from tempest.api_schema.response.compute import interfaces as common_schema
from tempest.api_schema.response.compute import servers as servers_schema
from tempest.api_schema.response.compute.v2 import interfaces as schema
+from tempest.common import service_client
from tempest import exceptions
-from tempest.services.compute.json import base
-class InterfacesClientJSON(base.ComputeClient):
+class InterfacesClientJSON(service_client.ServiceClient):
def list_interfaces(self, server):
resp, body = self.get('servers/%s/os-interface' % server)
diff --git a/tempest/services/compute/json/keypairs_client.py b/tempest/services/compute/json/keypairs_client.py
index c4406f5..69dd9ae 100644
--- a/tempest/services/compute/json/keypairs_client.py
+++ b/tempest/services/compute/json/keypairs_client.py
@@ -17,10 +17,10 @@
from tempest.api_schema.response.compute import keypairs as common_schema
from tempest.api_schema.response.compute.v2 import keypairs as schema
-from tempest.services.compute.json import base
+from tempest.common import service_client
-class KeyPairsClientJSON(base.ComputeClient):
+class KeyPairsClientJSON(service_client.ServiceClient):
def list_keypairs(self):
resp, body = self.get("os-keypairs")
diff --git a/tempest/services/compute/json/limits_client.py b/tempest/services/compute/json/limits_client.py
index 66a0649..3a725ae 100644
--- a/tempest/services/compute/json/limits_client.py
+++ b/tempest/services/compute/json/limits_client.py
@@ -16,10 +16,10 @@
import json
from tempest.api_schema.response.compute.v2 import limits as schema
-from tempest.services.compute.json import base
+from tempest.common import service_client
-class LimitsClientJSON(base.ComputeClient):
+class LimitsClientJSON(service_client.ServiceClient):
def get_absolute_limits(self):
resp, body = self.get("limits")
diff --git a/tempest/services/compute/json/migrations_client.py b/tempest/services/compute/json/migrations_client.py
index de183f1..b41abc8 100644
--- a/tempest/services/compute/json/migrations_client.py
+++ b/tempest/services/compute/json/migrations_client.py
@@ -16,10 +16,10 @@
import urllib
from tempest.api_schema.response.compute import migrations as schema
-from tempest.services.compute.json import base
+from tempest.common import service_client
-class MigrationsClientJSON(base.ComputeClient):
+class MigrationsClientJSON(service_client.ServiceClient):
def list_migrations(self, params=None):
"""Lists all migrations."""
diff --git a/tempest/services/compute/json/networks_client.py b/tempest/services/compute/json/networks_client.py
index 5a2744d..361258a 100644
--- a/tempest/services/compute/json/networks_client.py
+++ b/tempest/services/compute/json/networks_client.py
@@ -15,10 +15,10 @@
import json
-from tempest.services.compute.json import base
+from tempest.common import service_client
-class NetworksClientJSON(base.ComputeClient):
+class NetworksClientJSON(service_client.ServiceClient):
def list_networks(self):
resp, body = self.get("os-networks")
diff --git a/tempest/services/compute/json/quotas_client.py b/tempest/services/compute/json/quotas_client.py
index 0fee57a..f9f02a5 100644
--- a/tempest/services/compute/json/quotas_client.py
+++ b/tempest/services/compute/json/quotas_client.py
@@ -18,10 +18,10 @@
from tempest.api_schema.response.compute.v2\
import quota_classes as classes_schema
from tempest.api_schema.response.compute.v2 import quotas as schema
-from tempest.services.compute.json import base
+from tempest.common import service_client
-class QuotasClientJSON(base.ComputeClient):
+class QuotasClientJSON(service_client.ServiceClient):
def get_quota_set(self, tenant_id, user_id=None):
"""List the quota set for a tenant."""
@@ -115,7 +115,7 @@
return resp, body
-class QuotaClassesClientJSON(base.ComputeClient):
+class QuotaClassesClientJSON(service_client.ServiceClient):
def get_quota_class_set(self, quota_class_id):
"""List the quota class set for a quota class."""
diff --git a/tempest/services/compute/json/security_group_default_rules_client.py b/tempest/services/compute/json/security_group_default_rules_client.py
index efaf329..5d0c16f 100644
--- a/tempest/services/compute/json/security_group_default_rules_client.py
+++ b/tempest/services/compute/json/security_group_default_rules_client.py
@@ -17,10 +17,10 @@
from tempest.api_schema.response.compute.v2 import \
security_group_default_rule as schema
-from tempest.services.compute.json import base
+from tempest.common import service_client
-class SecurityGroupDefaultRulesClientJSON(base.ComputeClient):
+class SecurityGroupDefaultRulesClientJSON(service_client.ServiceClient):
def create_security_default_group_rule(self, ip_protocol, from_port,
to_port, **kwargs):
diff --git a/tempest/services/compute/json/security_groups_client.py b/tempest/services/compute/json/security_groups_client.py
index a301a0f..1ac52af 100644
--- a/tempest/services/compute/json/security_groups_client.py
+++ b/tempest/services/compute/json/security_groups_client.py
@@ -17,11 +17,11 @@
import urllib
from tempest.api_schema.response.compute.v2 import security_groups as schema
+from tempest.common import service_client
from tempest import exceptions
-from tempest.services.compute.json import base
-class SecurityGroupsClientJSON(base.ComputeClient):
+class SecurityGroupsClientJSON(service_client.ServiceClient):
def list_security_groups(self, params=None):
"""List all security groups for a user."""
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index 400f9a7..cbe1ca8 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -20,15 +20,15 @@
from tempest.api_schema.response.compute import servers as common_schema
from tempest.api_schema.response.compute.v2 import servers as schema
+from tempest.common import service_client
from tempest.common import waiters
from tempest import config
from tempest import exceptions
-from tempest.services.compute.json import base
CONF = config.CONF
-class ServersClientJSON(base.ComputeClient):
+class ServersClientJSON(service_client.ServiceClient):
def create_server(self, name, image_ref, flavor_ref, **kwargs):
"""
diff --git a/tempest/services/compute/json/services_client.py b/tempest/services/compute/json/services_client.py
index 8d73c37..fc2274d 100644
--- a/tempest/services/compute/json/services_client.py
+++ b/tempest/services/compute/json/services_client.py
@@ -18,10 +18,10 @@
import urllib
from tempest.api_schema.response.compute import services as schema
-from tempest.services.compute.json import base
+from tempest.common import service_client
-class ServicesClientJSON(base.ComputeClient):
+class ServicesClientJSON(service_client.ServiceClient):
def list_services(self, params=None):
url = 'os-services'
@@ -31,7 +31,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_services, resp, body)
- return resp, body['services']
+ return service_client.ResponseBodyList(resp, body['services'])
def enable_service(self, host_name, binary):
"""
@@ -43,7 +43,7 @@
resp, body = self.put('os-services/enable', post_body)
body = json.loads(body)
self.validate_response(schema.enable_service, resp, body)
- return resp, body['service']
+ return service_client.ResponseBody(resp, body['service'])
def disable_service(self, host_name, binary):
"""
@@ -54,4 +54,4 @@
post_body = json.dumps({'binary': binary, 'host': host_name})
resp, body = self.put('os-services/disable', post_body)
body = json.loads(body)
- return resp, body['service']
+ return service_client.ResponseBody(resp, body['service'])
diff --git a/tempest/services/compute/json/tenant_usages_client.py b/tempest/services/compute/json/tenant_usages_client.py
index eac23bb..5dc1d5d 100644
--- a/tempest/services/compute/json/tenant_usages_client.py
+++ b/tempest/services/compute/json/tenant_usages_client.py
@@ -17,10 +17,10 @@
import urllib
from tempest.api_schema.response.compute.v2 import tenant_usages as schema
-from tempest.services.compute.json import base
+from tempest.common import service_client
-class TenantUsagesClientJSON(base.ComputeClient):
+class TenantUsagesClientJSON(service_client.ServiceClient):
def list_tenant_usages(self, params=None):
url = 'os-simple-tenant-usage'
diff --git a/tempest/services/compute/json/volumes_extensions_client.py b/tempest/services/compute/json/volumes_extensions_client.py
index 69b9bea..61d0b23 100644
--- a/tempest/services/compute/json/volumes_extensions_client.py
+++ b/tempest/services/compute/json/volumes_extensions_client.py
@@ -18,20 +18,11 @@
import urllib
from tempest.api_schema.response.compute.v2 import volumes as schema
-from tempest import config
+from tempest.common import service_client
from tempest import exceptions
-from tempest.services.compute.json import base
-
-CONF = config.CONF
-class VolumesExtensionsClientJSON(base.ComputeClient):
-
- def __init__(self, auth_provider):
- super(VolumesExtensionsClientJSON, self).__init__(
- auth_provider,
- build_interval=CONF.volume.build_interval,
- build_timeout=CONF.volume.build_timeout)
+class VolumesExtensionsClientJSON(service_client.ServiceClient):
def list_volumes(self, params=None):
"""List all the volumes created."""
diff --git a/tempest/services/data_processing/v1_1/client.py b/tempest/services/data_processing/v1_1/client.py
index 7acbae7..55b6be6 100644
--- a/tempest/services/data_processing/v1_1/client.py
+++ b/tempest/services/data_processing/v1_1/client.py
@@ -14,16 +14,20 @@
import json
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest import config
CONF = config.CONF
-class DataProcessingClient(rest_client.RestClient):
+class DataProcessingClient(service_client.ServiceClient):
+
def __init__(self, auth_provider):
- super(DataProcessingClient, self).__init__(auth_provider)
- self.service = CONF.data_processing.catalog_type
+ super(DataProcessingClient, self).__init__(
+ auth_provider,
+ CONF.data_processing.catalog_type,
+ CONF.identity.region,
+ endpoint_type=CONF.data_processing.endpoint_type)
def _request_and_check_resp(self, request_func, uri, resp_status):
"""Make a request using specified request_func and check response
diff --git a/tempest/services/database/json/flavors_client.py b/tempest/services/database/json/flavors_client.py
index f276a45..dfb2eb3 100644
--- a/tempest/services/database/json/flavors_client.py
+++ b/tempest/services/database/json/flavors_client.py
@@ -15,17 +15,10 @@
import urllib
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.common import service_client
-class DatabaseFlavorsClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(DatabaseFlavorsClientJSON, self).__init__(auth_provider)
- self.service = CONF.database.catalog_type
+class DatabaseFlavorsClientJSON(service_client.ServiceClient):
def list_db_flavors(self, params=None):
url = 'flavors'
diff --git a/tempest/services/database/json/versions_client.py b/tempest/services/database/json/versions_client.py
index 81c0e6c..c3388bb 100644
--- a/tempest/services/database/json/versions_client.py
+++ b/tempest/services/database/json/versions_client.py
@@ -15,18 +15,25 @@
import urllib
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.common import service_client
-class DatabaseVersionsClientJSON(rest_client.RestClient):
+class DatabaseVersionsClientJSON(service_client.ServiceClient):
- def __init__(self, auth_provider):
- super(DatabaseVersionsClientJSON, self).__init__(auth_provider)
+ def __init__(self, auth_provider, service, region,
+ endpoint_type=None, build_interval=None, build_timeout=None,
+ disable_ssl_certificate_validation=None, ca_certs=None,
+ trace_requests=None):
+ dscv = disable_ssl_certificate_validation
+ super(DatabaseVersionsClientJSON, self).__init__(
+ auth_provider, service, region,
+ endpoint_type=endpoint_type,
+ build_interval=build_interval,
+ build_timeout=build_timeout,
+ disable_ssl_certificate_validation=dscv,
+ ca_certs=ca_certs,
+ trace_requests=trace_requests)
self.skip_path()
- self.service = CONF.database.catalog_type
def list_db_versions(self, params=None):
"""List all versions."""
diff --git a/tempest/services/identity/json/identity_client.py b/tempest/services/identity/json/identity_client.py
index 281464c..a6c5049 100644
--- a/tempest/services/identity/json/identity_client.py
+++ b/tempest/services/identity/json/identity_client.py
@@ -12,19 +12,21 @@
import json
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest import config
from tempest import exceptions
CONF = config.CONF
-class IdentityClientJSON(rest_client.RestClient):
+class IdentityClientJSON(service_client.ServiceClient):
def __init__(self, auth_provider):
- super(IdentityClientJSON, self).__init__(auth_provider)
- self.service = CONF.identity.catalog_type
- self.endpoint_url = 'adminURL'
+ super(IdentityClientJSON, self).__init__(
+ auth_provider,
+ CONF.identity.catalog_type,
+ CONF.identity.region,
+ endpoint_type='adminURL')
def has_admin_extensions(self):
"""
@@ -49,14 +51,14 @@
post_body = json.dumps({'role': post_body})
resp, body = self.post('OS-KSADM/roles', post_body)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def get_role(self, role_id):
"""Get a role by its id."""
resp, body = self.get('OS-KSADM/roles/%s' % role_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['role']
+ return service_client.ResponseBody(resp, body['role'])
def create_tenant(self, name, **kwargs):
"""
@@ -73,7 +75,7 @@
post_body = json.dumps({'tenant': post_body})
resp, body = self.post('tenants', post_body)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def delete_role(self, role_id):
"""Delete a role."""
@@ -86,49 +88,49 @@
url = '/tenants/%s/users/%s/roles' % (tenant_id, user_id)
resp, body = self.get(url)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBodyList(resp, self._parse_resp(body))
def assign_user_role(self, tenant_id, user_id, role_id):
"""Add roles to a user on a tenant."""
resp, body = self.put('/tenants/%s/users/%s/roles/OS-KSADM/%s' %
(tenant_id, user_id, role_id), "")
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def remove_user_role(self, tenant_id, user_id, role_id):
"""Removes a role assignment for a user on a tenant."""
resp, body = self.delete('/tenants/%s/users/%s/roles/OS-KSADM/%s' %
(tenant_id, user_id, role_id))
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def delete_tenant(self, tenant_id):
"""Delete a tenant."""
resp, body = self.delete('tenants/%s' % str(tenant_id))
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def get_tenant(self, tenant_id):
"""Get tenant details."""
resp, body = self.get('tenants/%s' % str(tenant_id))
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def list_roles(self):
"""Returns roles."""
resp, body = self.get('OS-KSADM/roles')
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBodyList(resp, self._parse_resp(body))
def list_tenants(self):
"""Returns tenants."""
resp, body = self.get('tenants')
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['tenants']
+ return service_client.ResponseBodyList(resp, body['tenants'])
def get_tenant_by_name(self, tenant_name):
- _, tenants = self.list_tenants()
+ tenants = self.list_tenants()
for tenant in tenants:
if tenant['name'] == tenant_name:
return tenant
@@ -136,7 +138,7 @@
def update_tenant(self, tenant_id, **kwargs):
"""Updates a tenant."""
- _, body = self.get_tenant(tenant_id)
+ body = self.get_tenant(tenant_id)
name = kwargs.get('name', body['name'])
desc = kwargs.get('description', body['description'])
en = kwargs.get('enabled', body['enabled'])
@@ -149,7 +151,7 @@
post_body = json.dumps({'tenant': post_body})
resp, body = self.post('tenants/%s' % tenant_id, post_body)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def create_user(self, name, password, tenant_id, email, **kwargs):
"""Create a user."""
@@ -165,32 +167,32 @@
post_body = json.dumps({'user': post_body})
resp, body = self.post('users', post_body)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def update_user(self, user_id, **kwargs):
"""Updates a user."""
put_body = json.dumps({'user': kwargs})
resp, body = self.put('users/%s' % user_id, put_body)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def get_user(self, user_id):
"""GET a user."""
resp, body = self.get("users/%s" % user_id)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def delete_user(self, user_id):
"""Delete a user."""
resp, body = self.delete("users/%s" % user_id)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def get_users(self):
"""Get the list of users."""
resp, body = self.get("users")
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBodyList(resp, self._parse_resp(body))
def enable_disable_user(self, user_id, enabled):
"""Enables or disables a user."""
@@ -200,28 +202,28 @@
put_body = json.dumps({'user': put_body})
resp, body = self.put('users/%s/enabled' % user_id, put_body)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def get_token(self, token_id):
"""Get token details."""
resp, body = self.get("tokens/%s" % token_id)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def delete_token(self, token_id):
"""Delete a token."""
resp, body = self.delete("tokens/%s" % token_id)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def list_users_for_tenant(self, tenant_id):
"""List users for a Tenant."""
resp, body = self.get('/tenants/%s/users' % tenant_id)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBodyList(resp, self._parse_resp(body))
def get_user_by_username(self, tenant_id, username):
- _, users = self.list_users_for_tenant(tenant_id)
+ users = self.list_users_for_tenant(tenant_id)
for user in users:
if user['name'] == username:
return user
@@ -237,27 +239,27 @@
post_body = json.dumps({'OS-KSADM:service': post_body})
resp, body = self.post('/OS-KSADM/services', post_body)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def get_service(self, service_id):
"""Get Service."""
url = '/OS-KSADM/services/%s' % service_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def list_services(self):
"""List Service - Returns Services."""
resp, body = self.get('/OS-KSADM/services')
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBodyList(resp, self._parse_resp(body))
def delete_service(self, service_id):
"""Delete Service."""
url = '/OS-KSADM/services/%s' % service_id
resp, body = self.delete(url)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def update_user_password(self, user_id, new_pass):
"""Update User Password."""
@@ -268,14 +270,15 @@
put_body = json.dumps({'user': put_body})
resp, body = self.put('users/%s/OS-KSADM/password' % user_id, put_body)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def list_extensions(self):
"""List all the extensions."""
resp, body = self.get('/extensions')
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['extensions']['values']
+ return service_client.ResponseBodyList(resp,
+ body['extensions']['values'])
class TokenClientJSON(IdentityClientJSON):
@@ -307,7 +310,7 @@
resp, body = self.post(self.auth_url, body=body)
self.expected_success(200, resp.status)
- return resp, body['access']
+ return service_client.ResponseBody(resp, body['access'])
def auth_token(self, token_id, tenant=None):
creds = {
@@ -325,7 +328,7 @@
resp, body = self.post(self.auth_url, body=body)
self.expected_success(200, resp.status)
- return resp, body['access']
+ return service_client.ResponseBody(resp, body['access'])
def request(self, method, url, extra_headers=False, headers=None,
body=None):
@@ -338,8 +341,8 @@
except (ValueError, TypeError):
headers = self.get_headers(accept_type="json")
- resp, resp_body = self.http_obj.request(url, method,
- headers=headers, body=body)
+ resp, resp_body = self.raw_request(url, method,
+ headers=headers, body=body)
self._log_request(method, url, resp)
if resp.status in [401, 403]:
@@ -357,7 +360,7 @@
"""
Returns (token id, token data) for supplied credentials
"""
- resp, body = self.auth(user, password, tenant)
+ body = self.auth(user, password, tenant)
if auth_data:
return body['token']['id'], body
diff --git a/tempest/services/identity/v3/json/base.py b/tempest/services/identity/v3/json/base.py
index 3df0dab..cba480a 100644
--- a/tempest/services/identity/v3/json/base.py
+++ b/tempest/services/identity/v3/json/base.py
@@ -12,19 +12,21 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest import config
CONF = config.CONF
-class IdentityV3Client(rest_client.RestClient):
+class IdentityV3Client(service_client.ServiceClient):
"""
Base identity v3 client class
"""
def __init__(self, auth_provider):
- super(IdentityV3Client, self).__init__(auth_provider)
- self.service = CONF.identity.catalog_type
- self.endpoint_url = 'adminURL'
+ super(IdentityV3Client, self).__init__(
+ auth_provider,
+ CONF.identity.catalog_type,
+ CONF.identity.region,
+ endpoint_type='adminURL')
self.api_version = "v3"
diff --git a/tempest/services/identity/v3/json/credentials_client.py b/tempest/services/identity/v3/json/credentials_client.py
index 42acd2a..1289e48 100644
--- a/tempest/services/identity/v3/json/credentials_client.py
+++ b/tempest/services/identity/v3/json/credentials_client.py
@@ -15,6 +15,7 @@
import json
+from tempest.common import service_client
from tempest.services.identity.v3.json import base
@@ -35,11 +36,11 @@
self.expected_success(201, resp.status)
body = json.loads(body)
body['credential']['blob'] = json.loads(body['credential']['blob'])
- return resp, body['credential']
+ return service_client.ResponseBody(resp, body['credential'])
def update_credential(self, credential_id, **kwargs):
"""Updates a credential."""
- _, body = self.get_credential(credential_id)
+ body = self.get_credential(credential_id)
cred_type = kwargs.get('type', body['type'])
access_key = kwargs.get('access_key', body['blob']['access'])
secret_key = kwargs.get('secret_key', body['blob']['secret'])
@@ -58,7 +59,7 @@
self.expected_success(200, resp.status)
body = json.loads(body)
body['credential']['blob'] = json.loads(body['credential']['blob'])
- return resp, body['credential']
+ return service_client.ResponseBody(resp, body['credential'])
def get_credential(self, credential_id):
"""To GET Details of a credential."""
@@ -66,17 +67,17 @@
self.expected_success(200, resp.status)
body = json.loads(body)
body['credential']['blob'] = json.loads(body['credential']['blob'])
- return resp, body['credential']
+ return service_client.ResponseBody(resp, body['credential'])
def list_credentials(self):
"""Lists out all the available credentials."""
resp, body = self.get('credentials')
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['credentials']
+ return service_client.ResponseBodyList(resp, body['credentials'])
def delete_credential(self, credential_id):
"""Deletes a credential."""
resp, body = self.delete('credentials/%s' % credential_id)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/identity/v3/json/endpoints_client.py b/tempest/services/identity/v3/json/endpoints_client.py
index 9316a4b..d71836e 100644
--- a/tempest/services/identity/v3/json/endpoints_client.py
+++ b/tempest/services/identity/v3/json/endpoints_client.py
@@ -15,6 +15,7 @@
import json
+from tempest.common import service_client
from tempest.services.identity.v3.json import base
@@ -25,7 +26,7 @@
resp, body = self.get('endpoints')
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['endpoints']
+ return service_client.ResponseBodyList(resp, body['endpoints'])
def create_endpoint(self, service_id, interface, url, **kwargs):
"""Create endpoint.
@@ -50,7 +51,7 @@
resp, body = self.post('endpoints', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return resp, body['endpoint']
+ return service_client.ResponseBody(resp, body['endpoint'])
def update_endpoint(self, endpoint_id, service_id=None, interface=None,
url=None, region=None, enabled=None, **kwargs):
@@ -77,10 +78,10 @@
resp, body = self.patch('endpoints/%s' % endpoint_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['endpoint']
+ return service_client.ResponseBody(resp, body['endpoint'])
def delete_endpoint(self, endpoint_id):
"""Delete endpoint."""
resp_header, resp_body = self.delete('endpoints/%s' % endpoint_id)
self.expected_success(204, resp_header.status)
- return resp_header, resp_body
+ return service_client.ResponseBody(resp_header, resp_body)
diff --git a/tempest/services/identity/v3/json/identity_client.py b/tempest/services/identity/v3/json/identity_client.py
index 4c8d8df..4d333c0 100644
--- a/tempest/services/identity/v3/json/identity_client.py
+++ b/tempest/services/identity/v3/json/identity_client.py
@@ -16,7 +16,7 @@
import json
import urllib
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest import config
from tempest import exceptions
from tempest.services.identity.v3.json import base
@@ -46,11 +46,11 @@
resp, body = self.post('users', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return resp, body['user']
+ return service_client.ResponseBody(resp, body['user'])
def update_user(self, user_id, name, **kwargs):
"""Updates a user."""
- _, body = self.get_user(user_id)
+ body = self.get_user(user_id)
email = kwargs.get('email', body['email'])
en = kwargs.get('enabled', body['enabled'])
project_id = kwargs.get('project_id', body['project_id'])
@@ -75,7 +75,7 @@
resp, body = self.patch('users/%s' % user_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['user']
+ return service_client.ResponseBody(resp, body['user'])
def update_user_password(self, user_id, password, original_password):
"""Updates a user password."""
@@ -86,14 +86,14 @@
update_user = json.dumps({'user': update_user})
resp, _ = self.post('users/%s/password' % user_id, update_user)
self.expected_success(204, resp.status)
- return resp
+ return service_client.ResponseBody(resp)
def list_user_projects(self, user_id):
"""Lists the projects on which a user has roles assigned."""
resp, body = self.get('users/%s/projects' % user_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['projects']
+ return service_client.ResponseBodyList(resp, body['projects'])
def get_users(self, params=None):
"""Get the list of users."""
@@ -103,20 +103,20 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['users']
+ return service_client.ResponseBodyList(resp, body['users'])
def get_user(self, user_id):
"""GET a user."""
resp, body = self.get("users/%s" % user_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['user']
+ return service_client.ResponseBody(resp, body['user'])
def delete_user(self, user_id):
"""Deletes a User."""
resp, body = self.delete("users/%s" % user_id)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def create_project(self, name, **kwargs):
"""Creates a project."""
@@ -133,7 +133,7 @@
resp, body = self.post('projects', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return resp, body['project']
+ return service_client.ResponseBody(resp, body['project'])
def list_projects(self, params=None):
url = "projects"
@@ -142,10 +142,10 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['projects']
+ return service_client.ResponseBodyList(resp, body['projects'])
def update_project(self, project_id, **kwargs):
- _, body = self.get_project(project_id)
+ body = self.get_project(project_id)
name = kwargs.get('name', body['name'])
desc = kwargs.get('description', body['description'])
en = kwargs.get('enabled', body['enabled'])
@@ -161,20 +161,20 @@
resp, body = self.patch('projects/%s' % project_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['project']
+ return service_client.ResponseBody(resp, body['project'])
def get_project(self, project_id):
"""GET a Project."""
resp, body = self.get("projects/%s" % project_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['project']
+ return service_client.ResponseBody(resp, body['project'])
def delete_project(self, project_id):
"""Delete a project."""
resp, body = self.delete('projects/%s' % str(project_id))
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def create_role(self, name):
"""Create a Role."""
@@ -185,21 +185,21 @@
resp, body = self.post('roles', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return resp, body['role']
+ return service_client.ResponseBody(resp, body['role'])
def get_role(self, role_id):
"""GET a Role."""
resp, body = self.get('roles/%s' % str(role_id))
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['role']
+ return service_client.ResponseBody(resp, body['role'])
def list_roles(self):
"""Get the list of Roles."""
resp, body = self.get("roles")
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['roles']
+ return service_client.ResponseBodyList(resp, body['roles'])
def update_role(self, name, role_id):
"""Create a Role."""
@@ -210,20 +210,20 @@
resp, body = self.patch('roles/%s' % str(role_id), post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['role']
+ return service_client.ResponseBody(resp, body['role'])
def delete_role(self, role_id):
"""Delete a role."""
resp, body = self.delete('roles/%s' % str(role_id))
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def assign_user_role(self, project_id, user_id, role_id):
"""Add roles to a user on a project."""
resp, body = self.put('projects/%s/users/%s/roles/%s' %
(project_id, user_id, role_id), None)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def create_domain(self, name, **kwargs):
"""Creates a domain."""
@@ -238,24 +238,24 @@
resp, body = self.post('domains', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return resp, body['domain']
+ return service_client.ResponseBody(resp, body['domain'])
def delete_domain(self, domain_id):
"""Delete a domain."""
resp, body = self.delete('domains/%s' % str(domain_id))
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def list_domains(self):
"""List Domains."""
resp, body = self.get('domains')
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['domains']
+ return service_client.ResponseBodyList(resp, body['domains'])
def update_domain(self, domain_id, **kwargs):
"""Updates a domain."""
- _, body = self.get_domain(domain_id)
+ body = self.get_domain(domain_id)
description = kwargs.get('description', body['description'])
en = kwargs.get('enabled', body['enabled'])
name = kwargs.get('name', body['name'])
@@ -268,14 +268,14 @@
resp, body = self.patch('domains/%s' % domain_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['domain']
+ return service_client.ResponseBody(resp, body['domain'])
def get_domain(self, domain_id):
"""Get Domain details."""
resp, body = self.get('domains/%s' % domain_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['domain']
+ return service_client.ResponseBody(resp, body['domain'])
def get_token(self, resp_token):
"""Get token details."""
@@ -283,14 +283,14 @@
resp, body = self.get("auth/tokens", headers=headers)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['token']
+ return service_client.ResponseBody(resp, body['token'])
def delete_token(self, resp_token):
"""Deletes token."""
headers = {'X-Subject-Token': resp_token}
resp, body = self.delete("auth/tokens", headers=headers)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def create_group(self, name, **kwargs):
"""Creates a group."""
@@ -307,18 +307,18 @@
resp, body = self.post('groups', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return resp, body['group']
+ return service_client.ResponseBody(resp, body['group'])
def get_group(self, group_id):
"""Get group details."""
resp, body = self.get('groups/%s' % group_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['group']
+ return service_client.ResponseBody(resp, body['group'])
def update_group(self, group_id, **kwargs):
"""Updates a group."""
- _, body = self.get_group(group_id)
+ body = self.get_group(group_id)
name = kwargs.get('name', body['name'])
description = kwargs.get('description', body['description'])
post_body = {
@@ -329,54 +329,54 @@
resp, body = self.patch('groups/%s' % group_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['group']
+ return service_client.ResponseBody(resp, body['group'])
def delete_group(self, group_id):
"""Delete a group."""
resp, body = self.delete('groups/%s' % str(group_id))
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def add_group_user(self, group_id, user_id):
"""Add user into group."""
resp, body = self.put('groups/%s/users/%s' % (group_id, user_id),
None)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def list_group_users(self, group_id):
"""List users in group."""
resp, body = self.get('groups/%s/users' % group_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['users']
+ return service_client.ResponseBodyList(resp, body['users'])
def list_user_groups(self, user_id):
"""Lists groups which a user belongs to."""
resp, body = self.get('users/%s/groups' % user_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['groups']
+ return service_client.ResponseBodyList(resp, body['groups'])
def delete_group_user(self, group_id, user_id):
"""Delete user in group."""
resp, body = self.delete('groups/%s/users/%s' % (group_id, user_id))
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def assign_user_role_on_project(self, project_id, user_id, role_id):
"""Add roles to a user on a project."""
resp, body = self.put('projects/%s/users/%s/roles/%s' %
(project_id, user_id, role_id), None)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def assign_user_role_on_domain(self, domain_id, user_id, role_id):
"""Add roles to a user on a domain."""
resp, body = self.put('domains/%s/users/%s/roles/%s' %
(domain_id, user_id, role_id), None)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def list_user_roles_on_project(self, project_id, user_id):
"""list roles of a user on a project."""
@@ -384,7 +384,7 @@
(project_id, user_id))
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['roles']
+ return service_client.ResponseBodyList(resp, body['roles'])
def list_user_roles_on_domain(self, domain_id, user_id):
"""list roles of a user on a domain."""
@@ -392,35 +392,35 @@
(domain_id, user_id))
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['roles']
+ return service_client.ResponseBodyList(resp, body['roles'])
def revoke_role_from_user_on_project(self, project_id, user_id, role_id):
"""Delete role of a user on a project."""
resp, body = self.delete('projects/%s/users/%s/roles/%s' %
(project_id, user_id, role_id))
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def revoke_role_from_user_on_domain(self, domain_id, user_id, role_id):
"""Delete role of a user on a domain."""
resp, body = self.delete('domains/%s/users/%s/roles/%s' %
(domain_id, user_id, role_id))
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def assign_group_role_on_project(self, project_id, group_id, role_id):
"""Add roles to a user on a project."""
resp, body = self.put('projects/%s/groups/%s/roles/%s' %
(project_id, group_id, role_id), None)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def assign_group_role_on_domain(self, domain_id, group_id, role_id):
"""Add roles to a user on a domain."""
resp, body = self.put('domains/%s/groups/%s/roles/%s' %
(domain_id, group_id, role_id), None)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def list_group_roles_on_project(self, project_id, group_id):
"""list roles of a user on a project."""
@@ -428,7 +428,7 @@
(project_id, group_id))
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['roles']
+ return service_client.ResponseBodyList(resp, body['roles'])
def list_group_roles_on_domain(self, domain_id, group_id):
"""list roles of a user on a domain."""
@@ -436,21 +436,21 @@
(domain_id, group_id))
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['roles']
+ return service_client.ResponseBodyList(resp, body['roles'])
def revoke_role_from_group_on_project(self, project_id, group_id, role_id):
"""Delete role of a user on a project."""
resp, body = self.delete('projects/%s/groups/%s/roles/%s' %
(project_id, group_id, role_id))
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def revoke_role_from_group_on_domain(self, domain_id, group_id, role_id):
"""Delete role of a user on a domain."""
resp, body = self.delete('domains/%s/groups/%s/roles/%s' %
(domain_id, group_id, role_id))
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def create_trust(self, trustor_user_id, trustee_user_id, project_id,
role_names, impersonation, expires_at):
@@ -468,13 +468,13 @@
resp, body = self.post('OS-TRUST/trusts', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return resp, body['trust']
+ return service_client.ResponseBody(resp, body['trust'])
def delete_trust(self, trust_id):
"""Deletes a trust."""
resp, body = self.delete("OS-TRUST/trusts/%s" % trust_id)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def get_trusts(self, trustor_user_id=None, trustee_user_id=None):
"""GET trusts."""
@@ -488,21 +488,21 @@
resp, body = self.get("OS-TRUST/trusts")
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['trusts']
+ return service_client.ResponseBodyList(resp, body['trusts'])
def get_trust(self, trust_id):
"""GET trust."""
resp, body = self.get("OS-TRUST/trusts/%s" % trust_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['trust']
+ return service_client.ResponseBody(resp, body['trust'])
def get_trust_roles(self, trust_id):
"""GET roles delegated by a trust."""
resp, body = self.get("OS-TRUST/trusts/%s/roles" % trust_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['roles']
+ return service_client.ResponseBodyList(resp, body['roles'])
def get_trust_role(self, trust_id, role_id):
"""GET role delegated by a trust."""
@@ -510,20 +510,20 @@
% (trust_id, role_id))
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['role']
+ return service_client.ResponseBody(resp, body['role'])
def check_trust_role(self, trust_id, role_id):
"""HEAD Check if role is delegated by a trust."""
resp, body = self.head("OS-TRUST/trusts/%s/roles/%s"
% (trust_id, role_id))
self.expected_success(200, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
-class V3TokenClientJSON(rest_client.RestClient):
+class V3TokenClientJSON(service_client.ServiceClient):
def __init__(self):
- super(V3TokenClientJSON, self).__init__(None)
+ super(V3TokenClientJSON, self).__init__(None, None, None)
auth_url = CONF.identity.uri_v3
if not auth_url:
raise exceptions.InvalidConfiguration('you must specify a v3 uri '
@@ -589,7 +589,7 @@
body = json.dumps(creds)
resp, body = self.post(self.auth_url, body=body)
self.expected_success(201, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def request(self, method, url, extra_headers=False, headers=None,
body=None):
@@ -605,8 +605,8 @@
except (ValueError, TypeError):
headers = self.get_headers(accept_type="json")
- resp, resp_body = self.http_obj.request(url, method,
- headers=headers, body=body)
+ resp, resp_body = self.raw_request(url, method,
+ headers=headers, body=body)
self._log_request(method, url, resp)
if resp.status in [401, 403]:
@@ -624,10 +624,10 @@
:param user: username
Returns (token id, token data) for supplied credentials
"""
- resp, body = self.auth(user, password, tenant, user_type='name',
- domain=domain)
+ body = self.auth(user, password, tenant, user_type='name',
+ domain=domain)
- token = resp.get('x-subject-token')
+ token = body.response.get('x-subject-token')
if auth_data:
return token, body['token']
else:
diff --git a/tempest/services/identity/v3/json/policy_client.py b/tempest/services/identity/v3/json/policy_client.py
index 04374a2..25931c8 100644
--- a/tempest/services/identity/v3/json/policy_client.py
+++ b/tempest/services/identity/v3/json/policy_client.py
@@ -15,7 +15,7 @@
import json
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest.services.identity.v3.json import base
@@ -31,14 +31,14 @@
resp, body = self.post('policies', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['policy'])
+ return service_client.ResponseBody(resp, body['policy'])
def list_policies(self):
"""Lists the policies."""
resp, body = self.get('policies')
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBodyList(resp, body['policies'])
+ return service_client.ResponseBodyList(resp, body['policies'])
def get_policy(self, policy_id):
"""Lists out the given policy."""
@@ -46,7 +46,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['policy'])
+ return service_client.ResponseBody(resp, body['policy'])
def update_policy(self, policy_id, **kwargs):
"""Updates a policy."""
@@ -59,11 +59,11 @@
resp, body = self.patch(url, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['policy'])
+ return service_client.ResponseBody(resp, body['policy'])
def delete_policy(self, policy_id):
"""Deletes the policy."""
url = "policies/%s" % policy_id
resp, body = self.delete(url)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/identity/v3/json/region_client.py b/tempest/services/identity/v3/json/region_client.py
index 8545778..482cbc6 100644
--- a/tempest/services/identity/v3/json/region_client.py
+++ b/tempest/services/identity/v3/json/region_client.py
@@ -16,6 +16,7 @@
import json
import urllib
+from tempest.common import service_client
from tempest.services.identity.v3.json import base
@@ -36,7 +37,7 @@
resp, body = self.post('regions', req_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return resp, body['region']
+ return service_client.ResponseBody(resp, body['region'])
def update_region(self, region_id, **kwargs):
"""Updates a region."""
@@ -49,7 +50,7 @@
resp, body = self.patch('regions/%s' % region_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['region']
+ return service_client.ResponseBody(resp, body['region'])
def get_region(self, region_id):
"""Get region."""
@@ -57,7 +58,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['region']
+ return service_client.ResponseBody(resp, body['region'])
def list_regions(self, params=None):
"""List regions."""
@@ -67,10 +68,10 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['regions']
+ return service_client.ResponseBodyList(resp, body['regions'])
def delete_region(self, region_id):
"""Delete region."""
resp, body = self.delete('regions/%s' % region_id)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/identity/v3/json/service_client.py b/tempest/services/identity/v3/json/service_client.py
index b8b2556..2e2df13 100644
--- a/tempest/services/identity/v3/json/service_client.py
+++ b/tempest/services/identity/v3/json/service_client.py
@@ -15,6 +15,7 @@
import json
+from tempest.common import service_client
from tempest.services.identity.v3.json import base
@@ -22,7 +23,7 @@
def update_service(self, service_id, **kwargs):
"""Updates a service."""
- resp, body = self.get_service(service_id)
+ body = self.get_service(service_id)
name = kwargs.get('name', body['name'])
type = kwargs.get('type', body['type'])
desc = kwargs.get('description', body['description'])
@@ -35,7 +36,7 @@
resp, body = self.patch('services/%s' % service_id, patch_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['service']
+ return service_client.ResponseBody(resp, body['service'])
def get_service(self, service_id):
"""Get Service."""
@@ -43,7 +44,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['service']
+ return service_client.ResponseBody(resp, body['service'])
def create_service(self, serv_type, name=None, description=None,
enabled=True):
@@ -57,16 +58,16 @@
resp, body = self.post("services", body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return resp, body["service"]
+ return service_client.ResponseBody(resp, body["service"])
def delete_service(self, serv_id):
url = "services/" + serv_id
resp, body = self.delete(url)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def list_services(self):
resp, body = self.get('services')
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['services']
+ return service_client.ResponseBodyList(resp, body['services'])
diff --git a/tempest/services/image/v1/json/image_client.py b/tempest/services/image/v1/json/image_client.py
index d60c9d9..a7b8f63 100644
--- a/tempest/services/image/v1/json/image_client.py
+++ b/tempest/services/image/v1/json/image_client.py
@@ -21,7 +21,7 @@
import urllib
from tempest.common import glance_http
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest.common.utils import misc as misc_utils
from tempest import config
from tempest import exceptions
@@ -32,11 +32,16 @@
LOG = logging.getLogger(__name__)
-class ImageClientJSON(rest_client.RestClient):
+class ImageClientJSON(service_client.ServiceClient):
def __init__(self, auth_provider):
- super(ImageClientJSON, self).__init__(auth_provider)
- self.service = CONF.image.catalog_type
+ super(ImageClientJSON, self).__init__(
+ auth_provider,
+ CONF.image.catalog_type,
+ CONF.image.region or CONF.identity.region,
+ endpoint_type=CONF.image.endpoint_type,
+ build_interval=CONF.image.build_interval,
+ build_timeout=CONF.image.build_timeout)
self._http = None
def _image_meta_from_headers(self, headers):
@@ -117,7 +122,7 @@
self._error_checker('POST', '/v1/images', headers, data, resp,
body_iter)
body = json.loads(''.join([c for c in body_iter]))
- return resp, body['image']
+ return service_client.ResponseBody(resp, body['image'])
def _update_with_data(self, image_id, headers, data):
url = '/v1/images/%s' % image_id
@@ -126,7 +131,7 @@
self._error_checker('PUT', url, headers, data,
resp, body_iter)
body = json.loads(''.join([c for c in body_iter]))
- return resp, body['image']
+ return service_client.ResponseBody(resp, body['image'])
@property
def http(self):
@@ -157,7 +162,7 @@
resp, body = self.post('v1/images', None, headers)
self.expected_success(201, resp.status)
body = json.loads(body)
- return resp, body['image']
+ return service_client.ResponseBody(resp, body['image'])
def update_image(self, image_id, name=None, container_format=None,
data=None, properties=None):
@@ -181,13 +186,13 @@
resp, body = self.put(url, data, headers)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['image']
+ return service_client.ResponseBody(resp, body['image'])
def delete_image(self, image_id):
url = 'v1/images/%s' % image_id
resp, body = self.delete(url)
self.expected_success(200, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def image_list(self, **kwargs):
url = 'v1/images'
@@ -198,7 +203,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['images']
+ return service_client.ResponseBodyList(resp, body['images'])
def image_list_detail(self, properties=dict(), changes_since=None,
**kwargs):
@@ -219,19 +224,20 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['images']
+ return service_client.ResponseBodyList(resp, body['images'])
def get_image_meta(self, image_id):
url = 'v1/images/%s' % image_id
resp, __ = self.head(url)
self.expected_success(200, resp.status)
body = self._image_meta_from_headers(resp)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def get_image(self, image_id):
url = 'v1/images/%s' % image_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
+ # We can't return a ResponseBody because the body is a string
return resp, body
def is_resource_deleted(self, id):
@@ -251,14 +257,14 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def get_shared_images(self, member_id):
url = 'v1/shared-images/%s' % member_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def add_member(self, member_id, image_id, can_share=False):
url = 'v1/images/%s/members/%s' % (image_id, member_id)
@@ -267,17 +273,17 @@
body = json.dumps({'member': {'can_share': True}})
resp, __ = self.put(url, body)
self.expected_success(204, resp.status)
- return resp
+ return service_client.ResponseBody(resp)
def delete_member(self, member_id, image_id):
url = 'v1/images/%s/members/%s' % (image_id, member_id)
resp, __ = self.delete(url)
self.expected_success(204, resp.status)
- return resp
+ return service_client.ResponseBody(resp)
# NOTE(afazekas): just for the wait function
def _get_image_status(self, image_id):
- resp, meta = self.get_image_meta(image_id)
+ meta = self.get_image_meta(image_id)
status = meta['status']
return status
diff --git a/tempest/services/image/v2/json/image_client.py b/tempest/services/image/v2/json/image_client.py
index 7421508..4b1d52d 100644
--- a/tempest/services/image/v2/json/image_client.py
+++ b/tempest/services/image/v2/json/image_client.py
@@ -19,18 +19,23 @@
import jsonschema
from tempest.common import glance_http
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest import config
from tempest import exceptions
CONF = config.CONF
-class ImageClientV2JSON(rest_client.RestClient):
+class ImageClientV2JSON(service_client.ServiceClient):
def __init__(self, auth_provider):
- super(ImageClientV2JSON, self).__init__(auth_provider)
- self.service = CONF.image.catalog_type
+ super(ImageClientV2JSON, self).__init__(
+ auth_provider,
+ CONF.image.catalog_type,
+ CONF.image.region or CONF.identity.region,
+ endpoint_type=CONF.image.endpoint_type,
+ build_interval=CONF.image.build_interval,
+ build_timeout=CONF.image.build_timeout)
self._http = None
def _get_http(self):
@@ -42,7 +47,7 @@
def _validate_schema(self, body, type='image'):
if type in ['image', 'images']:
- resp, schema = self.get_schema(type)
+ schema = self.get_schema(type)
else:
raise ValueError("%s is not a valid schema type" % type)
@@ -63,7 +68,7 @@
"-json-patch"}
resp, body = self.patch('v2/images/%s' % image_id, data, headers)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def create_image(self, name, container_format, disk_format, **kwargs):
params = {
@@ -85,12 +90,13 @@
resp, body = self.post('v2/images', data)
self.expected_success(201, resp.status)
body = json.loads(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def delete_image(self, image_id):
url = 'v2/images/%s' % image_id
resp, _ = self.delete(url)
self.expected_success(204, resp.status)
+ return service_client.ResponseBody(resp)
def image_list(self, params=None):
url = 'v2/images'
@@ -102,14 +108,14 @@
self.expected_success(200, resp.status)
body = json.loads(body)
self._validate_schema(body, type='images')
- return resp, body['images']
+ return service_client.ResponseBodyList(resp, body['images'])
def get_image(self, image_id):
url = 'v2/images/%s' % image_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def is_resource_deleted(self, id):
try:
@@ -129,32 +135,33 @@
resp, body = self.http.raw_request('PUT', url, headers=headers,
body=data)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def get_image_file(self, image_id):
url = 'v2/images/%s/file' % image_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
+ # We can't return a ResponseBody because the body is a string
return resp, body
def add_image_tag(self, image_id, tag):
url = 'v2/images/%s/tags/%s' % (image_id, tag)
resp, body = self.put(url, body=None)
self.expected_success(204, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def delete_image_tag(self, image_id, tag):
url = 'v2/images/%s/tags/%s' % (image_id, tag)
resp, _ = self.delete(url)
self.expected_success(204, resp.status)
- return resp
+ return service_client.ResponseBody(resp)
def get_image_membership(self, image_id):
url = 'v2/images/%s/members' % image_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def add_member(self, image_id, member_id):
url = 'v2/images/%s/members' % image_id
@@ -162,7 +169,7 @@
resp, body = self.post(url, data)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def update_member_status(self, image_id, member_id, status):
"""Valid status are: ``pending``, ``accepted``, ``rejected``."""
@@ -171,23 +178,23 @@
resp, body = self.put(url, data)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def get_member(self, image_id, member_id):
url = 'v2/images/%s/members/%s' % (image_id, member_id)
resp, body = self.get(url)
self.expected_success(200, resp.status)
- return resp, json.loads(body)
+ return service_client.ResponseBody(resp, json.loads(body))
def remove_member(self, image_id, member_id):
url = 'v2/images/%s/members/%s' % (image_id, member_id)
resp, _ = self.delete(url)
self.expected_success(204, resp.status)
- return resp
+ return service_client.ResponseBody(resp)
def get_schema(self, schema):
url = 'v2/schemas/%s' % schema
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/messaging/json/messaging_client.py b/tempest/services/messaging/json/messaging_client.py
index 2794ea9..36444a9 100644
--- a/tempest/services/messaging/json/messaging_client.py
+++ b/tempest/services/messaging/json/messaging_client.py
@@ -15,25 +15,32 @@
import json
import urllib
+import uuid
from tempest.api_schema.response.messaging.v1 import queues as queues_schema
-from tempest.common import rest_client
-from tempest.common.utils import data_utils
-from tempest import config
+from tempest.common import service_client
-CONF = config.CONF
+class MessagingClientJSON(service_client.ServiceClient):
+ def __init__(self, auth_provider, service, region,
+ endpoint_type=None, build_interval=None, build_timeout=None,
+ disable_ssl_certificate_validation=None, ca_certs=None,
+ trace_requests=None):
+ dscv = disable_ssl_certificate_validation
+ super(MessagingClientJSON, self).__init__(
+ auth_provider, service, region,
+ endpoint_type=endpoint_type,
+ build_interval=build_interval,
+ build_timeout=build_timeout,
+ disable_ssl_certificate_validation=dscv,
+ ca_certs=ca_certs,
+ trace_requests=trace_requests)
-class MessagingClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(MessagingClientJSON, self).__init__(auth_provider)
- self.service = CONF.messaging.catalog_type
self.version = '1'
self.uri_prefix = 'v{0}'.format(self.version)
- client_id = data_utils.rand_uuid_hex()
+ client_id = uuid.uuid4().hex
self.headers = {'Client-ID': client_id}
def list_queues(self):
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index c622ee4..e92708c 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -14,15 +14,12 @@
import time
import urllib
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest.common.utils import misc
-from tempest import config
from tempest import exceptions
-CONF = config.CONF
-
-class NetworkClientJSON(rest_client.RestClient):
+class NetworkClientJSON(service_client.ServiceClient):
"""
Tempest REST client for Neutron. Uses v2 of the Neutron API, since the
@@ -37,13 +34,8 @@
quotas
"""
- def __init__(self, auth_provider):
- super(NetworkClientJSON, self).__init__(auth_provider)
- self.service = CONF.network.catalog_type
- self.build_timeout = CONF.network.build_timeout
- self.build_interval = CONF.network.build_interval
- self.version = '2.0'
- self.uri_prefix = "v%s" % (self.version)
+ version = '2.0'
+ uri_prefix = "v2.0"
def get_uri(self, plural_name):
# get service prefix from resource name
@@ -65,7 +57,7 @@
'ipsecpolicies': 'vpn',
'vpnservices': 'vpn',
'ikepolicies': 'vpn',
- 'ipsecpolicies': 'vpn',
+ 'ipsec-site-connections': 'vpn',
'metering_labels': 'metering',
'metering_label_rules': 'metering',
'firewall_rules': 'fw',
@@ -93,7 +85,7 @@
'security_group_rules': 'security_group_rules',
'ipsecpolicy': 'ipsecpolicies',
'ikepolicy': 'ikepolicies',
- 'ipsecpolicy': 'ipsecpolicies',
+ 'ipsec_site_connection': 'ipsec-site-connections',
'quotas': 'quotas',
'firewall_policy': 'firewall_policies'
}
@@ -107,7 +99,7 @@
resp, body = self.get(uri)
result = {plural_name: self.deserialize_list(body)}
self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, result)
+ return service_client.ResponseBody(resp, result)
return _list
@@ -117,7 +109,7 @@
uri = '%s/%s' % (self.get_uri(plural), resource_id)
resp, body = self.delete(uri)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
return _delete
@@ -133,7 +125,7 @@
resp, body = self.get(uri)
body = self.deserialize_single(body)
self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
return _show
@@ -145,7 +137,7 @@
resp, body = self.post(uri, post_data)
body = self.deserialize_single(body)
self.expected_success(201, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
return _create
@@ -157,7 +149,7 @@
resp, body = self.put(uri, post_data)
body = self.deserialize_single(body)
self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
return _update
@@ -183,7 +175,7 @@
resp, body = self.post(uri, body)
body = {'networks': self.deserialize_list(body)}
self.expected_success(201, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def create_bulk_subnet(self, subnet_list):
post_data = {'subnets': subnet_list}
@@ -192,7 +184,7 @@
resp, body = self.post(uri, body)
body = {'subnets': self.deserialize_list(body)}
self.expected_success(201, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def create_bulk_port(self, port_list):
post_data = {'ports': port_list}
@@ -201,7 +193,7 @@
resp, body = self.post(uri, body)
body = {'ports': self.deserialize_list(body)}
self.expected_success(201, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def wait_for_resource_deletion(self, resource_type, id):
"""Waits for a resource to be deleted."""
@@ -287,13 +279,13 @@
resp, body = self.put(uri, body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body['quota'])
+ return service_client.ResponseBody(resp, body['quota'])
def reset_quotas(self, tenant_id):
uri = '%s/quotas/%s' % (self.uri_prefix, tenant_id)
resp, body = self.delete(uri)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def create_router(self, name, admin_state_up=True, **kwargs):
post_body = {'router': kwargs}
@@ -304,7 +296,7 @@
resp, body = self.post(uri, body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def _update_router(self, router_id, set_enable_snat, **kwargs):
uri = '%s/routers/%s' % (self.uri_prefix, router_id)
@@ -331,7 +323,7 @@
resp, body = self.put(uri, update_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def update_router(self, router_id, **kwargs):
"""Update a router leaving enable_snat to its default value."""
@@ -358,7 +350,7 @@
resp, body = self.put(uri, update_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def add_router_interface_with_port_id(self, router_id, port_id):
uri = '%s/routers/%s/add_router_interface' % (self.uri_prefix,
@@ -368,7 +360,7 @@
resp, body = self.put(uri, update_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def remove_router_interface_with_subnet_id(self, router_id, subnet_id):
uri = '%s/routers/%s/remove_router_interface' % (self.uri_prefix,
@@ -378,7 +370,7 @@
resp, body = self.put(uri, update_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def remove_router_interface_with_port_id(self, router_id, port_id):
uri = '%s/routers/%s/remove_router_interface' % (self.uri_prefix,
@@ -388,7 +380,7 @@
resp, body = self.put(uri, update_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def associate_health_monitor_with_pool(self, health_monitor_id,
pool_id):
@@ -403,7 +395,7 @@
resp, body = self.post(uri, body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def disassociate_health_monitor_with_pool(self, health_monitor_id,
pool_id):
@@ -411,14 +403,14 @@
health_monitor_id)
resp, body = self.delete(uri)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def list_router_interfaces(self, uuid):
uri = '%s/ports?device_id=%s' % (self.uri_prefix, uuid)
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def update_agent(self, agent_id, agent_info):
"""
@@ -431,14 +423,14 @@
resp, body = self.put(uri, body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def list_pools_hosted_by_one_lbaas_agent(self, agent_id):
uri = '%s/agents/%s/loadbalancer-pools' % (self.uri_prefix, agent_id)
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def show_lbaas_agent_hosting_pool(self, pool_id):
uri = ('%s/lb/pools/%s/loadbalancer-agent' %
@@ -446,21 +438,21 @@
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def list_routers_on_l3_agent(self, agent_id):
uri = '%s/agents/%s/l3-routers' % (self.uri_prefix, agent_id)
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def list_l3_agents_hosting_router(self, router_id):
uri = '%s/routers/%s/l3-agents' % (self.uri_prefix, router_id)
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def add_router_to_l3_agent(self, agent_id, router_id):
uri = '%s/agents/%s/l3-routers' % (self.uri_prefix, agent_id)
@@ -469,35 +461,35 @@
resp, body = self.post(uri, body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def remove_router_from_l3_agent(self, agent_id, router_id):
uri = '%s/agents/%s/l3-routers/%s' % (
self.uri_prefix, agent_id, router_id)
resp, body = self.delete(uri)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def list_dhcp_agent_hosting_network(self, network_id):
uri = '%s/networks/%s/dhcp-agents' % (self.uri_prefix, network_id)
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def list_networks_hosted_by_one_dhcp_agent(self, agent_id):
uri = '%s/agents/%s/dhcp-networks' % (self.uri_prefix, agent_id)
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def remove_network_from_dhcp_agent(self, agent_id, network_id):
uri = '%s/agents/%s/dhcp-networks/%s' % (self.uri_prefix, agent_id,
network_id)
resp, body = self.delete(uri)
self.expected_success(204, resp.status)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def create_ikepolicy(self, name, **kwargs):
post_body = {
@@ -512,7 +504,7 @@
resp, body = self.post(uri, body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def update_extra_routes(self, router_id, nexthop, destination):
uri = '%s/routers/%s' % (self.uri_prefix, router_id)
@@ -526,7 +518,7 @@
resp, body = self.put(uri, body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def delete_extra_routes(self, router_id):
uri = '%s/routers/%s' % (self.uri_prefix, router_id)
@@ -540,14 +532,14 @@
resp, body = self.put(uri, body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def list_lb_pool_stats(self, pool_id):
uri = '%s/lb/pools/%s/stats' % (self.uri_prefix, pool_id)
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def add_dhcp_agent_to_network(self, agent_id, network_id):
post_body = {'network_id': network_id}
@@ -556,7 +548,7 @@
resp, body = self.post(uri, body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def insert_firewall_rule_in_policy(self, firewall_policy_id,
firewall_rule_id, insert_after="",
@@ -572,7 +564,7 @@
resp, body = self.put(uri, body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
def remove_firewall_rule_from_policy(self, firewall_policy_id,
firewall_rule_id):
@@ -583,4 +575,4 @@
resp, body = self.put(uri, update_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/network/resources.py b/tempest/services/network/resources.py
index 513d2cf..4d45515 100644
--- a/tempest/services/network/resources.py
+++ b/tempest/services/network/resources.py
@@ -82,8 +82,10 @@
self._router_ids = set()
def update(self, *args, **kwargs):
- result = self.client.update_subnet(subnet=self.id, *args, **kwargs)
- super(DeletableSubnet, self).update(**result['subnet'])
+ result = self.client.update_subnet(self.id,
+ *args,
+ **kwargs)
+ return super(DeletableSubnet, self).update(**result['subnet'])
def add_to_router(self, router_id):
self._router_ids.add(router_id)
diff --git a/tempest/services/object_storage/account_client.py b/tempest/services/object_storage/account_client.py
index 23984cd..af00eff 100644
--- a/tempest/services/object_storage/account_client.py
+++ b/tempest/services/object_storage/account_client.py
@@ -17,15 +17,10 @@
import urllib
from xml.etree import ElementTree as etree
-from tempest.common import http
-from tempest import config
-from tempest import exceptions
-from tempest.services.object_storage import base
-
-CONF = config.CONF
+from tempest.common import service_client
-class AccountClient(base.ObjectStorageClient):
+class AccountClient(service_client.ServiceClient):
def create_account(self, data=None,
params=None,
@@ -162,75 +157,3 @@
body = json.loads(body)
self.expected_success(200, resp.status)
return resp, body
-
-
-class AccountClientCustomizedHeader(base.ObjectStorageClient):
-
- # TODO(andreaf) This class is now redundant, to be removed in next patch
-
- def request(self, method, url, extra_headers=False, headers=None,
- body=None):
- """A simple HTTP request interface."""
- dscv = CONF.identity.disable_ssl_certificate_validation
- ca_certs = CONF.identity.ca_certificates_file
- self.http_obj = http.ClosingHttp(
- disable_ssl_certificate_validation=dscv,
- ca_certs=ca_certs)
- if headers is None:
- headers = {}
- elif extra_headers:
- try:
- headers.update(self.get_headers())
- except (ValueError, TypeError):
- headers = {}
-
- # Authorize the request
- req_url, req_headers, req_body = self.auth_provider.auth_request(
- method=method, url=url, headers=headers, body=body,
- filters=self.filters
- )
- # use original body
- resp, resp_body = self.http_obj.request(req_url, method,
- headers=req_headers,
- body=req_body)
- self._log_request(method, req_url, resp)
-
- if resp.status == 401 or resp.status == 403:
- raise exceptions.Unauthorized()
-
- return resp, resp_body
-
- def list_account_containers(self, params=None, metadata=None):
- """
- GET on the (base) storage URL
- Given a valid X-Auth-Token, returns a list of all containers for the
- account.
-
- Optional Arguments:
- limit=[integer value N]
- Limits the number of results to at most N values
- DEFAULT: 10,000
-
- marker=[string value X]
- Given string value X, return object names greater in value
- than the specified marker.
- DEFAULT: No Marker
-
- format=[string value, either 'json' or 'xml']
- Specify either json or xml to return the respective serialized
- response.
- DEFAULT: Python-List returned in response body
- """
-
- url = '?format=%s' % self.format
- if params:
- url += '&%s' % urllib.urlencode(params)
-
- headers = {}
- if metadata:
- for key in metadata:
- headers[str(key)] = metadata[key]
-
- resp, body = self.get(url, headers=headers)
- self.expected_success(200, resp.status)
- return resp, body
diff --git a/tempest/services/object_storage/base.py b/tempest/services/object_storage/base.py
deleted file mode 100644
index c903ca5..0000000
--- a/tempest/services/object_storage/base.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2014 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.
-
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
-
-
-class ObjectStorageClient(rest_client.RestClient):
- """
- Base object storage client class
- """
-
- def __init__(self, auth_provider):
- super(ObjectStorageClient, self).__init__(auth_provider)
- self.service = CONF.object_storage.catalog_type
- self.format = 'json'
diff --git a/tempest/services/object_storage/container_client.py b/tempest/services/object_storage/container_client.py
index c55826b..ed74de4 100644
--- a/tempest/services/object_storage/container_client.py
+++ b/tempest/services/object_storage/container_client.py
@@ -17,10 +17,10 @@
import urllib
from xml.etree import ElementTree as etree
-from tempest.services.object_storage import base
+from tempest.common import service_client
-class ContainerClient(base.ObjectStorageClient):
+class ContainerClient(service_client.ServiceClient):
def create_container(
self, container_name,
diff --git a/tempest/services/object_storage/object_client.py b/tempest/services/object_storage/object_client.py
index a93a9df..eaa894d 100644
--- a/tempest/services/object_storage/object_client.py
+++ b/tempest/services/object_storage/object_client.py
@@ -17,21 +17,17 @@
import urllib
import urlparse
-from tempest.common import http
-from tempest import config
-from tempest import exceptions
-from tempest.services.object_storage import base
-
-CONF = config.CONF
+from tempest.common import service_client
-class ObjectClient(base.ObjectStorageClient):
+class ObjectClient(service_client.ServiceClient):
def create_object(self, container, object_name, data,
- params=None, metadata=None):
+ params=None, metadata=None, headers=None):
"""Create storage object."""
- headers = self.get_headers()
+ if headers is None:
+ headers = self.get_headers()
if not data:
headers['content-length'] = '0'
if metadata:
@@ -177,82 +173,6 @@
self.expected_success(201, resp.status)
return resp.status, resp.reason, resp_headers
-
-class ObjectClientCustomizedHeader(base.ObjectStorageClient):
-
- # TODO(andreaf) This class is now redundant, to be removed in next patch
-
- def request(self, method, url, extra_headers=False, headers=None,
- body=None):
- """A simple HTTP request interface."""
- dscv = CONF.identity.disable_ssl_certificate_validation
- ca_certs = CONF.identity.ca_certificates_file
- self.http_obj = http.ClosingHttp(
- disable_ssl_certificate_validation=dscv,
- ca_certs=ca_certs)
- if headers is None:
- headers = {}
- elif extra_headers:
- try:
- headers.update(self.get_headers())
- except (ValueError, TypeError):
- headers = {}
-
- # Authorize the request
- req_url, req_headers, req_body = self.auth_provider.auth_request(
- method=method, url=url, headers=headers, body=body,
- filters=self.filters
- )
- # Use original method
- resp, resp_body = self.http_obj.request(req_url, method,
- headers=req_headers,
- body=req_body)
- self._log_request(method, req_url, resp)
- if resp.status == 401 or resp.status == 403:
- raise exceptions.Unauthorized()
-
- return resp, resp_body
-
- def get_object(self, container, object_name, metadata=None):
- """Retrieve object's data."""
- headers = {}
- if metadata:
- for key in metadata:
- headers[str(key)] = metadata[key]
-
- url = "{0}/{1}".format(container, object_name)
- resp, body = self.get(url, headers=headers)
- self.expected_success(200, resp.status)
- return resp, body
-
- def create_object(self, container, object_name, data, metadata=None):
- """Create storage object."""
-
- headers = {}
- if metadata:
- for key in metadata:
- headers[str(key)] = metadata[key]
-
- if not data:
- headers['content-length'] = '0'
- url = "%s/%s" % (str(container), str(object_name))
- resp, body = self.put(url, data, headers=headers)
- self.expected_success(201, resp.status)
- return resp, body
-
- def delete_object(self, container, object_name, metadata=None):
- """Delete storage object."""
-
- headers = {}
- if metadata:
- for key in metadata:
- headers[str(key)] = metadata[key]
-
- url = "%s/%s" % (str(container), str(object_name))
- resp, body = self.delete(url, headers=headers)
- self.expected_success(200, resp.status)
- return resp, body
-
def create_object_continue(self, container, object_name,
data, metadata=None):
"""Create storage object."""
diff --git a/tempest/services/orchestration/json/orchestration_client.py b/tempest/services/orchestration/json/orchestration_client.py
index 9b4700a..c813977 100644
--- a/tempest/services/orchestration/json/orchestration_client.py
+++ b/tempest/services/orchestration/json/orchestration_client.py
@@ -18,20 +18,11 @@
import time
import urllib
-from tempest.common import rest_client
-from tempest import config
+from tempest.common import service_client
from tempest import exceptions
-CONF = config.CONF
-
-class OrchestrationClient(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(OrchestrationClient, self).__init__(auth_provider)
- self.service = CONF.orchestration.catalog_type
- self.build_interval = CONF.orchestration.build_interval
- self.build_timeout = CONF.orchestration.build_timeout
+class OrchestrationClient(service_client.ServiceClient):
def list_stacks(self, params=None):
"""Lists all stacks for a user."""
@@ -43,7 +34,7 @@
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['stacks']
+ return service_client.ResponseBodyList(resp, body['stacks'])
def create_stack(self, name, disable_rollback=True, parameters=None,
timeout_mins=60, template=None, template_url=None,
@@ -63,7 +54,7 @@
resp, body = self.post(uri, headers=headers, body=body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def update_stack(self, stack_identifier, name, disable_rollback=True,
parameters=None, timeout_mins=60, template=None,
@@ -82,7 +73,7 @@
uri = "stacks/%s" % stack_identifier
resp, body = self.put(uri, headers=headers, body=body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def _prepare_update_create(self, name, disable_rollback=True,
parameters=None, timeout_mins=60,
@@ -118,7 +109,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['stack']
+ return service_client.ResponseBody(resp, body['stack'])
def suspend_stack(self, stack_identifier):
"""Suspend a stack."""
@@ -126,7 +117,7 @@
body = {'suspend': None}
resp, body = self.post(url, json.dumps(body))
self.expected_success(200, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp)
def resume_stack(self, stack_identifier):
"""Resume a stack."""
@@ -134,7 +125,7 @@
body = {'resume': None}
resp, body = self.post(url, json.dumps(body))
self.expected_success(200, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp)
def list_resources(self, stack_identifier):
"""Returns the details of a single resource."""
@@ -142,7 +133,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['resources']
+ return service_client.ResponseBodyList(resp, body['resources'])
def get_resource(self, stack_identifier, resource_name):
"""Returns the details of a single resource."""
@@ -150,13 +141,13 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['resource']
+ return service_client.ResponseBody(resp, body['resource'])
def delete_stack(self, stack_identifier):
"""Deletes the specified Stack."""
resp, _ = self.delete("stacks/%s" % str(stack_identifier))
self.expected_success(204, resp.status)
- return resp
+ return service_client.ResponseBody(resp)
def wait_for_resource_status(self, stack_identifier, resource_name,
status, failure_pattern='^.*_FAILED$'):
@@ -166,7 +157,7 @@
while True:
try:
- resp, body = self.get_resource(
+ body = self.get_resource(
stack_identifier, resource_name)
except exceptions.NotFound:
# ignore this, as the resource may not have
@@ -202,7 +193,7 @@
while True:
try:
- resp, body = self.get_stack(stack_identifier)
+ body = self.get_stack(stack_identifier)
except exceptions.NotFound:
if status == 'DELETE_COMPLETE':
return
@@ -231,7 +222,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['metadata']
+ return service_client.ResponseBody(resp, body['metadata'])
def list_events(self, stack_identifier):
"""Returns list of all events for a stack."""
@@ -239,7 +230,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['events']
+ return service_client.ResponseBodyList(resp, body['events'])
def list_resource_events(self, stack_identifier, resource_name):
"""Returns list of all events for a resource from stack."""
@@ -248,7 +239,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['events']
+ return service_client.ResponseBodyList(resp, body['events'])
def show_event(self, stack_identifier, resource_name, event_id):
"""Returns the details of a single stack's event."""
@@ -257,7 +248,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['event']
+ return service_client.ResponseBody(resp, body['event'])
def show_template(self, stack_identifier):
"""Returns the template for the stack."""
@@ -265,7 +256,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def _validate_template(self, post_body):
"""Returns the validation request result."""
@@ -273,7 +264,7 @@
resp, body = self.post('validate', post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def validate_template(self, template, parameters=None):
"""Returns the validation result for a template with parameters."""
@@ -300,21 +291,21 @@
resp, body = self.get('resource_types')
self.expected_success(200, resp.status)
body = json.loads(body)
- return body['resource_types']
+ return service_client.ResponseBodyList(resp, body['resource_types'])
def get_resource_type(self, resource_type_name):
"""Return the schema of a resource type."""
url = 'resource_types/%s' % resource_type_name
resp, body = self.get(url)
self.expected_success(200, resp.status)
- return json.loads(body)
+ return service_client.ResponseBody(resp, json.loads(body))
def get_resource_type_template(self, resource_type_name):
"""Return the template of a resource type."""
url = 'resource_types/%s/template' % resource_type_name
resp, body = self.get(url)
self.expected_success(200, resp.status)
- return json.loads(body)
+ return service_client.ResponseBody(resp, json.loads(body))
def create_software_config(self, name=None, config=None, group=None,
inputs=None, outputs=None, options=None):
@@ -325,7 +316,7 @@
resp, body = self.post(url, headers=headers, body=body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return body
+ return service_client.ResponseBody(resp, body)
def get_software_config(self, conf_id):
"""Returns a software configuration resource."""
@@ -333,13 +324,14 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return body
+ return service_client.ResponseBody(resp, body)
def delete_software_config(self, conf_id):
"""Deletes a specific software configuration."""
url = 'software_configs/%s' % str(conf_id)
resp, _ = self.delete(url)
self.expected_success(204, resp.status)
+ return service_client.ResponseBody(resp)
def create_software_deploy(self, server_id=None, config_id=None,
action=None, status=None,
@@ -354,7 +346,7 @@
resp, body = self.post(url, headers=headers, body=body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return body
+ return service_client.ResponseBody(resp, body)
def update_software_deploy(self, deploy_id=None, server_id=None,
config_id=None, action=None, status=None,
@@ -369,7 +361,7 @@
resp, body = self.put(url, headers=headers, body=body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return body
+ return service_client.ResponseBody(resp, body)
def get_software_deploy_list(self):
"""Returns a list of all deployments."""
@@ -377,7 +369,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return body
+ return service_client.ResponseBody(resp, body)
def get_software_deploy(self, deploy_id):
"""Returns a specific software deployment."""
@@ -385,7 +377,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return body
+ return service_client.ResponseBody(resp, body)
def get_software_deploy_meta(self, server_id):
"""Return a config metadata for a specific server."""
@@ -393,13 +385,14 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return body
+ return service_client.ResponseBody(resp, body)
def delete_software_deploy(self, deploy_id):
"""Deletes a specific software deployment."""
url = 'software_deployments/%s' % str(deploy_id)
resp, _ = self.delete(url)
self.expected_success(204, resp.status)
+ return service_client.ResponseBody(resp)
def _prep_software_config_create(self, name=None, conf=None, group=None,
inputs=None, outputs=None, options=None):
diff --git a/tempest/services/telemetry/json/telemetry_client.py b/tempest/services/telemetry/json/telemetry_client.py
index d2dd375..2967cfa 100644
--- a/tempest/services/telemetry/json/telemetry_client.py
+++ b/tempest/services/telemetry/json/telemetry_client.py
@@ -15,20 +15,14 @@
import urllib
-from tempest.common import rest_client
-from tempest import config
+from tempest.common import service_client
from tempest.openstack.common import jsonutils as json
-CONF = config.CONF
+class TelemetryClientJSON(service_client.ServiceClient):
-class TelemetryClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(TelemetryClientJSON, self).__init__(auth_provider)
- self.service = CONF.telemetry.catalog_type
- self.version = '2'
- self.uri_prefix = "v%s" % self.version
+ version = '2'
+ uri_prefix = "v2"
def deserialize(self, body):
return json.loads(body.replace("\n", ""))
diff --git a/tempest/services/volume/json/admin/volume_hosts_client.py b/tempest/services/volume/json/admin/volume_hosts_client.py
index e7add30..cf566f2 100644
--- a/tempest/services/volume/json/admin/volume_hosts_client.py
+++ b/tempest/services/volume/json/admin/volume_hosts_client.py
@@ -16,6 +16,7 @@
import json
import urllib
+from tempest.common import service_client
from tempest.services.volume.json import base
@@ -34,7 +35,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['hosts']
+ return service_client.ResponseBodyList(resp, body['hosts'])
class VolumeHostsClientJSON(BaseVolumeHostsClientJSON):
diff --git a/tempest/services/volume/json/admin/volume_quotas_client.py b/tempest/services/volume/json/admin/volume_quotas_client.py
index f08cb64..88df69f 100644
--- a/tempest/services/volume/json/admin/volume_quotas_client.py
+++ b/tempest/services/volume/json/admin/volume_quotas_client.py
@@ -16,6 +16,7 @@
import urllib
+from tempest.common import service_client
from tempest.openstack.common import jsonutils
from tempest.services.volume.json import base
@@ -33,7 +34,7 @@
url = 'os-quota-sets/%s/defaults' % tenant_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def get_quota_set(self, tenant_id, params=None):
"""List the quota set for a tenant."""
@@ -44,14 +45,13 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def get_quota_usage(self, tenant_id):
"""List the quota set for a tenant."""
- resp, body = self.get_quota_set(tenant_id, params={'usage': True})
- self.expected_success(200, resp.status)
- return resp, body
+ body = self.get_quota_set(tenant_id, params={'usage': True})
+ return body
def update_quota_set(self, tenant_id, gigabytes=None, volumes=None,
snapshots=None):
@@ -69,12 +69,13 @@
post_body = jsonutils.dumps({'quota_set': post_body})
resp, body = self.put('os-quota-sets/%s' % tenant_id, post_body)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
def delete_quota_set(self, tenant_id):
"""Delete the tenant's quota set."""
resp, body = self.delete('os-quota-sets/%s' % tenant_id)
self.expected_success(200, resp.status)
+ return service_client.ResponseBody(resp, body)
class VolumeQuotasClientJSON(BaseVolumeQuotasClientJSON):
diff --git a/tempest/services/volume/json/admin/volume_services_client.py b/tempest/services/volume/json/admin/volume_services_client.py
index 5d4f9db..d258f3d 100644
--- a/tempest/services/volume/json/admin/volume_services_client.py
+++ b/tempest/services/volume/json/admin/volume_services_client.py
@@ -16,6 +16,7 @@
import json
import urllib
+from tempest.common import service_client
from tempest.services.volume.json import base
@@ -29,7 +30,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['services']
+ return service_client.ResponseBodyList(resp, body['services'])
class VolumesServicesClientJSON(BaseVolumesServicesClientJSON):
diff --git a/tempest/services/volume/json/admin/volume_types_client.py b/tempest/services/volume/json/admin/volume_types_client.py
index 171ad35..b3b4ae6 100644
--- a/tempest/services/volume/json/admin/volume_types_client.py
+++ b/tempest/services/volume/json/admin/volume_types_client.py
@@ -16,6 +16,7 @@
import json
import urllib
+from tempest.common import service_client
from tempest import exceptions
from tempest.services.volume.json import base
@@ -34,8 +35,7 @@
if resource['type'] == "volume-type":
self.get_volume_type(resource['id'])
elif resource['type'] == "encryption-type":
- resp, body = self.get_encryption_type(resource['id'])
- assert 200 == resp.status
+ body = self.get_encryption_type(resource['id'])
if not body:
return True
else:
@@ -59,7 +59,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['volume_types']
+ return service_client.ResponseBodyList(resp, body['volume_types'])
def get_volume_type(self, volume_id):
"""Returns the details of a single volume_type."""
@@ -67,7 +67,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['volume_type']
+ return service_client.ResponseBody(resp, body['volume_type'])
def create_volume_type(self, name, **kwargs):
"""
@@ -85,12 +85,13 @@
resp, body = self.post('types', post_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['volume_type']
+ return service_client.ResponseBody(resp, body['volume_type'])
def delete_volume_type(self, volume_id):
"""Deletes the Specified Volume_type."""
resp, body = self.delete("types/%s" % str(volume_id))
self.expected_success(202, resp.status)
+ return service_client.ResponseBody(resp, body)
def list_volume_types_extra_specs(self, vol_type_id, params=None):
"""List all the volume_types extra specs created."""
@@ -101,7 +102,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['extra_specs']
+ return service_client.ResponseBody(resp, body['extra_specs'])
def get_volume_type_extra_specs(self, vol_type_id, extra_spec_name):
"""Returns the details of a single volume_type extra spec."""
@@ -110,7 +111,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def create_volume_type_extra_specs(self, vol_type_id, extra_spec):
"""
@@ -123,13 +124,14 @@
resp, body = self.post(url, post_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['extra_specs']
+ return service_client.ResponseBody(resp, body['extra_specs'])
def delete_volume_type_extra_specs(self, vol_id, extra_spec_name):
"""Deletes the Specified Volume_type extra spec."""
resp, body = self.delete("types/%s/extra_specs/%s" % (
(str(vol_id)), str(extra_spec_name)))
self.expected_success(202, resp.status)
+ return service_client.ResponseBody(resp, body)
def update_volume_type_extra_specs(self, vol_type_id, extra_spec_name,
extra_spec):
@@ -146,7 +148,7 @@
resp, body = self.put(url, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def get_encryption_type(self, vol_type_id):
"""
@@ -157,7 +159,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def create_encryption_type(self, vol_type_id, **kwargs):
"""
@@ -176,13 +178,14 @@
resp, body = self.post(url, post_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['encryption']
+ return service_client.ResponseBody(resp, body['encryption'])
def delete_encryption_type(self, vol_type_id):
"""Delete the encryption type for the specified volume-type."""
resp, body = self.delete(
"/types/%s/encryption/provider" % str(vol_type_id))
self.expected_success(202, resp.status)
+ return service_client.ResponseBody(resp, body)
class VolumeTypesClientJSON(BaseVolumeTypesClientJSON):
diff --git a/tempest/services/volume/json/availability_zone_client.py b/tempest/services/volume/json/availability_zone_client.py
index 9f2c570..8a0257e 100644
--- a/tempest/services/volume/json/availability_zone_client.py
+++ b/tempest/services/volume/json/availability_zone_client.py
@@ -15,6 +15,7 @@
import json
+from tempest.common import service_client
from tempest.services.volume.json import base
@@ -24,7 +25,7 @@
resp, body = self.get('os-availability-zone')
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['availabilityZoneInfo']
+ return service_client.ResponseBody(resp, body['availabilityZoneInfo'])
class VolumeAvailabilityZoneClientJSON(BaseVolumeAvailabilityZoneClientJSON):
diff --git a/tempest/services/volume/json/backups_client.py b/tempest/services/volume/json/backups_client.py
index e2ba822..102e823 100644
--- a/tempest/services/volume/json/backups_client.py
+++ b/tempest/services/volume/json/backups_client.py
@@ -16,6 +16,7 @@
import json
import time
+from tempest.common import service_client
from tempest import exceptions
from tempest.services.volume.json import base
@@ -39,7 +40,7 @@
resp, body = self.post('backups', post_body)
body = json.loads(body)
self.expected_success(202, resp.status)
- return resp, body['backup']
+ return service_client.ResponseBody(resp, body['backup'])
def restore_backup(self, backup_id, volume_id=None):
"""Restore volume from backup."""
@@ -48,13 +49,13 @@
resp, body = self.post('backups/%s/restore' % (backup_id), post_body)
body = json.loads(body)
self.expected_success(202, resp.status)
- return resp, body['restore']
+ return service_client.ResponseBody(resp, body['restore'])
def delete_backup(self, backup_id):
"""Delete a backup of volume."""
resp, body = self.delete('backups/%s' % (str(backup_id)))
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def get_backup(self, backup_id):
"""Returns the details of a single backup."""
@@ -62,7 +63,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['backup']
+ return service_client.ResponseBody(resp, body['backup'])
def list_backups_with_detail(self):
"""Information for all the tenant's backups."""
@@ -70,17 +71,17 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['backups']
+ return service_client.ResponseBodyList(resp, body['backups'])
def wait_for_backup_status(self, backup_id, status):
"""Waits for a Backup to reach a given status."""
- resp, body = self.get_backup(backup_id)
+ body = self.get_backup(backup_id)
backup_status = body['status']
start = int(time.time())
while backup_status != status:
time.sleep(self.build_interval)
- resp, body = self.get_backup(backup_id)
+ body = self.get_backup(backup_id)
backup_status = body['status']
if backup_status == 'error':
raise exceptions.VolumeBackupException(backup_id=backup_id)
diff --git a/tempest/services/volume/json/base.py b/tempest/services/volume/json/base.py
index 8bc2f93..e6c72eb 100644
--- a/tempest/services/volume/json/base.py
+++ b/tempest/services/volume/json/base.py
@@ -12,19 +12,22 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.common import rest_client
+from tempest.common import service_client
from tempest import config
CONF = config.CONF
-class VolumeClient(rest_client.RestClient):
+class VolumeClient(service_client.ServiceClient):
"""
Base volume client class
"""
def __init__(self, auth_provider):
- super(VolumeClient, self).__init__(auth_provider)
- self.service = CONF.volume.catalog_type
- self.build_interval = CONF.volume.build_interval
- self.build_timeout = CONF.volume.build_timeout
+ super(VolumeClient, self).__init__(
+ auth_provider,
+ CONF.volume.catalog_type,
+ CONF.volume.region or CONF.identity.region,
+ endpoint_type=CONF.volume.endpoint_type,
+ build_interval=CONF.volume.build_interval,
+ build_timeout=CONF.volume.build_timeout)
diff --git a/tempest/services/volume/json/extensions_client.py b/tempest/services/volume/json/extensions_client.py
index 13b91c3..ae79dad 100644
--- a/tempest/services/volume/json/extensions_client.py
+++ b/tempest/services/volume/json/extensions_client.py
@@ -15,6 +15,7 @@
import json
+from tempest.common import service_client
from tempest.services.volume.json import base
@@ -25,7 +26,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['extensions']
+ return service_client.ResponseBodyList(resp, body['extensions'])
class ExtensionsClientJSON(BaseExtensionsClientJSON):
diff --git a/tempest/services/volume/json/qos_client.py b/tempest/services/volume/json/qos_client.py
index 9c13cac..32555eb 100644
--- a/tempest/services/volume/json/qos_client.py
+++ b/tempest/services/volume/json/qos_client.py
@@ -15,6 +15,7 @@
import json
import time
+from tempest.common import service_client
from tempest import exceptions
from tempest.services.volume.json import base
@@ -46,18 +47,15 @@
start_time = int(time.time())
while True:
if operation == 'qos-key-unset':
- resp, body = self.get_qos(qos_id)
- self.expected_success(200, resp.status)
+ body = self.get_qos(qos_id)
if not any(key in body['specs'] for key in args):
return
elif operation == 'disassociate':
- resp, body = self.get_association_qos(qos_id)
- self.expected_success(200, resp.status)
+ body = self.get_association_qos(qos_id)
if not any(args in body[i]['id'] for i in range(0, len(body))):
return
elif operation == 'disassociate-all':
- resp, body = self.get_association_qos(qos_id)
- self.expected_success(200, resp.status)
+ body = self.get_association_qos(qos_id)
if not body:
return
else:
@@ -80,13 +78,14 @@
resp, body = self.post('qos-specs', post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['qos_specs']
+ return service_client.ResponseBody(resp, body['qos_specs'])
def delete_qos(self, qos_id, force=False):
"""Delete the specified QoS specification."""
resp, body = self.delete(
"qos-specs/%s?force=%s" % (str(qos_id), force))
self.expected_success(202, resp.status)
+ return service_client.ResponseBody(resp, body)
def list_qos(self):
"""List all the QoS specifications created."""
@@ -94,7 +93,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['qos_specs']
+ return service_client.ResponseBodyList(resp, body['qos_specs'])
def get_qos(self, qos_id):
"""Get the specified QoS specification."""
@@ -102,7 +101,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['qos_specs']
+ return service_client.ResponseBody(resp, body['qos_specs'])
def set_qos_key(self, qos_id, **kwargs):
"""Set the specified keys/values of QoS specification.
@@ -113,7 +112,7 @@
resp, body = self.put('qos-specs/%s' % qos_id, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['qos_specs']
+ return service_client.ResponseBody(resp, body['qos_specs'])
def unset_qos_key(self, qos_id, keys):
"""Unset the specified keys of QoS specification.
@@ -121,15 +120,17 @@
keys : it is the array of the keys to unset
"""
put_body = json.dumps({'keys': keys})
- resp, _ = self.put('qos-specs/%s/delete_keys' % qos_id, put_body)
+ resp, body = self.put('qos-specs/%s/delete_keys' % qos_id, put_body)
self.expected_success(202, resp.status)
+ return service_client.ResponseBody(resp, body)
def associate_qos(self, qos_id, vol_type_id):
"""Associate the specified QoS with specified volume-type."""
url = "qos-specs/%s/associate" % str(qos_id)
url += "?vol_type_id=%s" % vol_type_id
- resp, _ = self.get(url)
+ resp, body = self.get(url)
self.expected_success(202, resp.status)
+ return service_client.ResponseBody(resp, body)
def get_association_qos(self, qos_id):
"""Get the association of the specified QoS specification."""
@@ -137,20 +138,22 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['qos_associations']
+ return service_client.ResponseBodyList(resp, body['qos_associations'])
def disassociate_qos(self, qos_id, vol_type_id):
"""Disassociate the specified QoS with specified volume-type."""
url = "qos-specs/%s/disassociate" % str(qos_id)
url += "?vol_type_id=%s" % vol_type_id
- resp, _ = self.get(url)
+ resp, body = self.get(url)
self.expected_success(202, resp.status)
+ return service_client.ResponseBody(resp, body)
def disassociate_all_qos(self, qos_id):
"""Disassociate the specified QoS with all associations."""
url = "qos-specs/%s/disassociate_all" % str(qos_id)
- resp, _ = self.get(url)
+ resp, body = self.get(url)
self.expected_success(202, resp.status)
+ return service_client.ResponseBody(resp, body)
class QosSpecsClientJSON(BaseQosSpecsClientJSON):
diff --git a/tempest/services/volume/json/snapshots_client.py b/tempest/services/volume/json/snapshots_client.py
index 349d1b0..cd115df 100644
--- a/tempest/services/volume/json/snapshots_client.py
+++ b/tempest/services/volume/json/snapshots_client.py
@@ -14,6 +14,7 @@
import time
import urllib
+from tempest.common import service_client
from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest.services.volume.json import base
@@ -36,7 +37,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['snapshots']
+ return service_client.ResponseBodyList(resp, body['snapshots'])
def list_snapshots_with_detail(self, params=None):
"""List the details of all snapshots."""
@@ -47,7 +48,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['snapshots']
+ return service_client.ResponseBodyList(resp, body['snapshots'])
def get_snapshot(self, snapshot_id):
"""Returns the details of a single snapshot."""
@@ -55,7 +56,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['snapshot']
+ return service_client.ResponseBody(resp, body['snapshot'])
def create_snapshot(self, volume_id, **kwargs):
"""
@@ -71,7 +72,7 @@
resp, body = self.post('snapshots', post_body)
body = json.loads(body)
self.expected_success(self.create_resp, resp.status)
- return resp, body['snapshot']
+ return service_client.ResponseBody(resp, body['snapshot'])
def update_snapshot(self, snapshot_id, **kwargs):
"""Updates a snapshot."""
@@ -79,11 +80,11 @@
resp, body = self.put('snapshots/%s' % snapshot_id, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['snapshot']
+ return service_client.ResponseBody(resp, body['snapshot'])
# NOTE(afazekas): just for the wait function
def _get_snapshot_status(self, snapshot_id):
- resp, body = self.get_snapshot(snapshot_id)
+ body = self.get_snapshot(snapshot_id)
status = body['status']
# NOTE(afazekas): snapshot can reach an "error"
# state in a "normal" lifecycle
@@ -122,6 +123,7 @@
"""Delete Snapshot."""
resp, body = self.delete("snapshots/%s" % str(snapshot_id))
self.expected_success(202, resp.status)
+ return service_client.ResponseBody(resp, body)
def is_resource_deleted(self, id):
try:
@@ -140,7 +142,7 @@
post_body = json.dumps({'os-reset_status': {"status": status}})
resp, body = self.post('snapshots/%s/action' % snapshot_id, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def update_snapshot_status(self, snapshot_id, status, progress):
"""Update the specified snapshot's status."""
@@ -152,7 +154,7 @@
url = 'snapshots/%s/action' % str(snapshot_id)
resp, body = self.post(url, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def create_snapshot_metadata(self, snapshot_id, metadata):
"""Create metadata for the snapshot."""
@@ -161,7 +163,7 @@
resp, body = self.post(url, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['metadata']
+ return service_client.ResponseBody(resp, body['metadata'])
def get_snapshot_metadata(self, snapshot_id):
"""Get metadata of the snapshot."""
@@ -169,7 +171,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['metadata']
+ return service_client.ResponseBody(resp, body['metadata'])
def update_snapshot_metadata(self, snapshot_id, metadata):
"""Update metadata for the snapshot."""
@@ -178,7 +180,7 @@
resp, body = self.put(url, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['metadata']
+ return service_client.ResponseBody(resp, body['metadata'])
def update_snapshot_metadata_item(self, snapshot_id, id, meta_item):
"""Update metadata item for the snapshot."""
@@ -187,20 +189,21 @@
resp, body = self.put(url, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['meta']
+ return service_client.ResponseBody(resp, body['meta'])
def delete_snapshot_metadata_item(self, snapshot_id, id):
"""Delete metadata item for the snapshot."""
url = "snapshots/%s/metadata/%s" % (str(snapshot_id), str(id))
resp, body = self.delete(url)
self.expected_success(200, resp.status)
+ return service_client.ResponseBody(resp, body)
def force_delete_snapshot(self, snapshot_id):
"""Force Delete Snapshot."""
post_body = json.dumps({'os-force_delete': {}})
resp, body = self.post('snapshots/%s/action' % snapshot_id, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
class SnapshotsClientJSON(BaseSnapshotsClientJSON):
diff --git a/tempest/services/volume/json/volumes_client.py b/tempest/services/volume/json/volumes_client.py
index f19718e..c0f81fe 100644
--- a/tempest/services/volume/json/volumes_client.py
+++ b/tempest/services/volume/json/volumes_client.py
@@ -17,6 +17,7 @@
import time
import urllib
+from tempest.common import service_client
from tempest import config
from tempest import exceptions
from tempest.services.volume.json import base
@@ -44,7 +45,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['volumes']
+ return service_client.ResponseBodyList(resp, body['volumes'])
def list_volumes_with_detail(self, params=None):
"""List the details of all volumes."""
@@ -55,7 +56,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['volumes']
+ return service_client.ResponseBodyList(resp, body['volumes'])
def get_volume(self, volume_id):
"""Returns the details of a single volume."""
@@ -63,7 +64,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['volume']
+ return service_client.ResponseBody(resp, body['volume'])
def create_volume(self, size=None, **kwargs):
"""
@@ -87,7 +88,7 @@
resp, body = self.post('volumes', post_body)
body = json.loads(body)
self.expected_success(self.create_resp, resp.status)
- return resp, body['volume']
+ return service_client.ResponseBody(resp, body['volume'])
def update_volume(self, volume_id, **kwargs):
"""Updates the Specified Volume."""
@@ -95,12 +96,13 @@
resp, body = self.put('volumes/%s' % volume_id, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['volume']
+ return service_client.ResponseBody(resp, body['volume'])
def delete_volume(self, volume_id):
"""Deletes the Specified Volume."""
resp, body = self.delete("volumes/%s" % str(volume_id))
self.expected_success(202, resp.status)
+ return service_client.ResponseBody(resp, body)
def upload_volume(self, volume_id, image_name, disk_format):
"""Uploads a volume in Glance."""
@@ -113,7 +115,8 @@
resp, body = self.post(url, post_body)
body = json.loads(body)
self.expected_success(202, resp.status)
- return resp, body['os-volume_upload_image']
+ return service_client.ResponseBody(resp,
+ body['os-volume_upload_image'])
def attach_volume(self, volume_id, instance_uuid, mountpoint):
"""Attaches a volume to a given instance on a given mountpoint."""
@@ -125,7 +128,7 @@
url = 'volumes/%s/action' % (volume_id)
resp, body = self.post(url, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def detach_volume(self, volume_id):
"""Detaches a volume from an instance."""
@@ -134,7 +137,7 @@
url = 'volumes/%s/action' % (volume_id)
resp, body = self.post(url, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def reserve_volume(self, volume_id):
"""Reserves a volume."""
@@ -143,7 +146,7 @@
url = 'volumes/%s/action' % (volume_id)
resp, body = self.post(url, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def unreserve_volume(self, volume_id):
"""Restore a reserved volume ."""
@@ -152,17 +155,17 @@
url = 'volumes/%s/action' % (volume_id)
resp, body = self.post(url, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def wait_for_volume_status(self, volume_id, status):
"""Waits for a Volume to reach a given status."""
- resp, body = self.get_volume(volume_id)
+ body = self.get_volume(volume_id)
volume_status = body['status']
start = int(time.time())
while volume_status != status:
time.sleep(self.build_interval)
- resp, body = self.get_volume(volume_id)
+ body = self.get_volume(volume_id)
volume_status = body['status']
if volume_status == 'error':
raise exceptions.VolumeBuildErrorException(volume_id=volume_id)
@@ -197,14 +200,14 @@
url = 'volumes/%s/action' % (volume_id)
resp, body = self.post(url, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def reset_volume_status(self, volume_id, status):
"""Reset the Specified Volume's Status."""
post_body = json.dumps({'os-reset_status': {"status": status}})
resp, body = self.post('volumes/%s/action' % volume_id, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def volume_begin_detaching(self, volume_id):
"""Volume Begin Detaching."""
@@ -212,7 +215,7 @@
post_body = json.dumps({'os-begin_detaching': {}})
resp, body = self.post('volumes/%s/action' % volume_id, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def volume_roll_detaching(self, volume_id):
"""Volume Roll Detaching."""
@@ -220,7 +223,7 @@
post_body = json.dumps({'os-roll_detaching': {}})
resp, body = self.post('volumes/%s/action' % volume_id, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def create_volume_transfer(self, vol_id, display_name=None):
"""Create a volume transfer."""
@@ -233,7 +236,7 @@
resp, body = self.post('os-volume-transfer', post_body)
body = json.loads(body)
self.expected_success(202, resp.status)
- return resp, body['transfer']
+ return service_client.ResponseBody(resp, body['transfer'])
def get_volume_transfer(self, transfer_id):
"""Returns the details of a volume transfer."""
@@ -241,7 +244,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['transfer']
+ return service_client.ResponseBody(resp, body['transfer'])
def list_volume_transfers(self, params=None):
"""List all the volume transfers created."""
@@ -251,12 +254,13 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['transfers']
+ return service_client.ResponseBodyList(resp, body['transfers'])
def delete_volume_transfer(self, transfer_id):
"""Delete a volume transfer."""
resp, body = self.delete("os-volume-transfer/%s" % str(transfer_id))
self.expected_success(202, resp.status)
+ return service_client.ResponseBody(resp, body)
def accept_volume_transfer(self, transfer_id, transfer_auth_key):
"""Accept a volume transfer."""
@@ -268,7 +272,7 @@
resp, body = self.post(url, post_body)
body = json.loads(body)
self.expected_success(202, resp.status)
- return resp, body['transfer']
+ return service_client.ResponseBody(resp, body['transfer'])
def update_volume_readonly(self, volume_id, readonly):
"""Update the Specified Volume readonly."""
@@ -279,14 +283,14 @@
url = 'volumes/%s/action' % (volume_id)
resp, body = self.post(url, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def force_delete_volume(self, volume_id):
"""Force Delete Volume."""
post_body = json.dumps({'os-force_delete': {}})
resp, body = self.post('volumes/%s/action' % volume_id, post_body)
self.expected_success(202, resp.status)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def create_volume_metadata(self, volume_id, metadata):
"""Create metadata for the volume."""
@@ -295,7 +299,7 @@
resp, body = self.post(url, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['metadata']
+ return service_client.ResponseBody(resp, body['metadata'])
def get_volume_metadata(self, volume_id):
"""Get metadata of the volume."""
@@ -303,7 +307,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['metadata']
+ return service_client.ResponseBody(resp, body['metadata'])
def update_volume_metadata(self, volume_id, metadata):
"""Update metadata for the volume."""
@@ -312,7 +316,7 @@
resp, body = self.put(url, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['metadata']
+ return service_client.ResponseBody(resp, body['metadata'])
def update_volume_metadata_item(self, volume_id, id, meta_item):
"""Update metadata item for the volume."""
@@ -321,13 +325,14 @@
resp, body = self.put(url, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return resp, body['meta']
+ return service_client.ResponseBody(resp, body['meta'])
def delete_volume_metadata_item(self, volume_id, id):
"""Delete metadata item for the volume."""
url = "volumes/%s/metadata/%s" % (str(volume_id), str(id))
resp, body = self.delete(url)
self.expected_success(200, resp.status)
+ return service_client.ResponseBody(resp, body)
class VolumesClientJSON(BaseVolumesClientJSON):
diff --git a/tempest/stress/cleanup.py b/tempest/stress/cleanup.py
index 2587331..b494db6 100644
--- a/tempest/stress/cleanup.py
+++ b/tempest/stress/cleanup.py
@@ -63,13 +63,13 @@
except Exception:
pass
- _, users = admin_manager.identity_client.get_users()
+ users = admin_manager.identity_client.get_users()
LOG.info("Cleanup::remove %s users" % len(users))
for user in users:
if user['name'].startswith("stress_user"):
admin_manager.identity_client.delete_user(user['id'])
- _, tenants = admin_manager.identity_client.list_tenants()
+ tenants = admin_manager.identity_client.list_tenants()
LOG.info("Cleanup::remove %s tenants" % len(tenants))
for tenant in tenants:
if tenant['name'].startswith("stress_tenant"):
diff --git a/tempest/stress/driver.py b/tempest/stress/driver.py
index 642108a..49fac3d 100644
--- a/tempest/stress/driver.py
+++ b/tempest/stress/driver.py
@@ -143,7 +143,7 @@
tenant_name = data_utils.rand_name("stress_tenant")
password = "pass"
identity_client = admin_manager.identity_client
- _, tenant = identity_client.create_tenant(name=tenant_name)
+ tenant = identity_client.create_tenant(name=tenant_name)
identity_client.create_user(username,
password,
tenant['id'],
diff --git a/tempest/tests/cmd/test_verify_tempest_config.py b/tempest/tests/cmd/test_verify_tempest_config.py
index 65106cc..1abe29a 100644
--- a/tempest/tests/cmd/test_verify_tempest_config.py
+++ b/tempest/tests/cmd/test_verify_tempest_config.py
@@ -171,7 +171,7 @@
def test_verify_glance_version_no_v2_with_v1_1(self):
def fake_get_versions():
- return (None, ['v1.1'])
+ return (['v1.1'])
fake_os = mock.MagicMock()
fake_os.image_client.get_versions = fake_get_versions
with mock.patch.object(verify_tempest_config,
@@ -182,7 +182,7 @@
def test_verify_glance_version_no_v2_with_v1_0(self):
def fake_get_versions():
- return (None, ['v1.0'])
+ return (['v1.0'])
fake_os = mock.MagicMock()
fake_os.image_client.get_versions = fake_get_versions
with mock.patch.object(verify_tempest_config,
@@ -193,7 +193,7 @@
def test_verify_glance_version_no_v1(self):
def fake_get_versions():
- return (None, ['v2.0'])
+ return (['v2.0'])
fake_os = mock.MagicMock()
fake_os.image_client.get_versions = fake_get_versions
with mock.patch.object(verify_tempest_config,
@@ -243,9 +243,9 @@
def test_verify_extensions_cinder(self):
def fake_list_extensions():
- return (None, {'extensions': [{'alias': 'fake1'},
- {'alias': 'fake2'},
- {'alias': 'not_fake'}]})
+ return {'extensions': [{'alias': 'fake1'},
+ {'alias': 'fake2'},
+ {'alias': 'not_fake'}]}
fake_os = mock.MagicMock()
fake_os.volumes_extension_client.list_extensions = fake_list_extensions
self.useFixture(mockpatch.PatchObject(
@@ -265,9 +265,9 @@
def test_verify_extensions_cinder_all(self):
def fake_list_extensions():
- return (None, {'extensions': [{'alias': 'fake1'},
- {'alias': 'fake2'},
- {'alias': 'not_fake'}]})
+ return {'extensions': [{'alias': 'fake1'},
+ {'alias': 'fake2'},
+ {'alias': 'not_fake'}]}
fake_os = mock.MagicMock()
fake_os.volumes_extension_client.list_extensions = fake_list_extensions
self.useFixture(mockpatch.PatchObject(
diff --git a/tempest/tests/common/test_accounts.py b/tempest/tests/common/test_accounts.py
index cf7ce65..0800b47 100644
--- a/tempest/tests/common/test_accounts.py
+++ b/tempest/tests/common/test_accounts.py
@@ -22,9 +22,9 @@
from tempest import auth
from tempest.common import accounts
-from tempest.common import http
from tempest import config
from tempest import exceptions
+from tempest.services.identity.json import identity_client
from tempest.tests import base
from tempest.tests import fake_config
from tempest.tests import fake_identity
@@ -68,7 +68,7 @@
return hash_list
def test_get_hash(self):
- self.stubs.Set(http.ClosingHttp, 'request',
+ self.stubs.Set(identity_client.TokenClientJSON, 'raw_request',
fake_identity._fake_v2_response)
test_account_class = accounts.Accounts('test_name')
hash_list = self._get_hash_list(self.test_accounts)
diff --git a/tempest/tests/common/test_service_clients.py b/tempest/tests/common/test_service_clients.py
new file mode 100644
index 0000000..d368e87
--- /dev/null
+++ b/tempest/tests/common/test_service_clients.py
@@ -0,0 +1,112 @@
+# Copyright 2015 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 mock
+import random
+import six
+
+from tempest.services.compute.json import agents_client
+from tempest.services.compute.json import aggregates_client
+from tempest.services.compute.json import availability_zone_client
+from tempest.services.compute.json import certificates_client
+from tempest.services.compute.json import extensions_client
+from tempest.services.compute.json import fixed_ips_client
+from tempest.services.compute.json import flavors_client
+from tempest.services.compute.json import floating_ips_client
+from tempest.services.compute.json import hosts_client
+from tempest.services.compute.json import hypervisor_client
+from tempest.services.compute.json import images_client
+from tempest.services.compute.json import instance_usage_audit_log_client
+from tempest.services.compute.json import interfaces_client
+from tempest.services.compute.json import keypairs_client
+from tempest.services.compute.json import limits_client
+from tempest.services.compute.json import migrations_client
+from tempest.services.compute.json import networks_client as nova_net_client
+from tempest.services.compute.json import quotas_client
+from tempest.services.compute.json import security_group_default_rules_client \
+ as nova_secgrop_default_client
+from tempest.services.compute.json import security_groups_client
+from tempest.services.compute.json import servers_client
+from tempest.services.compute.json import services_client
+from tempest.services.compute.json import tenant_usages_client
+from tempest.services.compute.json import volumes_extensions_client
+from tempest.services.database.json import flavors_client as db_flavor_client
+from tempest.services.database.json import versions_client as db_version_client
+from tempest.services.messaging.json import messaging_client
+from tempest.services.network.json import network_client
+from tempest.services.object_storage import account_client
+from tempest.services.object_storage import container_client
+from tempest.services.object_storage import object_client
+from tempest.services.orchestration.json import orchestration_client
+from tempest.services.telemetry.json import telemetry_client
+from tempest.tests import base
+
+
+class TestServiceClient(base.TestCase):
+
+ @mock.patch('tempest_lib.common.rest_client.RestClient.__init__')
+ def test_service_client_creations_with_specified_args(self, mock_init):
+ test_clients = [
+ agents_client.AgentsClientJSON,
+ aggregates_client.AggregatesClientJSON,
+ availability_zone_client.AvailabilityZoneClientJSON,
+ certificates_client.CertificatesClientJSON,
+ extensions_client.ExtensionsClientJSON,
+ fixed_ips_client.FixedIPsClientJSON,
+ flavors_client.FlavorsClientJSON,
+ floating_ips_client.FloatingIPsClientJSON,
+ hosts_client.HostsClientJSON,
+ hypervisor_client.HypervisorClientJSON,
+ images_client.ImagesClientJSON,
+ instance_usage_audit_log_client.InstanceUsagesAuditLogClientJSON,
+ interfaces_client.InterfacesClientJSON,
+ keypairs_client.KeyPairsClientJSON,
+ limits_client.LimitsClientJSON,
+ migrations_client.MigrationsClientJSON,
+ nova_net_client.NetworksClientJSON,
+ quotas_client.QuotasClientJSON,
+ quotas_client.QuotaClassesClientJSON,
+ nova_secgrop_default_client.SecurityGroupDefaultRulesClientJSON,
+ security_groups_client.SecurityGroupsClientJSON,
+ servers_client.ServersClientJSON,
+ services_client.ServicesClientJSON,
+ tenant_usages_client.TenantUsagesClientJSON,
+ volumes_extensions_client.VolumesExtensionsClientJSON,
+ db_flavor_client.DatabaseFlavorsClientJSON,
+ db_version_client.DatabaseVersionsClientJSON,
+ messaging_client.MessagingClientJSON,
+ network_client.NetworkClientJSON,
+ account_client.AccountClient,
+ container_client.ContainerClient,
+ object_client.ObjectClient,
+ orchestration_client.OrchestrationClient,
+ telemetry_client.TelemetryClientJSON]
+
+ for client in test_clients:
+ fake_string = six.text_type(random.randint(1, 0x7fffffff))
+ auth = 'auth' + fake_string
+ service = 'service' + fake_string
+ region = 'region' + fake_string
+ params = {
+ 'endpoint_type': 'URL' + fake_string,
+ 'build_interval': random.randint(1, 100),
+ 'build_timeout': random.randint(1, 100),
+ 'disable_ssl_certificate_validation':
+ True if random.randint(0, 1) else False,
+ 'ca_certs': None,
+ 'trace_requests': 'foo' + fake_string
+ }
+ client(auth, service, region, **params)
+ mock_init.assert_called_once_with(auth, service, region, **params)
+ mock_init.reset_mock()
diff --git a/tempest/tests/fake_auth_provider.py b/tempest/tests/fake_auth_provider.py
index 44c331e..bc68d26 100644
--- a/tempest/tests/fake_auth_provider.py
+++ b/tempest/tests/fake_auth_provider.py
@@ -13,16 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.tests import fake_credentials
-
-
-def get_default_credentials(credential_type, fill_in=True):
- return fake_credentials.FakeCredentials()
-
-
-def get_credentials(credential_type=None, fill_in=True, **kwargs):
- return fake_credentials.FakeCredentials()
-
class FakeAuthProvider(object):
diff --git a/tempest/tests/fake_config.py b/tempest/tests/fake_config.py
index 9e56916..2f8efa1 100644
--- a/tempest/tests/fake_config.py
+++ b/tempest/tests/fake_config.py
@@ -52,9 +52,6 @@
self.conf.set_default(prefix + config_option,
'fake_' + config_option,
group='identity')
- # Compute Admin group items
- self.conf.set_default(config_option, 'fake_' + config_option,
- group='compute-admin')
class FakePrivate(config.TempestConfigPrivate):
diff --git a/tempest/tests/test_auth.py b/tempest/tests/test_auth.py
index 6a2e335..a191781 100644
--- a/tempest/tests/test_auth.py
+++ b/tempest/tests/test_auth.py
@@ -19,17 +19,25 @@
from oslotest import mockpatch
from tempest import auth
-from tempest.common import http
from tempest import config
from tempest import exceptions
+from tempest.services.identity.json import identity_client as v2_client
+from tempest.services.identity.v3.json import identity_client as v3_client
from tempest.tests import base
-from tempest.tests import fake_auth_provider
from tempest.tests import fake_config
from tempest.tests import fake_credentials
from tempest.tests import fake_http
from tempest.tests import fake_identity
+def fake_get_default_credentials(credential_type, fill_in=True):
+ return fake_credentials.FakeCredentials()
+
+
+def fake_get_credentials(credential_type=None, fill_in=True, **kwargs):
+ return fake_credentials.FakeCredentials()
+
+
class BaseAuthTestsSetUp(base.TestCase):
_auth_provider_class = None
credentials = fake_credentials.FakeCredentials()
@@ -45,11 +53,9 @@
self.useFixture(fake_config.ConfigFixture())
self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
self.fake_http = fake_http.fake_httplib2(return_type=200)
- self.stubs.Set(http.ClosingHttp, 'request', self.fake_http.request)
- self.stubs.Set(auth, 'get_credentials',
- fake_auth_provider.get_credentials)
+ self.stubs.Set(auth, 'get_credentials', fake_get_credentials)
self.stubs.Set(auth, 'get_default_credentials',
- fake_auth_provider.get_default_credentials)
+ fake_get_default_credentials)
self.auth_provider = self._auth(self.credentials)
@@ -125,7 +131,7 @@
def setUp(self):
super(TestKeystoneV2AuthProvider, self).setUp()
- self.stubs.Set(http.ClosingHttp, 'request',
+ self.stubs.Set(v2_client.TokenClientJSON, 'raw_request',
fake_identity._fake_v2_response)
self.target_url = 'test_api'
@@ -346,7 +352,7 @@
def setUp(self):
super(TestKeystoneV3AuthProvider, self).setUp()
- self.stubs.Set(http.ClosingHttp, 'request',
+ self.stubs.Set(v3_client.V3TokenClientJSON, 'raw_request',
fake_identity._fake_v3_response)
def _get_fake_alt_identity(self):
diff --git a/tempest/tests/test_credentials.py b/tempest/tests/test_credentials.py
index fc80fe2..1abb941 100644
--- a/tempest/tests/test_credentials.py
+++ b/tempest/tests/test_credentials.py
@@ -18,10 +18,11 @@
from oslo.config import cfg
from tempest import auth
-from tempest.common import http
from tempest.common import tempest_fixtures as fixtures
from tempest import config
from tempest import exceptions
+from tempest.services.identity.json import identity_client as v2_client
+from tempest.services.identity.v3.json import identity_client as v3_client
from tempest.tests import base
from tempest.tests import fake_config
from tempest.tests import fake_identity
@@ -76,10 +77,12 @@
identity_response = fake_identity._fake_v2_response
credentials_class = auth.KeystoneV2Credentials
+ tokenclient_class = v2_client.TokenClientJSON
def setUp(self):
super(KeystoneV2CredentialsTests, self).setUp()
- self.stubs.Set(http.ClosingHttp, 'request', self.identity_response)
+ self.stubs.Set(self.tokenclient_class, 'raw_request',
+ self.identity_response)
def _verify_credentials(self, credentials_class, filled=True,
creds_dict=None):
@@ -185,6 +188,7 @@
credentials_class = auth.KeystoneV3Credentials
identity_response = fake_identity._fake_v3_response
+ tokenclient_class = v3_client.V3TokenClientJSON
def setUp(self):
super(KeystoneV3CredentialsTests, self).setUp()
@@ -194,9 +198,6 @@
for prefix in ['', 'alt_', 'admin_']:
cfg.CONF.set_default(prefix + 'domain_name', 'fake_domain_name',
group='identity')
- # Compute Admin group items
- cfg.CONF.set_default('domain_name', 'fake_domain_name',
- group='compute-admin')
def test_default(self):
self.useFixture(fixtures.LockFixture('auth_version'))
diff --git a/tempest/tests/test_glance_http.py b/tempest/tests/test_glance_http.py
index 9a6c9de..c92a886 100644
--- a/tempest/tests/test_glance_http.py
+++ b/tempest/tests/test_glance_http.py
@@ -171,7 +171,7 @@
def test_get_connection_kwargs_set_timeout_for_http(self):
kwargs = self.client.get_connection_kwargs('http', timeout=10,
- cacert='foo')
+ ca_certs='foo')
self.assertEqual(10, kwargs['timeout'])
# nothing more than timeout is evaluated for http connections
self.assertEqual(1, len(kwargs.keys()))
@@ -179,7 +179,7 @@
def test_get_connection_kwargs_default_for_https(self):
kwargs = self.client.get_connection_kwargs('https')
self.assertEqual(600, kwargs['timeout'])
- self.assertEqual(None, kwargs['cacert'])
+ self.assertEqual(None, kwargs['ca_certs'])
self.assertEqual(None, kwargs['cert_file'])
self.assertEqual(None, kwargs['key_file'])
self.assertEqual(False, kwargs['insecure'])
@@ -188,13 +188,13 @@
def test_get_connection_kwargs_set_params_for_https(self):
kwargs = self.client.get_connection_kwargs('https', timeout=10,
- cacert='foo',
+ ca_certs='foo',
cert_file='/foo/bar.cert',
key_file='/foo/key.pem',
insecure=True,
ssl_compression=False)
self.assertEqual(10, kwargs['timeout'])
- self.assertEqual('foo', kwargs['cacert'])
+ self.assertEqual('foo', kwargs['ca_certs'])
self.assertEqual('/foo/bar.cert', kwargs['cert_file'])
self.assertEqual('/foo/key.pem', kwargs['key_file'])
self.assertEqual(True, kwargs['insecure'])
diff --git a/tempest/tests/test_list_tests.py b/tempest/tests/test_list_tests.py
index efdb413..19e4c9c 100644
--- a/tempest/tests/test_list_tests.py
+++ b/tempest/tests/test_list_tests.py
@@ -31,7 +31,7 @@
ids, err = p.communicate()
self.assertEqual(0, p.returncode,
"test discovery failed, one or more files cause an "
- "error on import")
+ "error on import %s" % ids)
ids = ids.split('\n')
for test_id in ids:
if re.match('(\w+\.){3}\w+', test_id):
diff --git a/tempest/tests/test_negative_rest_client.py b/tempest/tests/test_negative_rest_client.py
new file mode 100644
index 0000000..ce95739
--- /dev/null
+++ b/tempest/tests/test_negative_rest_client.py
@@ -0,0 +1,91 @@
+# (c) 2015 Deutsche Telekom AG
+# Copyright 2015 Red Hat, Inc.
+# Copyright 2015 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 httplib2
+from oslotest import mockpatch
+
+from tempest.common import negative_rest_client
+from tempest import config
+from tempest.tests import base
+from tempest.tests import fake_auth_provider
+from tempest.tests import fake_config
+from tempest.tests import fake_http
+
+
+class TestNegativeRestClient(base.TestCase):
+
+ url = 'fake_endpoint'
+
+ def setUp(self):
+ self.fake_http = fake_http.fake_httplib2()
+ super(TestNegativeRestClient, self).setUp()
+ self.useFixture(fake_config.ConfigFixture())
+ self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
+ self.stubs.Set(httplib2.Http, 'request', self.fake_http.request)
+ self.negative_rest_client = negative_rest_client.NegativeRestClient(
+ fake_auth_provider.FakeAuthProvider(), None)
+ self.useFixture(mockpatch.PatchObject(self.negative_rest_client,
+ '_log_request'))
+
+ def test_post(self):
+ __, return_dict = self.negative_rest_client.send_request('POST',
+ self.url,
+ [], {})
+ self.assertEqual('POST', return_dict['method'])
+
+ def test_get(self):
+ __, return_dict = self.negative_rest_client.send_request('GET',
+ self.url,
+ [])
+ self.assertEqual('GET', return_dict['method'])
+
+ def test_delete(self):
+ __, return_dict = self.negative_rest_client.send_request('DELETE',
+ self.url,
+ [])
+ self.assertEqual('DELETE', return_dict['method'])
+
+ def test_patch(self):
+ __, return_dict = self.negative_rest_client.send_request('PATCH',
+ self.url,
+ [], {})
+ self.assertEqual('PATCH', return_dict['method'])
+
+ def test_put(self):
+ __, return_dict = self.negative_rest_client.send_request('PUT',
+ self.url,
+ [], {})
+ self.assertEqual('PUT', return_dict['method'])
+
+ def test_head(self):
+ self.useFixture(mockpatch.PatchObject(self.negative_rest_client,
+ 'response_checker'))
+ __, return_dict = self.negative_rest_client.send_request('HEAD',
+ self.url,
+ [])
+ self.assertEqual('HEAD', return_dict['method'])
+
+ def test_copy(self):
+ __, return_dict = self.negative_rest_client.send_request('COPY',
+ self.url,
+ [])
+ self.assertEqual('COPY', return_dict['method'])
+
+ def test_other(self):
+ self.assertRaises(AssertionError,
+ self.negative_rest_client.send_request,
+ 'OTHER', self.url, [])
diff --git a/tempest/tests/test_rest_client.py b/tempest/tests/test_rest_client.py
deleted file mode 100644
index 5b2ce7a..0000000
--- a/tempest/tests/test_rest_client.py
+++ /dev/null
@@ -1,535 +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 json
-
-import httplib2
-from oslotest import mockpatch
-
-from tempest.common import rest_client
-from tempest import config
-from tempest import exceptions
-from tempest.tests import base
-from tempest.tests import fake_auth_provider
-from tempest.tests import fake_config
-from tempest.tests import fake_http
-
-
-class BaseRestClientTestClass(base.TestCase):
-
- url = 'fake_endpoint'
-
- def _get_region(self):
- return 'fake region'
-
- def setUp(self):
- super(BaseRestClientTestClass, self).setUp()
- self.useFixture(fake_config.ConfigFixture())
- self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
- self.rest_client = rest_client.RestClient(
- fake_auth_provider.FakeAuthProvider())
- self.stubs.Set(httplib2.Http, 'request', self.fake_http.request)
- self.useFixture(mockpatch.PatchObject(self.rest_client, '_get_region',
- side_effect=self._get_region()))
- self.useFixture(mockpatch.PatchObject(self.rest_client,
- '_log_request'))
-
-
-class TestRestClientHTTPMethods(BaseRestClientTestClass):
- def setUp(self):
- self.fake_http = fake_http.fake_httplib2()
- super(TestRestClientHTTPMethods, self).setUp()
- self.useFixture(mockpatch.PatchObject(self.rest_client,
- '_error_checker'))
-
- def test_post(self):
- __, return_dict = self.rest_client.post(self.url, {}, {})
- self.assertEqual('POST', return_dict['method'])
-
- def test_get(self):
- __, return_dict = self.rest_client.get(self.url)
- self.assertEqual('GET', return_dict['method'])
-
- def test_delete(self):
- __, return_dict = self.rest_client.delete(self.url)
- self.assertEqual('DELETE', return_dict['method'])
-
- def test_patch(self):
- __, return_dict = self.rest_client.patch(self.url, {}, {})
- self.assertEqual('PATCH', return_dict['method'])
-
- def test_put(self):
- __, return_dict = self.rest_client.put(self.url, {}, {})
- self.assertEqual('PUT', return_dict['method'])
-
- def test_head(self):
- self.useFixture(mockpatch.PatchObject(self.rest_client,
- 'response_checker'))
- __, return_dict = self.rest_client.head(self.url)
- self.assertEqual('HEAD', return_dict['method'])
-
- def test_copy(self):
- __, return_dict = self.rest_client.copy(self.url)
- self.assertEqual('COPY', return_dict['method'])
-
-
-class TestRestClientNotFoundHandling(BaseRestClientTestClass):
- def setUp(self):
- self.fake_http = fake_http.fake_httplib2(404)
- super(TestRestClientNotFoundHandling, self).setUp()
-
- def test_post(self):
- self.assertRaises(exceptions.NotFound, self.rest_client.post,
- self.url, {}, {})
-
-
-class TestRestClientHeadersJSON(TestRestClientHTTPMethods):
- TYPE = "json"
-
- def _verify_headers(self, resp):
- self.assertEqual(self.rest_client._get_type(), self.TYPE)
- resp = dict((k.lower(), v) for k, v in resp.iteritems())
- self.assertEqual(self.header_value, resp['accept'])
- self.assertEqual(self.header_value, resp['content-type'])
-
- def setUp(self):
- super(TestRestClientHeadersJSON, self).setUp()
- self.rest_client.TYPE = self.TYPE
- self.header_value = 'application/%s' % self.rest_client._get_type()
-
- def test_post(self):
- resp, __ = self.rest_client.post(self.url, {})
- self._verify_headers(resp)
-
- def test_get(self):
- resp, __ = self.rest_client.get(self.url)
- self._verify_headers(resp)
-
- def test_delete(self):
- resp, __ = self.rest_client.delete(self.url)
- self._verify_headers(resp)
-
- def test_patch(self):
- resp, __ = self.rest_client.patch(self.url, {})
- self._verify_headers(resp)
-
- def test_put(self):
- resp, __ = self.rest_client.put(self.url, {})
- self._verify_headers(resp)
-
- def test_head(self):
- self.useFixture(mockpatch.PatchObject(self.rest_client,
- 'response_checker'))
- resp, __ = self.rest_client.head(self.url)
- self._verify_headers(resp)
-
- def test_copy(self):
- resp, __ = self.rest_client.copy(self.url)
- self._verify_headers(resp)
-
-
-class TestRestClientUpdateHeaders(BaseRestClientTestClass):
- def setUp(self):
- self.fake_http = fake_http.fake_httplib2()
- super(TestRestClientUpdateHeaders, self).setUp()
- self.useFixture(mockpatch.PatchObject(self.rest_client,
- '_error_checker'))
- self.headers = {'X-Configuration-Session': 'session_id'}
-
- def test_post_update_headers(self):
- __, return_dict = self.rest_client.post(self.url, {},
- extra_headers=True,
- headers=self.headers)
-
- self.assertDictContainsSubset(
- {'X-Configuration-Session': 'session_id',
- 'Content-Type': 'application/json',
- 'Accept': 'application/json'},
- return_dict['headers']
- )
-
- def test_get_update_headers(self):
- __, return_dict = self.rest_client.get(self.url,
- extra_headers=True,
- headers=self.headers)
-
- self.assertDictContainsSubset(
- {'X-Configuration-Session': 'session_id',
- 'Content-Type': 'application/json',
- 'Accept': 'application/json'},
- return_dict['headers']
- )
-
- def test_delete_update_headers(self):
- __, return_dict = self.rest_client.delete(self.url,
- extra_headers=True,
- headers=self.headers)
-
- self.assertDictContainsSubset(
- {'X-Configuration-Session': 'session_id',
- 'Content-Type': 'application/json',
- 'Accept': 'application/json'},
- return_dict['headers']
- )
-
- def test_patch_update_headers(self):
- __, return_dict = self.rest_client.patch(self.url, {},
- extra_headers=True,
- headers=self.headers)
-
- self.assertDictContainsSubset(
- {'X-Configuration-Session': 'session_id',
- 'Content-Type': 'application/json',
- 'Accept': 'application/json'},
- return_dict['headers']
- )
-
- def test_put_update_headers(self):
- __, return_dict = self.rest_client.put(self.url, {},
- extra_headers=True,
- headers=self.headers)
-
- self.assertDictContainsSubset(
- {'X-Configuration-Session': 'session_id',
- 'Content-Type': 'application/json',
- 'Accept': 'application/json'},
- return_dict['headers']
- )
-
- def test_head_update_headers(self):
- self.useFixture(mockpatch.PatchObject(self.rest_client,
- 'response_checker'))
-
- __, return_dict = self.rest_client.head(self.url,
- extra_headers=True,
- headers=self.headers)
-
- self.assertDictContainsSubset(
- {'X-Configuration-Session': 'session_id',
- 'Content-Type': 'application/json',
- 'Accept': 'application/json'},
- return_dict['headers']
- )
-
- def test_copy_update_headers(self):
- __, return_dict = self.rest_client.copy(self.url,
- extra_headers=True,
- headers=self.headers)
-
- self.assertDictContainsSubset(
- {'X-Configuration-Session': 'session_id',
- 'Content-Type': 'application/json',
- 'Accept': 'application/json'},
- return_dict['headers']
- )
-
-
-class TestRestClientParseRespJSON(BaseRestClientTestClass):
- TYPE = "json"
-
- keys = ["fake_key1", "fake_key2"]
- values = ["fake_value1", "fake_value2"]
- item_expected = dict((key, value) for (key, value) in zip(keys, values))
- list_expected = {"body_list": [
- {keys[0]: values[0]},
- {keys[1]: values[1]},
- ]}
- dict_expected = {"body_dict": {
- keys[0]: values[0],
- keys[1]: values[1],
- }}
-
- def setUp(self):
- self.fake_http = fake_http.fake_httplib2()
- super(TestRestClientParseRespJSON, self).setUp()
- self.rest_client.TYPE = self.TYPE
-
- def test_parse_resp_body_item(self):
- body = self.rest_client._parse_resp(json.dumps(self.item_expected))
- self.assertEqual(self.item_expected, body)
-
- def test_parse_resp_body_list(self):
- body = self.rest_client._parse_resp(json.dumps(self.list_expected))
- self.assertEqual(self.list_expected["body_list"], body)
-
- def test_parse_resp_body_dict(self):
- body = self.rest_client._parse_resp(json.dumps(self.dict_expected))
- self.assertEqual(self.dict_expected["body_dict"], body)
-
- def test_parse_resp_two_top_keys(self):
- dict_two_keys = self.dict_expected.copy()
- dict_two_keys.update({"second_key": ""})
- body = self.rest_client._parse_resp(json.dumps(dict_two_keys))
- self.assertEqual(dict_two_keys, body)
-
- def test_parse_resp_one_top_key_without_list_or_dict(self):
- data = {"one_top_key": "not_list_or_dict_value"}
- body = self.rest_client._parse_resp(json.dumps(data))
- self.assertEqual(data, body)
-
-
-class TestRestClientErrorCheckerJSON(base.TestCase):
- c_type = "application/json"
-
- def set_data(self, r_code, enc=None, r_body=None):
- if enc is None:
- enc = self.c_type
- resp_dict = {'status': r_code, 'content-type': enc}
- resp = httplib2.Response(resp_dict)
- data = {
- "method": "fake_method",
- "url": "fake_url",
- "headers": "fake_headers",
- "body": "fake_body",
- "resp": resp,
- "resp_body": '{"resp_body": "fake_resp_body"}',
- }
- if r_body is not None:
- data.update({"resp_body": r_body})
- return data
-
- def setUp(self):
- super(TestRestClientErrorCheckerJSON, self).setUp()
- self.useFixture(fake_config.ConfigFixture())
- self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
- self.rest_client = rest_client.RestClient(
- fake_auth_provider.FakeAuthProvider())
-
- def test_response_less_than_400(self):
- self.rest_client._error_checker(**self.set_data("399"))
-
- def test_response_400(self):
- self.assertRaises(exceptions.BadRequest,
- self.rest_client._error_checker,
- **self.set_data("400"))
-
- def test_response_401(self):
- self.assertRaises(exceptions.Unauthorized,
- self.rest_client._error_checker,
- **self.set_data("401"))
-
- def test_response_403(self):
- self.assertRaises(exceptions.Unauthorized,
- self.rest_client._error_checker,
- **self.set_data("403"))
-
- def test_response_404(self):
- self.assertRaises(exceptions.NotFound,
- self.rest_client._error_checker,
- **self.set_data("404"))
-
- def test_response_409(self):
- self.assertRaises(exceptions.Conflict,
- self.rest_client._error_checker,
- **self.set_data("409"))
-
- def test_response_413(self):
- self.assertRaises(exceptions.OverLimit,
- self.rest_client._error_checker,
- **self.set_data("413"))
-
- def test_response_422(self):
- self.assertRaises(exceptions.UnprocessableEntity,
- self.rest_client._error_checker,
- **self.set_data("422"))
-
- def test_response_500_with_text(self):
- # _parse_resp is expected to return 'str'
- self.assertRaises(exceptions.ServerFault,
- self.rest_client._error_checker,
- **self.set_data("500"))
-
- def test_response_501_with_text(self):
- self.assertRaises(exceptions.NotImplemented,
- self.rest_client._error_checker,
- **self.set_data("501"))
-
- def test_response_500_with_dict(self):
- r_body = '{"resp_body": {"err": "fake_resp_body"}}'
- self.assertRaises(exceptions.ServerFault,
- self.rest_client._error_checker,
- **self.set_data("500", r_body=r_body))
-
- def test_response_501_with_dict(self):
- r_body = '{"resp_body": {"err": "fake_resp_body"}}'
- self.assertRaises(exceptions.NotImplemented,
- self.rest_client._error_checker,
- **self.set_data("501", r_body=r_body))
-
- def test_response_bigger_than_400(self):
- # Any response code, that bigger than 400, and not in
- # (401, 403, 404, 409, 413, 422, 500, 501)
- self.assertRaises(exceptions.UnexpectedResponseCode,
- self.rest_client._error_checker,
- **self.set_data("402"))
-
-
-class TestRestClientErrorCheckerTEXT(TestRestClientErrorCheckerJSON):
- c_type = "text/plain"
-
- def test_fake_content_type(self):
- # This test is required only in one exemplar
- # Any response code, that bigger than 400, and not in
- # (401, 403, 404, 409, 413, 422, 500, 501)
- self.assertRaises(exceptions.InvalidContentType,
- self.rest_client._error_checker,
- **self.set_data("405", enc="fake_enc"))
-
-
-class TestRestClientUtils(BaseRestClientTestClass):
-
- def _is_resource_deleted(self, resource_id):
- if not isinstance(self.retry_pass, int):
- return False
- if self.retry_count >= self.retry_pass:
- return True
- self.retry_count = self.retry_count + 1
- return False
-
- def setUp(self):
- self.fake_http = fake_http.fake_httplib2()
- super(TestRestClientUtils, self).setUp()
- self.retry_count = 0
- self.retry_pass = None
- self.original_deleted_method = self.rest_client.is_resource_deleted
- self.rest_client.is_resource_deleted = self._is_resource_deleted
-
- def test_wait_for_resource_deletion(self):
- self.retry_pass = 2
- # Ensure timeout long enough for loop execution to hit retry count
- self.rest_client.build_timeout = 500
- sleep_mock = self.patch('time.sleep')
- self.rest_client.wait_for_resource_deletion('1234')
- self.assertEqual(len(sleep_mock.mock_calls), 2)
-
- def test_wait_for_resource_deletion_not_deleted(self):
- self.patch('time.sleep')
- # Set timeout to be very quick to force exception faster
- self.rest_client.build_timeout = 1
- self.assertRaises(exceptions.TimeoutException,
- self.rest_client.wait_for_resource_deletion,
- '1234')
-
- def test_wait_for_deletion_with_unimplemented_deleted_method(self):
- self.rest_client.is_resource_deleted = self.original_deleted_method
- self.assertRaises(NotImplementedError,
- self.rest_client.wait_for_resource_deletion,
- '1234')
-
-
-class TestNegativeRestClient(BaseRestClientTestClass):
-
- def setUp(self):
- self.fake_http = fake_http.fake_httplib2()
- super(TestNegativeRestClient, self).setUp()
- self.negative_rest_client = rest_client.NegativeRestClient(
- fake_auth_provider.FakeAuthProvider())
- self.useFixture(mockpatch.PatchObject(self.negative_rest_client,
- '_log_request'))
-
- def test_post(self):
- __, return_dict = self.negative_rest_client.send_request('POST',
- self.url,
- [], {})
- self.assertEqual('POST', return_dict['method'])
-
- def test_get(self):
- __, return_dict = self.negative_rest_client.send_request('GET',
- self.url,
- [])
- self.assertEqual('GET', return_dict['method'])
-
- def test_delete(self):
- __, return_dict = self.negative_rest_client.send_request('DELETE',
- self.url,
- [])
- self.assertEqual('DELETE', return_dict['method'])
-
- def test_patch(self):
- __, return_dict = self.negative_rest_client.send_request('PATCH',
- self.url,
- [], {})
- self.assertEqual('PATCH', return_dict['method'])
-
- def test_put(self):
- __, return_dict = self.negative_rest_client.send_request('PUT',
- self.url,
- [], {})
- self.assertEqual('PUT', return_dict['method'])
-
- def test_head(self):
- self.useFixture(mockpatch.PatchObject(self.negative_rest_client,
- 'response_checker'))
- __, return_dict = self.negative_rest_client.send_request('HEAD',
- self.url,
- [])
- self.assertEqual('HEAD', return_dict['method'])
-
- def test_copy(self):
- __, return_dict = self.negative_rest_client.send_request('COPY',
- self.url,
- [])
- self.assertEqual('COPY', return_dict['method'])
-
- def test_other(self):
- self.assertRaises(AssertionError,
- self.negative_rest_client.send_request,
- 'OTHER', self.url, [])
-
-
-class TestExpectedSuccess(BaseRestClientTestClass):
-
- def setUp(self):
- self.fake_http = fake_http.fake_httplib2()
- super(TestExpectedSuccess, self).setUp()
-
- def test_expected_succes_int_match(self):
- expected_code = 202
- read_code = 202
- resp = self.rest_client.expected_success(expected_code, read_code)
- # Assert None resp on success
- self.assertFalse(resp)
-
- def test_expected_succes_int_no_match(self):
- expected_code = 204
- read_code = 202
- self.assertRaises(exceptions.InvalidHttpSuccessCode,
- self.rest_client.expected_success,
- expected_code, read_code)
-
- def test_expected_succes_list_match(self):
- expected_code = [202, 204]
- read_code = 202
- resp = self.rest_client.expected_success(expected_code, read_code)
- # Assert None resp on success
- self.assertFalse(resp)
-
- def test_expected_succes_list_no_match(self):
- expected_code = [202, 204]
- read_code = 200
- self.assertRaises(exceptions.InvalidHttpSuccessCode,
- self.rest_client.expected_success,
- expected_code, read_code)
-
- def test_non_success_expected_int(self):
- expected_code = 404
- read_code = 202
- self.assertRaises(AssertionError, self.rest_client.expected_success,
- expected_code, read_code)
-
- def test_non_success_expected_list(self):
- expected_code = [404, 202]
- read_code = 202
- self.assertRaises(AssertionError, self.rest_client.expected_success,
- expected_code, read_code)
diff --git a/tempest/tests/test_tenant_isolation.py b/tempest/tests/test_tenant_isolation.py
index 053dae1..58a8060 100644
--- a/tempest/tests/test_tenant_isolation.py
+++ b/tempest/tests/test_tenant_isolation.py
@@ -15,8 +15,8 @@
import mock
from oslo.config import cfg
-from tempest.common import http
from tempest.common import isolated_creds
+from tempest.common import service_client
from tempest import config
from tempest import exceptions
from tempest.openstack.common.fixture import mockpatch
@@ -35,7 +35,7 @@
self.useFixture(fake_config.ConfigFixture())
self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
self.fake_http = fake_http.fake_httplib2(return_type=200)
- self.stubs.Set(http.ClosingHttp, 'request',
+ self.stubs.Set(json_iden_client.TokenClientJSON, 'raw_request',
fake_identity._fake_v2_response)
cfg.CONF.set_default('operator_role', 'FakeRole',
group='object-storage')
@@ -51,41 +51,42 @@
user_fix = self.useFixture(mockpatch.PatchObject(
json_iden_client.IdentityClientJSON,
'create_user',
- return_value=({'status': 200},
- {'id': id, 'name': name})))
+ return_value=(service_client.ResponseBody
+ (200, {'id': id, 'name': name}))))
return user_fix
def _mock_tenant_create(self, id, name):
tenant_fix = self.useFixture(mockpatch.PatchObject(
json_iden_client.IdentityClientJSON,
'create_tenant',
- return_value=({'status': 200},
- {'id': id, 'name': name})))
+ return_value=(service_client.ResponseBody
+ (200, {'id': id, 'name': name}))))
return tenant_fix
def _mock_list_roles(self, id, name):
roles_fix = self.useFixture(mockpatch.PatchObject(
json_iden_client.IdentityClientJSON,
'list_roles',
- return_value=({'status': 200},
- [{'id': id, 'name': name},
- {'id': '1', 'name': 'FakeRole'}])))
+ return_value=(service_client.ResponseBodyList
+ (200,
+ [{'id': id, 'name': name},
+ {'id': '1', 'name': 'FakeRole'}]))))
return roles_fix
def _mock_assign_user_role(self):
tenant_fix = self.useFixture(mockpatch.PatchObject(
json_iden_client.IdentityClientJSON,
'assign_user_role',
- return_value=({'status': 200},
- {})))
+ return_value=(service_client.ResponseBody
+ (200, {}))))
return tenant_fix
def _mock_list_role(self):
roles_fix = self.useFixture(mockpatch.PatchObject(
json_iden_client.IdentityClientJSON,
'list_roles',
- return_value=({'status': 200},
- [{'id': '1', 'name': 'FakeRole'}])))
+ return_value=(service_client.ResponseBodyList
+ (200, [{'id': '1', 'name': 'FakeRole'}]))))
return roles_fix
def _mock_network_create(self, iso_creds, id, name):
@@ -109,7 +110,7 @@
return_value={'router': {'id': id, 'name': name}}))
return router_fix
- @mock.patch('tempest.common.rest_client.RestClient')
+ @mock.patch('tempest_lib.common.rest_client.RestClient')
def test_primary_creds(self, MockRestClient):
cfg.CONF.set_default('neutron', False, 'service_available')
iso_creds = isolated_creds.IsolatedCreds('test class',
@@ -125,7 +126,7 @@
self.assertEqual(primary_creds.tenant_id, '1234')
self.assertEqual(primary_creds.user_id, '1234')
- @mock.patch('tempest.common.rest_client.RestClient')
+ @mock.patch('tempest_lib.common.rest_client.RestClient')
def test_admin_creds(self, MockRestClient):
cfg.CONF.set_default('neutron', False, 'service_available')
iso_creds = isolated_creds.IsolatedCreds('test class',
@@ -150,7 +151,7 @@
self.assertEqual(admin_creds.tenant_id, '1234')
self.assertEqual(admin_creds.user_id, '1234')
- @mock.patch('tempest.common.rest_client.RestClient')
+ @mock.patch('tempest_lib.common.rest_client.RestClient')
def test_all_cred_cleanup(self, MockRestClient):
cfg.CONF.set_default('neutron', False, 'service_available')
iso_creds = isolated_creds.IsolatedCreds('test class',
@@ -194,7 +195,7 @@
self.assertIn('12345', args)
self.assertIn('123456', args)
- @mock.patch('tempest.common.rest_client.RestClient')
+ @mock.patch('tempest_lib.common.rest_client.RestClient')
def test_alt_creds(self, MockRestClient):
cfg.CONF.set_default('neutron', False, 'service_available')
iso_creds = isolated_creds.IsolatedCreds('test class',
@@ -210,7 +211,7 @@
self.assertEqual(alt_creds.tenant_id, '1234')
self.assertEqual(alt_creds.user_id, '1234')
- @mock.patch('tempest.common.rest_client.RestClient')
+ @mock.patch('tempest_lib.common.rest_client.RestClient')
def test_network_creation(self, MockRestClient):
iso_creds = isolated_creds.IsolatedCreds('test class',
password='fake_password')
@@ -236,7 +237,7 @@
self.assertEqual(router['id'], '1234')
self.assertEqual(router['name'], 'fake_router')
- @mock.patch('tempest.common.rest_client.RestClient')
+ @mock.patch('tempest_lib.common.rest_client.RestClient')
def test_network_cleanup(self, MockRestClient):
def side_effect(**args):
return {"security_groups": [{"tenant_id": args['tenant_id'],
@@ -359,7 +360,7 @@
self.assertIn('12345', args)
self.assertIn('123456', args)
- @mock.patch('tempest.common.rest_client.RestClient')
+ @mock.patch('tempest_lib.common.rest_client.RestClient')
def test_network_alt_creation(self, MockRestClient):
iso_creds = isolated_creds.IsolatedCreds('test class',
password='fake_password')
@@ -385,7 +386,7 @@
self.assertEqual(router['id'], '1234')
self.assertEqual(router['name'], 'fake_alt_router')
- @mock.patch('tempest.common.rest_client.RestClient')
+ @mock.patch('tempest_lib.common.rest_client.RestClient')
def test_network_admin_creation(self, MockRestClient):
iso_creds = isolated_creds.IsolatedCreds('test class',
password='fake_password')
@@ -411,7 +412,7 @@
self.assertEqual(router['id'], '1234')
self.assertEqual(router['name'], 'fake_admin_router')
- @mock.patch('tempest.common.rest_client.RestClient')
+ @mock.patch('tempest_lib.common.rest_client.RestClient')
def test_no_network_resources(self, MockRestClient):
net_dict = {
'network': False,
@@ -447,7 +448,7 @@
self.assertIsNone(subnet)
self.assertIsNone(router)
- @mock.patch('tempest.common.rest_client.RestClient')
+ @mock.patch('tempest_lib.common.rest_client.RestClient')
def test_router_without_network(self, MockRestClient):
net_dict = {
'network': False,
@@ -465,7 +466,7 @@
self.assertRaises(exceptions.InvalidConfiguration,
iso_creds.get_primary_creds)
- @mock.patch('tempest.common.rest_client.RestClient')
+ @mock.patch('tempest_lib.common.rest_client.RestClient')
def test_subnet_without_network(self, MockRestClient):
net_dict = {
'network': False,
@@ -483,7 +484,7 @@
self.assertRaises(exceptions.InvalidConfiguration,
iso_creds.get_primary_creds)
- @mock.patch('tempest.common.rest_client.RestClient')
+ @mock.patch('tempest_lib.common.rest_client.RestClient')
def test_dhcp_without_subnet(self, MockRestClient):
net_dict = {
'network': False,
diff --git a/tempest/tests/test_waiters.py b/tempest/tests/test_waiters.py
index 1f9825e..cdf5362 100644
--- a/tempest/tests/test_waiters.py
+++ b/tempest/tests/test_waiters.py
@@ -29,7 +29,7 @@
self.client.build_interval = 1
def test_wait_for_image_status(self):
- self.client.get_image.return_value = (None, {'status': 'active'})
+ self.client.get_image.return_value = ({'status': 'active'})
start_time = int(time.time())
waiters.wait_for_image_status(self.client, 'fake_image_id', 'active')
end_time = int(time.time())
@@ -37,13 +37,13 @@
self.assertTrue((end_time - start_time) < 10)
def test_wait_for_image_status_timeout(self):
- self.client.get_image.return_value = (None, {'status': 'saving'})
+ self.client.get_image.return_value = ({'status': 'saving'})
self.assertRaises(exceptions.TimeoutException,
waiters.wait_for_image_status,
self.client, 'fake_image_id', 'active')
def test_wait_for_image_status_error_on_image_create(self):
- self.client.get_image.return_value = (None, {'status': 'ERROR'})
+ self.client.get_image.return_value = ({'status': 'ERROR'})
self.assertRaises(exceptions.AddImageException,
waiters.wait_for_image_status,
self.client, 'fake_image_id', 'active')
diff --git a/tempest/thirdparty/boto/test_ec2_keys.py b/tempest/thirdparty/boto/test_ec2_keys.py
index c3e1e2a..be5db55 100644
--- a/tempest/thirdparty/boto/test_ec2_keys.py
+++ b/tempest/thirdparty/boto/test_ec2_keys.py
@@ -14,7 +14,6 @@
# under the License.
from tempest.common.utils import data_utils
-from tempest import test
from tempest.thirdparty.boto import test as boto_test
@@ -40,7 +39,6 @@
self.assertTrue(compare_key_pairs(keypair,
self.client.get_key_pair(key_name)))
- @test.skip_because(bug="1072318")
def test_delete_ec2_keypair(self):
# EC2 delete KeyPair
key_name = data_utils.rand_name("keypair-")
diff --git a/tox.ini b/tox.ini
index fe2f79e..2e8b509 100644
--- a/tox.ini
+++ b/tox.ini
@@ -4,7 +4,7 @@
skipsdist = True
[tempestenv]
-sitepackages = True
+sitepackages = False
setenv = VIRTUAL_ENV={envdir}
OS_TEST_PATH=./tempest/test_discover
deps = setuptools