diff options
author | Zuul <zuul@review.opendev.org> | 2020-09-30 09:06:37 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2020-09-30 09:06:37 +0000 |
commit | 2121bd466ec63a234e8958634a270f7825681b22 (patch) | |
tree | 79c25c0eee02269051a947868e507541d16475a0 /ironic/tests | |
parent | 672c61938ed23ea54afcebca8e032d01edb5f665 (diff) | |
parent | 68cea19d99e6f6016b17df87c186144ccda3de76 (diff) | |
download | ironic-2121bd466ec63a234e8958634a270f7825681b22.tar.gz |
Merge "Minor agent version code cleanup"
Diffstat (limited to 'ironic/tests')
-rw-r--r-- | ironic/tests/unit/conductor/test_manager.py | 29 | ||||
-rw-r--r-- | ironic/tests/unit/conductor/test_utils.py | 8 |
2 files changed, 18 insertions, 19 deletions
diff --git a/ironic/tests/unit/conductor/test_manager.py b/ironic/tests/unit/conductor/test_manager.py index a45fb8219..63a44b0a4 100644 --- a/ironic/tests/unit/conductor/test_manager.py +++ b/ironic/tests/unit/conductor/test_manager.py @@ -7243,10 +7243,15 @@ class DoNodeAdoptionTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase): mock_spawn.side_effect = self._fake_spawn - self.service.heartbeat(self.context, node.uuid, 'http://callback', - agent_token='magic') - mock_heartbeat.assert_called_with(mock.ANY, mock.ANY, - 'http://callback', '3.0.0', None) + exc = self.assertRaises( + messaging.rpc.ExpectedException, + self.service.heartbeat, + self.context, node.uuid, 'http://callback', + agent_token='magic') + expected_string = ('Agent did not transmit a version, and a version ' + 'is required. Please update the agent being used.') + self.assertEqual(exception.InvalidParameterValue, exc.exc_info[0]) + self.assertEqual(expected_string, str(exc.exc_info[1])) @mock.patch('ironic.drivers.modules.fake.FakeDeploy.heartbeat', autospec=True) @@ -7315,9 +7320,9 @@ class DoNodeAdoptionTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase): mock_spawn.side_effect = self._fake_spawn self.service.heartbeat(self.context, node.uuid, 'http://callback', - agent_token='a secret') + '6.1.0', agent_token='a secret') mock_heartbeat.assert_called_with(mock.ANY, mock.ANY, - 'http://callback', '3.0.0', None) + 'http://callback', '6.1.0', None) @mock.patch('ironic.drivers.modules.fake.FakeDeploy.heartbeat', autospec=True) @@ -7339,9 +7344,9 @@ class DoNodeAdoptionTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase): mock_spawn.side_effect = self._fake_spawn self.service.heartbeat(self.context, node.uuid, 'http://callback', - agent_token='a secret') + '6.1.0', agent_token='a secret') mock_heartbeat.assert_called_with(mock.ANY, mock.ANY, - 'http://callback', '3.0.0', None) + 'http://callback', '6.1.0', None) @mock.patch('ironic.drivers.modules.fake.FakeDeploy.heartbeat', autospec=True) @@ -7442,7 +7447,8 @@ class DoNodeAdoptionTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase): exc = self.assertRaises(messaging.rpc.ExpectedException, self.service.heartbeat, self.context, node.uuid, 'http://callback', - agent_token='a secret') + agent_token='a secret', + agent_version='3.0.0') self.assertEqual(exception.InvalidParameterValue, exc.exc_info[0]) self.assertIn('TLS is required', str(exc.exc_info[1])) self.assertFalse(mock_heartbeat.called) @@ -7469,9 +7475,10 @@ class DoNodeAdoptionTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase): mock_spawn.side_effect = self._fake_spawn self.service.heartbeat(self.context, node.uuid, 'http://callback', - agent_token='a secret', agent_verify_ca='abcd') + agent_version='6.1.0', agent_token='a secret', + agent_verify_ca='abcd') mock_heartbeat.assert_called_with( - mock.ANY, mock.ANY, 'http://callback', '3.0.0', + mock.ANY, mock.ANY, 'http://callback', '6.1.0', '/path/to/crt') diff --git a/ironic/tests/unit/conductor/test_utils.py b/ironic/tests/unit/conductor/test_utils.py index 2b1ea74cc..a449bf8de 100644 --- a/ironic/tests/unit/conductor/test_utils.py +++ b/ironic/tests/unit/conductor/test_utils.py @@ -2087,14 +2087,6 @@ class AgentTokenUtilsTestCase(tests_base.TestCase): conductor_utils.add_secret_token(self.node) self.assertTrue(conductor_utils.is_agent_token_present(self.node)) - def test_is_agent_token_supported(self): - self.assertTrue( - conductor_utils.is_agent_token_supported('6.1.1.dev39')) - self.assertTrue( - conductor_utils.is_agent_token_supported('6.2.1')) - self.assertFalse( - conductor_utils.is_agent_token_supported('6.0.0')) - class GetAttachedVifTestCase(db_base.DbTestCase): |