From 94d83e40e155b4c770b6e2b00043c85d5ebc827d Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Tue, 19 Feb 2019 00:25:46 +0000 Subject: [PATCH] Fix fake DELETE in PlacementFixture Currently functional tests cannot test the DELETE method on some API endpoints, e.g. DELETE /placement/traits/{name} This is because it is not setting the request headers to have the right microversion API - this setting was added for GET / PUT / POST in I681712ac37f732c7803c68f6c7d1eae9f2877d3d, but not for DELETE. Therefore the microversion defaults to 1.0 which for some endpoints is lower than the required version, e.g. the endpoint above requires a minimum microversion of 1.6, which is when this API was introduced. This results in any invocation of _fake_delete() receiving a 404 error, although this error has not been experienced so far because nothing uses _fake_delete() yet. In order to enable future functional tests which hit this API call, set the request headers in a manner consistent with the other HTTP methods for the same endpoint. Change-Id: I2e2d9a9ae12404fe66eae64f8767e348012d7932 --- nova/tests/functional/fixtures.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nova/tests/functional/fixtures.py b/nova/tests/functional/fixtures.py index 5c4305d91cf5..419debad0f14 100644 --- a/nova/tests/functional/fixtures.py +++ b/nova/tests/functional/fixtures.py @@ -144,7 +144,9 @@ class PlacementFixture(placement_fixtures.PlacementFixture): # TODO(sbauza): The current placement NoAuthMiddleware returns a 401 # in case a token is not provided. We should change that by creating # a fake token so we could remove adding the header below. + headers = {'x-auth-token': self.token} + self._update_headers_with_version(headers, **kwargs) return self._client.delete( url, endpoint_override=self.endpoint, - headers={'x-auth-token': self.token}) + headers=headers)