Merge "Remove deprecated allow_tenant_isolation option"
diff --git a/HACKING.rst b/HACKING.rst
index bb55ac5..2a7ae1d 100644
--- a/HACKING.rst
+++ b/HACKING.rst
@@ -106,7 +106,7 @@
test method. You specify the services with the ``tempest.common.utils.services``
decorator. For example:
-@utils.services('compute', 'image')
+``@utils.services('compute', 'image')``
Valid service tag names are the same as the list of directories in tempest.api
that have tests.
@@ -118,6 +118,59 @@
in ``tempest.api.compute`` would require a service tag for those services,
however they do not need to be tagged as ``compute``.
+Test Attributes
+---------------
+Tempest leverages `test attributes`_ which are a simple but effective way of
+distinguishing between different "types" of API tests. A test can be "tagged"
+with such attributes using the ``decorators.attr`` decorator, for example::
+
+ @decorators.attr(type=['negative'])
+ def test_aggregate_create_aggregate_name_length_less_than_1(self):
+ [...]
+
+These test attributes can be used for test selection via regular expressions.
+For example, ``(?!.*\[.*\bslow\b.*\])(^tempest\.scenario)`` runs all the tests
+in the ``scenario`` test module, *except* for those tagged with the ``slow``
+attribute (via a negative lookahead in the regular expression). These
+attributes are used in Tempest's ``tox.ini`` as well as Tempest's Zuul job
+definitions for specifying particular batches of Tempest test suites to run.
+
+.. _test attributes: https://testtools.readthedocs.io/en/latest/for-test-authors.html?highlight=attr#test-attributes
+
+Negative Attribute
+^^^^^^^^^^^^^^^^^^
+The ``type='negative'`` attribute is used to signify that a test is a negative
+test, which is a test that handles invalid input gracefully. This attribute
+should be applied to all negative test scenarios.
+
+This attribute must be applied to each test that belongs to a negative test
+class, i.e. a test class name ending with "Negative.*" substring.
+
+.. todo::
+
+ Add a hacking check for ensuring that all classes that contain substring
+ "Negative" have the negative attribute decorator applied above each test.
+
+Slow Attribute
+^^^^^^^^^^^^^^
+The ``type='slow'`` attribute is used to signify that a test takes a long time
+to run, relatively speaking. This attribute is usually applied to
+:ref:`scenario tests <scenario_field_guide>`, which involve a complicated
+series of API operations, the total runtime of which can be relatively long.
+This long runtime has performance implications on `Zuul`_ jobs, which is why
+the ``slow`` attribute is leveraged to run slow tests on a selective basis,
+to keep total `Zuul`_ job runtime down to a reasonable time frame.
+
+.. _Zuul: https://docs.openstack.org/infra/zuul/
+
+Smoke Attribute
+^^^^^^^^^^^^^^^
+The ``type='smoke'`` attribute is used to signify that a test is a so-called
+smoke test, which is a type of test that tests the most vital OpenStack
+functionality, like listing servers or flavors or creating volumes. The
+attribute should be sparingly applied to only the tests that sanity-check the
+most essential functionality of an OpenStack cloud.
+
Test fixtures and resources
---------------------------
Test level resources should be cleaned-up after the test execution. Clean-up
diff --git a/doc/source/microversion_testing.rst b/doc/source/microversion_testing.rst
index 073a0bb..6dd00d3 100644
--- a/doc/source/microversion_testing.rst
+++ b/doc/source/microversion_testing.rst
@@ -358,6 +358,10 @@
.. _2.49: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id44
+ * `2.53`_
+
+ .. _2.53: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#maximum-in-pike
+
* `2.54`_
.. _2.54: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id49
diff --git a/doc/source/test_removal.rst b/doc/source/test_removal.rst
index ddae6e2..b22503b 100644
--- a/doc/source/test_removal.rst
+++ b/doc/source/test_removal.rst
@@ -1,21 +1,21 @@
Tempest Test Removal Procedure
==============================
-Historically tempest was the only way of doing functional testing and
-integration testing in OpenStack. This was mostly only an artifact of tempest
+Historically, Tempest was the only way of doing functional testing and
+integration testing in OpenStack. This was mostly only an artifact of Tempest
being the only proven pattern for doing this, not an artifact of a design
-decision. However, moving forward as functional testing is being spun up in
-each individual project we really only want tempest to be the integration test
-suite it was intended to be; testing the high level interactions between
-projects through REST API requests. In this model there are probably existing
-tests that aren't the best fit living in tempest. However, since tempest is
+decision. However, moving forward, as functional testing is being spun up in
+each individual project, we really only want Tempest to be the integration test
+suite it was intended to be: testing the high-level interactions between
+projects through REST API requests. In this model, there are probably existing
+tests that aren't the best fit living in Tempest. However, since Tempest is
largely still the only gating test suite in this space we can't carelessly rip
out everything from the tree. This document outlines the procedure which was
developed to ensure we minimize the risk for removing something of value from
-the tempest tree.
+the Tempest tree.
-This procedure might seem overly conservative and slow paced, but this is by
-design to try and ensure we don't remove something that is actually providing
+This procedure might seem overly conservative and slow-paced, but this is by
+design to try to ensure we don't remove something that is actually providing
value. Having potential duplication between testing is not a big deal
especially compared to the alternative of removing something which is actually
providing value and is actively catching bugs, or blocking incorrect patches
@@ -27,24 +27,24 @@
3 prong rule for removal
^^^^^^^^^^^^^^^^^^^^^^^^
-In the proposal etherpad we'll be looking for answers to 3 questions
+In the proposal etherpad we'll be looking for answers to 3 questions:
#. The tests proposed for removal must have equiv. coverage in a different
project's test suite (whether this is another gating test project, or an in
tree functional test suite). For API tests preferably the other project will
- have a similar source of friction in place to prevent breaking api changes
- so that we don't regress and let breaking api changes slip through the
+ have a similar source of friction in place to prevent breaking API changes
+ so that we don't regress and let breaking API changes slip through the
gate.
#. The test proposed for removal has a failure rate < 0.50% in the gate over
the past release (the value and interval will likely be adjusted in the
future)
.. _`prong #3`:
-#. There must not be an external user/consumer of tempest
+#. There must not be an external user/consumer of Tempest
that depends on the test proposed for removal
The answers to 1 and 2 are easy to verify. For 1 just provide a link to the new
-test location. If you are linking to the tempest removal patch please also put
+test location. If you are linking to the Tempest removal patch please also put
a Depends-On in the commit message for the commit which moved the test into
another repo.
@@ -91,32 +91,32 @@
#. paste the output table with numbers and the mysql command you ran to
generate it into the etherpad.
-Eventually a cli interface will be created to make that a bit more friendly.
+Eventually a CLI interface will be created to make that a bit more friendly.
Also a dashboard is in the works so we don't need to manually run the command.
The intent of the 2nd prong is to verify that moving the test into a project
-specific testing is preventing bugs (assuming the tempest tests were catching
-issues) from bubbling up a layer into tempest jobs. If we're seeing failure
+specific testing is preventing bugs (assuming the Tempest tests were catching
+issues) from bubbling up a layer into Tempest jobs. If we're seeing failure
rates above a certain threshold in the gate checks that means the functional
testing isn't really being effective in catching that bug (and therefore
-blocking it from landing) and having the testing run in tempest still has
+blocking it from landing) and having the testing run in Tempest still has
value.
However for the 3rd prong verification is a bit more subjective. The original
intent of this prong was mostly for refstack/defcore and also for things that
running on the stable branches. We don't want to remove any tests if that
-would break our api consistency checking between releases, or something that
-defcore/refstack is depending on being in tempest. It's worth pointing out
+would break our API consistency checking between releases, or something that
+defcore/refstack is depending on being in Tempest. It's worth pointing out
that if a test is used in defcore as part of interop testing then it will
-probably have continuing value being in tempest as part of the
+probably have continuing value being in Tempest as part of the
integration/integrated tests in general. This is one area where some overlap
-is expected between testing in projects and tempest, which is not a bad thing.
+is expected between testing in projects and Tempest, which is not a bad thing.
Discussing the 3rd prong
""""""""""""""""""""""""
There are 2 approaches to addressing the 3rd prong. Either it can be raised
-during a qa meeting during the tempest discussion. Please put it on the agenda
+during a qa meeting during the Tempest discussion. Please put it on the agenda
well ahead of the scheduled meeting. Since the meeting time will be well known
ahead of time anyone who depends on the tests will have ample time beforehand
to outline any concerns on the before the meeting. To give ample time for
@@ -133,17 +133,17 @@
Exceptions to this procedure
----------------------------
-For the most part all tempest test removals have to go through this procedure
+For the most part all Tempest test removals have to go through this procedure
there are a couple of exceptions though:
-#. The class of testing has been decided to be outside the scope of tempest.
+#. The class of testing has been decided to be outside the scope of Tempest.
#. A revert for a patch which added a broken test, or testing which didn't
actually run in the gate (basically any revert for something which
shouldn't have been added)
#. Tests that would become out of scope as a consequence of an API change,
as described in `API Compatibility`_.
Such tests cannot live in Tempest because of the branchless nature of
- Tempest. Such test must still honor `prong #3`_.
+ Tempest. Such tests must still honor `prong #3`_.
For the first exception type the only types of testing in tree which have been
declared out of scope at this point are:
@@ -160,8 +160,8 @@
Tempest Scope
^^^^^^^^^^^^^
-Starting in the liberty cycle tempest has defined a set of projects which
-are defined as in scope for direct testing in tempest. As of today that list
+Starting in the liberty cycle Tempest, has defined a set of projects which
+are defined as in scope for direct testing in Tempest. As of today that list
is:
* Keystone
@@ -171,18 +171,18 @@
* Neutron
* Swift
-anything that lives in tempest which doesn't test one of these projects can be
+Anything that lives in Tempest which doesn't test one of these projects can be
removed assuming there is equivalent testing elsewhere. Preferably using the
`tempest plugin mechanism`_
-to maintain continuity after migrating the tests out of tempest.
+to maintain continuity after migrating the tests out of Tempest.
.. _tempest plugin mechanism: https://docs.openstack.org/tempest/latest/plugin.html
API Compatibility
"""""""""""""""""
-If an API introduces a non-discoverable, backward incompatible change, and
-such change is not backported to all versions supported by Tempest, tests for
+If an API introduces a non-discoverable, backward-incompatible change, and
+such a change is not backported to all versions supported by Tempest, tests for
that API cannot live in Tempest anymore.
This is because tests would not be able to know or control which API response
to expect, and thus would not be able to enforce a specific behavior.
diff --git a/releasenotes/notes/tempest-lib-compute-update-service-6019d2dcfe4a1c5d.yaml b/releasenotes/notes/tempest-lib-compute-update-service-6019d2dcfe4a1c5d.yaml
new file mode 100644
index 0000000..d67cdb8
--- /dev/null
+++ b/releasenotes/notes/tempest-lib-compute-update-service-6019d2dcfe4a1c5d.yaml
@@ -0,0 +1,11 @@
+---
+features:
+ - |
+ The ``update_service`` API is added to the ``services_client`` compute
+ library. This API is introduced in microversion 2.53 and supersedes
+ the following APIs:
+
+ * ``PUT /os-services/disable`` (``disable_service``)
+ * ``PUT /os-services/disable-log-reason`` (``disable_log_reason``)
+ * ``PUT /os-services/enable`` (``enable_service``)
+ * ``PUT /os-services/force-down`` (``update_forced_down``)
diff --git a/tempest/api/compute/admin/test_services_negative.py b/tempest/api/compute/admin/test_services_negative.py
index 201670a..993c8ec 100644
--- a/tempest/api/compute/admin/test_services_negative.py
+++ b/tempest/api/compute/admin/test_services_negative.py
@@ -13,12 +13,14 @@
# under the License.
from tempest.api.compute import base
+from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
class ServicesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
"""Tests Services API. List and Enable/Disable require admin privileges."""
+ max_microversion = '2.52'
@classmethod
def setup_clients(cls):
@@ -35,7 +37,8 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('d0884a69-f693-4e79-a9af-232d15643bf7')
def test_get_service_by_invalid_params(self):
- # return all services if send the request with invalid parameter
+ # Expect all services to be returned when the request contains invalid
+ # parameters.
services = self.client.list_services()['services']
services_xxx = (self.client.list_services(xxx='nova-compute')
['services'])
@@ -58,3 +61,45 @@
services = self.client.list_services(host='xxx',
binary=binary_name)['services']
self.assertEmpty(services)
+
+
+class ServicesAdminNegativeV253TestJSON(ServicesAdminNegativeTestJSON):
+ min_microversion = '2.53'
+ max_microversion = 'latest'
+
+ # NOTE(felipemonteiro): This class tests the services APIs response schema
+ # for the 2.53 microversion. Schema testing is done for `list_services`
+ # tests.
+
+ @classmethod
+ def resource_setup(cls):
+ super(ServicesAdminNegativeV253TestJSON, cls).resource_setup()
+ # Nova returns 400 if `binary` is not nova-compute.
+ cls.binary = 'nova-compute'
+ cls.fake_service_id = data_utils.rand_uuid()
+
+ @decorators.attr(type=['negative'])
+ @decorators.idempotent_id('508671aa-c929-4479-bd10-8680d40dd0a6')
+ def test_enable_service_with_invalid_service_id(self):
+ self.assertRaises(lib_exc.NotFound,
+ self.client.update_service,
+ service_id=self.fake_service_id,
+ status='enabled')
+
+ @decorators.attr(type=['negative'])
+ @decorators.idempotent_id('a9eeeade-42b3-419f-87aa-c9342aa068cf')
+ def test_disable_service_with_invalid_service_id(self):
+ self.assertRaises(lib_exc.NotFound,
+ self.client.update_service,
+ service_id=self.fake_service_id,
+ status='disabled')
+
+ @decorators.attr(type=['negative'])
+ @decorators.idempotent_id('f46a9d91-1e85-4b96-8e7a-db7706fa2e9a')
+ def test_disable_log_reason_with_invalid_service_id(self):
+ # disabled_reason requires that status='disabled' be provided.
+ self.assertRaises(lib_exc.NotFound,
+ self.client.update_service,
+ service_id=self.fake_service_id,
+ status='disabled',
+ disabled_reason='maintenance')
diff --git a/tempest/lib/api_schema/response/compute/v2_11/services.py b/tempest/lib/api_schema/response/compute/v2_11/services.py
index 18b833b..9ece1f9 100644
--- a/tempest/lib/api_schema/response/compute/v2_11/services.py
+++ b/tempest/lib/api_schema/response/compute/v2_11/services.py
@@ -44,3 +44,10 @@
'required': ['service']
}
}
+
+# **** Schemas unchanged in microversion 2.11 since microversion 2.1 ****
+# Note(felipemonteiro): Below are the unchanged schema in this microversion. We
+# need to keep this schema in this file to have the generic way to select the
+# right schema based on self.schema_versions_info mapping in service client.
+enable_disable_service = copy.deepcopy(services.enable_disable_service)
+disable_log_reason = copy.deepcopy(services.disable_log_reason)
diff --git a/tempest/lib/api_schema/response/compute/v2_53/__init__.py b/tempest/lib/api_schema/response/compute/v2_53/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tempest/lib/api_schema/response/compute/v2_53/__init__.py
diff --git a/tempest/lib/api_schema/response/compute/v2_53/services.py b/tempest/lib/api_schema/response/compute/v2_53/services.py
new file mode 100644
index 0000000..aa132a9
--- /dev/null
+++ b/tempest/lib/api_schema/response/compute/v2_53/services.py
@@ -0,0 +1,70 @@
+# Copyright 2018 AT&T 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 copy
+
+from tempest.lib.api_schema.response.compute.v2_1 import parameter_types
+from tempest.lib.api_schema.response.compute.v2_11 import services \
+ as servicesv211
+
+# ***************** Schemas changed in microversion 2.53 *****************
+
+# NOTE(felipemonteiro): This is schema for microversion 2.53 which includes:
+#
+# * changing the service 'id' to 'string' type only
+# * adding update_service which supersedes enable_service, disable_service,
+# disable_log_reason, update_forced_down.
+
+list_services = copy.deepcopy(servicesv211.list_services)
+# The ID of the service is a uuid, so v2.1 pattern does not apply.
+list_services['response_body']['properties']['services']['items'][
+ 'properties']['id'] = {'type': 'string', 'format': 'uuid'}
+
+update_service = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'service': {
+ 'type': 'object',
+ 'properties': {
+ 'id': {'type': 'string', 'format': 'uuid'},
+ 'binary': {'type': 'string'},
+ 'disabled_reason': {'type': 'string'},
+ 'host': {'type': 'string'},
+ 'state': {'type': 'string'},
+ 'status': {'type': 'string'},
+ 'updated_at': parameter_types.date_time,
+ 'zone': {'type': 'string'},
+ 'forced_down': {'type': 'boolean'}
+ },
+ 'additionalProperties': False,
+ 'required': ['id', 'binary', 'disabled_reason', 'host',
+ 'state', 'status', 'updated_at', 'zone',
+ 'forced_down']
+ }
+ },
+ 'additionalProperties': False,
+ 'required': ['service']
+ }
+}
+
+# **** Schemas unchanged in microversion 2.53 since microversion 2.11 ****
+# Note(felipemonteiro): Below are the unchanged schema in this microversion. We
+# need to keep this schema in this file to have the generic way to select the
+# right schema based on self.schema_versions_info mapping in service client.
+enable_disable_service = copy.deepcopy(servicesv211.enable_disable_service)
+update_forced_down = copy.deepcopy(servicesv211.update_forced_down)
+disable_log_reason = copy.deepcopy(servicesv211.disable_log_reason)
diff --git a/tempest/lib/services/compute/services_client.py b/tempest/lib/services/compute/services_client.py
index b046c35..d52de3a 100644
--- a/tempest/lib/services/compute/services_client.py
+++ b/tempest/lib/services/compute/services_client.py
@@ -20,6 +20,8 @@
from tempest.lib.api_schema.response.compute.v2_1 import services as schema
from tempest.lib.api_schema.response.compute.v2_11 import services \
as schemav211
+from tempest.lib.api_schema.response.compute.v2_53 import services \
+ as schemav253
from tempest.lib.common import rest_client
from tempest.lib.services.compute import base_compute_client
@@ -28,7 +30,8 @@
schema_versions_info = [
{'min': None, 'max': '2.10', 'schema': schema},
- {'min': '2.11', 'max': None, 'schema': schemav211}]
+ {'min': '2.11', 'max': '2.52', 'schema': schemav211},
+ {'min': '2.53', 'max': None, 'schema': schemav253}]
def list_services(self, **params):
"""Lists all running Compute services for a tenant.
@@ -47,9 +50,30 @@
self.validate_response(_schema.list_services, resp, body)
return rest_client.ResponseBody(resp, body)
+ def update_service(self, service_id, **kwargs):
+ """Update a compute service.
+
+ Update a compute service to enable or disable scheduling, including
+ recording a reason why a compute service was disabled from scheduling.
+
+ This API is available starting with microversion 2.53.
+
+ For a full list of available parameters, please refer to the official
+ API reference:
+ https://developer.openstack.org/api-ref/compute/#update-compute-service
+ """
+ put_body = json.dumps(kwargs)
+ resp, body = self.put('os-services/%s' % service_id, put_body)
+ body = json.loads(body)
+ _schema = self.get_schema(self.schema_versions_info)
+ self.validate_response(_schema.update_service, resp, body)
+ return rest_client.ResponseBody(resp, body)
+
def enable_service(self, **kwargs):
"""Enable service on a host.
+ ``update_service`` supersedes this API starting with microversion 2.53.
+
For a full list of available parameters, please refer to the official
API reference:
https://developer.openstack.org/api-ref/compute/#enable-scheduling-for-a-compute-service
@@ -63,6 +87,8 @@
def disable_service(self, **kwargs):
"""Disable service on a host.
+ ``update_service`` supersedes this API starting with microversion 2.53.
+
For a full list of available parameters, please refer to the official
API reference:
https://developer.openstack.org/api-ref/compute/#disable-scheduling-for-a-compute-service
@@ -76,6 +102,8 @@
def disable_log_reason(self, **kwargs):
"""Disables scheduling for a Compute service and logs reason.
+ ``update_service`` supersedes this API starting with microversion 2.53.
+
For a full list of available parameters, please refer to the official
API reference:
https://developer.openstack.org/api-ref/compute/#disable-scheduling-for-a-compute-service-and-log-disabled-reason
@@ -89,6 +117,8 @@
def update_forced_down(self, **kwargs):
"""Set or unset ``forced_down`` flag for the service.
+ ``update_service`` supersedes this API starting with microversion 2.53.
+
For a full list of available parameters, please refer to the official
API reference:
https://developer.openstack.org/api-ref/compute/#update-forced-down
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index bcd4ddb..8212e75 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -435,7 +435,6 @@
@testtools.skipIf(CONF.network.shared_physical_network,
'Connectivity can only be tested when in a '
'multitenant network environment')
- @decorators.skip_because(bug="1610994")
@decorators.attr(type='slow')
@utils.services('compute', 'network')
def test_connectivity_between_vms_on_different_networks(self):
diff --git a/tempest/tests/lib/services/compute/test_services_client.py b/tempest/tests/lib/services/compute/test_services_client.py
index 2dd981c..ba432e3 100644
--- a/tempest/tests/lib/services/compute/test_services_client.py
+++ b/tempest/tests/lib/services/compute/test_services_client.py
@@ -56,6 +56,20 @@
}
}
+ FAKE_UPDATE_SERVICE = {
+ "service": {
+ "id": "e81d66a4-ddd3-4aba-8a84-171d1cb4d339",
+ "binary": "nova-compute",
+ "disabled_reason": "test2",
+ "host": "host1",
+ "state": "down",
+ "status": "disabled",
+ "updated_at": "2012-10-29T13:42:05.000000",
+ "forced_down": False,
+ "zone": "nova"
+ }
+ }
+
def setUp(self):
super(TestServicesClient, self).setUp()
fake_auth = fake_auth_provider.FakeAuthProvider()
@@ -119,6 +133,28 @@
binary="controller",
disabled_reason='test reason')
+ def _test_update_service(self, bytes_body=False, status=None,
+ disabled_reason=None, forced_down=None):
+ resp_body = copy.deepcopy(self.FAKE_UPDATE_SERVICE)
+ kwargs = {}
+
+ if status is not None:
+ kwargs['status'] = status
+ if disabled_reason is not None:
+ kwargs['disabled_reason'] = disabled_reason
+ if forced_down is not None:
+ kwargs['forced_down'] = forced_down
+
+ resp_body['service'].update(kwargs)
+
+ self.check_service_client_function(
+ self.client.update_service,
+ 'tempest.lib.common.rest_client.RestClient.put',
+ resp_body,
+ bytes_body,
+ service_id=resp_body['service']['id'],
+ **kwargs)
+
def test_log_reason_disabled_service_with_str_body(self):
self._test_log_reason_disabled_service()
@@ -144,3 +180,36 @@
new_callable=mock.PropertyMock(return_value='2.11'))
def test_update_forced_down_with_bytes_body(self, _):
self._test_update_forced_down(bytes_body=True)
+
+ @mock.patch.object(base_compute_client, 'COMPUTE_MICROVERSION',
+ new_callable=mock.PropertyMock(return_value='2.53'))
+ def test_update_service_disable_scheduling_with_str_body(self, _):
+ self._test_update_service(status='disabled',
+ disabled_reason='maintenance')
+
+ @mock.patch.object(base_compute_client, 'COMPUTE_MICROVERSION',
+ new_callable=mock.PropertyMock(return_value='2.53'))
+ def test_update_service_disable_scheduling_with_bytes_body(self, _):
+ self._test_update_service(status='disabled',
+ disabled_reason='maintenance',
+ bytes_body=True)
+
+ @mock.patch.object(base_compute_client, 'COMPUTE_MICROVERSION',
+ new_callable=mock.PropertyMock(return_value='2.53'))
+ def test_update_service_enable_scheduling_with_str_body(self, _):
+ self._test_update_service(status='enabled')
+
+ @mock.patch.object(base_compute_client, 'COMPUTE_MICROVERSION',
+ new_callable=mock.PropertyMock(return_value='2.53'))
+ def test_update_service_enable_scheduling_with_bytes_body(self, _):
+ self._test_update_service(status='enabled', bytes_body=True)
+
+ @mock.patch.object(base_compute_client, 'COMPUTE_MICROVERSION',
+ new_callable=mock.PropertyMock(return_value='2.53'))
+ def test_update_service_forced_down_with_str_body(self, _):
+ self._test_update_service(forced_down=True)
+
+ @mock.patch.object(base_compute_client, 'COMPUTE_MICROVERSION',
+ new_callable=mock.PropertyMock(return_value='2.53'))
+ def test_update_service_forced_down_with_bytes_body(self, _):
+ self._test_update_service(forced_down=True, bytes_body=True)