Merge "Use global request id for scenario tests"
This commit is contained in:
commit
9b7aa0dd24
@ -14,6 +14,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo_serialization import jsonutils as json
|
from oslo_serialization import jsonutils as json
|
||||||
|
from oslo_utils import uuidutils as uuids
|
||||||
from tempest.lib.common import rest_client
|
from tempest.lib.common import rest_client
|
||||||
|
|
||||||
|
|
||||||
@ -31,8 +32,16 @@ class ResourceReservationV1Client(rest_client.RestClient):
|
|||||||
body = json.loads(body)
|
body = json.loads(body)
|
||||||
return rest_client.ResponseBody(resp, body)
|
return rest_client.ResponseBody(resp, body)
|
||||||
|
|
||||||
|
def _get_headers(self):
|
||||||
|
headers = {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'X-Openstack-Request-Id': 'req-' + str(uuids.generate_uuid())
|
||||||
|
}
|
||||||
|
return headers
|
||||||
|
|
||||||
def list_lease(self):
|
def list_lease(self):
|
||||||
resp, body = self.get(self.lease)
|
resp, body = self.get(self.lease, headers=self._get_headers())
|
||||||
return self._response_helper(resp, body)
|
return self._response_helper(resp, body)
|
||||||
|
|
||||||
def get_lease(self, lease):
|
def get_lease(self, lease):
|
||||||
@ -41,36 +50,43 @@ class ResourceReservationV1Client(rest_client.RestClient):
|
|||||||
|
|
||||||
def create_lease(self, body):
|
def create_lease(self, body):
|
||||||
body = json.dump_as_bytes(body)
|
body = json.dump_as_bytes(body)
|
||||||
resp, body = self.post(self.lease, body=body)
|
resp, body = self.post(
|
||||||
|
self.lease, body=body, headers=self._get_headers())
|
||||||
return self._response_helper(resp, body)
|
return self._response_helper(resp, body)
|
||||||
|
|
||||||
def update_lease(self, lease, body):
|
def update_lease(self, lease, body):
|
||||||
body = json.dump_as_bytes(body)
|
body = json.dump_as_bytes(body)
|
||||||
resp, body = self.put(self.lease_path % lease, body=body)
|
resp, body = self.put(
|
||||||
|
self.lease_path % lease, body=body, headers=self._get_headers())
|
||||||
return self._response_helper(resp, body)
|
return self._response_helper(resp, body)
|
||||||
|
|
||||||
def delete_lease(self, lease):
|
def delete_lease(self, lease):
|
||||||
resp, body = self.delete(self.lease_path % lease)
|
resp, body = self.delete(
|
||||||
|
self.lease_path % lease, headers=self._get_headers())
|
||||||
return self._response_helper(resp, body)
|
return self._response_helper(resp, body)
|
||||||
|
|
||||||
def list_host(self):
|
def list_host(self):
|
||||||
resp, body = self.get(self.host)
|
resp, body = self.get(self.host, headers=self._get_headers())
|
||||||
return self._response_helper(resp, body)
|
return self._response_helper(resp, body)
|
||||||
|
|
||||||
def get_host(self, host):
|
def get_host(self, host):
|
||||||
resp, body = self.get(self.host_path % host)
|
resp, body = self.get(
|
||||||
|
self.host_path % host, headers=self._get_headers())
|
||||||
return self._response_helper(resp, body)
|
return self._response_helper(resp, body)
|
||||||
|
|
||||||
def create_host(self, body):
|
def create_host(self, body):
|
||||||
body = json.dump_as_bytes(body)
|
body = json.dump_as_bytes(body)
|
||||||
resp, body = self.post(self.host, body=body)
|
resp, body = self.post(
|
||||||
|
self.host, body=body, headers=self._get_headers())
|
||||||
return self._response_helper(resp, body)
|
return self._response_helper(resp, body)
|
||||||
|
|
||||||
def update_host(self, host, body):
|
def update_host(self, host, body):
|
||||||
body = json.dump_as_bytes(body)
|
body = json.dump_as_bytes(body)
|
||||||
resp, body = self.put(self.host_path % host, body=body)
|
resp, body = self.put(
|
||||||
|
self.host_path % host, body=body, headers=self._get_headers())
|
||||||
return self._response_helper(resp, body)
|
return self._response_helper(resp, body)
|
||||||
|
|
||||||
def delete_host(self, host):
|
def delete_host(self, host):
|
||||||
resp, body = self.delete(self.host_path % host)
|
resp, body = self.delete(
|
||||||
|
self.host_path % host, headers=self._get_headers())
|
||||||
return self._response_helper(resp, body)
|
return self._response_helper(resp, body)
|
||||||
|
@ -7,5 +7,6 @@ six>=1.10.0 # MIT
|
|||||||
oslo.config>=5.2.0 # Apache-2.0
|
oslo.config>=5.2.0 # Apache-2.0
|
||||||
oslo.log>=3.36.0 # Apache-2.0
|
oslo.log>=3.36.0 # Apache-2.0
|
||||||
oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
|
oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
|
||||||
|
oslo.utils>=3.37.0 # Apache-2.0
|
||||||
tempest>=17.1.0 # Apache-2.0
|
tempest>=17.1.0 # Apache-2.0
|
||||||
gabbi>=1.42.1 # Apache-2.0
|
gabbi>=1.42.1 # Apache-2.0
|
||||||
|
Loading…
Reference in New Issue
Block a user