Joe H. Rahme | c54a863 | 2013-10-15 10:09:10 +0200 | [diff] [blame] | 1 | # Copyright (C) 2013 eNovance SAS <licensing@enovance.com> |
| 2 | # |
Joe H. Rahme | c54a863 | 2013-10-15 10:09:10 +0200 | [diff] [blame] | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | |
| 15 | |
| 16 | from tempest.api.object_storage import base |
Daisuke Morita | d206d3b | 2013-12-06 15:18:04 +0900 | [diff] [blame] | 17 | from tempest.common import custom_matchers |
Ken'ichi Ohmichi | b7bc1de | 2017-01-27 18:12:22 -0800 | [diff] [blame] | 18 | from tempest.lib import decorators |
Joe H. Rahme | c54a863 | 2013-10-15 10:09:10 +0200 | [diff] [blame] | 19 | |
| 20 | |
| 21 | class HealthcheckTest(base.BaseObjectTest): |
| 22 | |
Joe H. Rahme | c54a863 | 2013-10-15 10:09:10 +0200 | [diff] [blame] | 23 | def setUp(self): |
| 24 | super(HealthcheckTest, self).setUp() |
Joe H. Rahme | c54a863 | 2013-10-15 10:09:10 +0200 | [diff] [blame] | 25 | # Turning http://.../v1/foobar into http://.../ |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 26 | self.account_client.skip_path() |
Joe H. Rahme | c54a863 | 2013-10-15 10:09:10 +0200 | [diff] [blame] | 27 | |
Ken'ichi Ohmichi | b7bc1de | 2017-01-27 18:12:22 -0800 | [diff] [blame] | 28 | @decorators.idempotent_id('db5723b1-f25c-49a9-bfeb-7b5640caf337') |
Joe H. Rahme | c54a863 | 2013-10-15 10:09:10 +0200 | [diff] [blame] | 29 | def test_get_healthcheck(self): |
| 30 | |
Christian Schwede | bb3a523 | 2013-12-31 14:49:43 +0000 | [diff] [blame] | 31 | resp, _ = self.account_client.get("healthcheck", {}) |
Joe H. Rahme | c54a863 | 2013-10-15 10:09:10 +0200 | [diff] [blame] | 32 | |
Daisuke Morita | d206d3b | 2013-12-06 15:18:04 +0900 | [diff] [blame] | 33 | # The target of the request is not any Swift resource. Therefore, the |
| 34 | # existence of response header is checked without a custom matcher. |
| 35 | self.assertIn('content-length', resp) |
| 36 | self.assertIn('content-type', resp) |
| 37 | self.assertIn('x-trans-id', resp) |
| 38 | self.assertIn('date', resp) |
| 39 | # Check only the format of common headers with custom matcher |
| 40 | self.assertThat(resp, custom_matchers.AreAllWellFormatted()) |