Fix expected status code in Ironic heartbeat

The agent previously checked for a 204, Ironic actually returns
a 202 for heartbeats.

Change-Id: I7ef45dd13dee3c40802aee3424afa3f67bf4a237
This commit is contained in:
Jim Rollenhagen
2014-04-24 11:03:30 -07:00
parent 98791c4547
commit 81c1ea4744
2 changed files with 4 additions and 4 deletions

View File

@@ -66,7 +66,7 @@ class APIClient(object):
except Exception as e:
raise errors.HeartbeatError(str(e))
if response.status_code != requests.codes.NO_CONTENT:
if response.status_code != requests.codes.ACCEPTED:
msg = 'Invalid status code: {0}'.format(response.status_code)
raise errors.HeartbeatError(msg)

View File

@@ -55,7 +55,7 @@ class TestBaseIronicPythonAgent(test_base.BaseTestCase):
def test_successful_heartbeat(self):
expected_heartbeat_before = time.time() + 120
response = FakeResponse(status_code=204, headers={
response = FakeResponse(status_code=202, headers={
'Heartbeat-Before': expected_heartbeat_before,
})
@@ -95,7 +95,7 @@ class TestBaseIronicPythonAgent(test_base.BaseTestCase):
advertise_address=('192.0.2.1', '9999'))
def test_heartbeat_missing_heartbeat_before_header(self):
response = FakeResponse(status_code=204)
response = FakeResponse(status_code=202)
self.api_client.session.request = mock.Mock()
self.api_client.session.request.return_value = response
@@ -105,7 +105,7 @@ class TestBaseIronicPythonAgent(test_base.BaseTestCase):
advertise_address=('192.0.2.1', '9999'))
def test_heartbeat_invalid_heartbeat_before_header(self):
response = FakeResponse(status_code=204, headers={
response = FakeResponse(status_code=202, headers={
'Heartbeat-Before': 'tomorrow',
})
self.api_client.session.request = mock.Mock()