diff options
Diffstat (limited to 'tests/protocol')
-rw-r--r-- | tests/protocol/mockwiredata.py | 5 | ||||
-rw-r--r-- | tests/protocol/test_metadata.py | 2 | ||||
-rw-r--r-- | tests/protocol/test_wire.py | 26 |
3 files changed, 24 insertions, 9 deletions
diff --git a/tests/protocol/mockwiredata.py b/tests/protocol/mockwiredata.py index 5924719..db59ece 100644 --- a/tests/protocol/mockwiredata.py +++ b/tests/protocol/mockwiredata.py @@ -31,7 +31,7 @@ DATA_FILE = { "ga_manifest" : "wire/ga_manifest.xml", "trans_prv": "wire/trans_prv", "trans_cert": "wire/trans_cert", - "test_ext": "ext/sample_ext-1.2.0.zip" + "test_ext": "ext/sample_ext-1.3.0.zip" } DATA_FILE_NO_EXT = DATA_FILE.copy() @@ -52,6 +52,9 @@ DATA_FILE_EXT_INTERNALVERSION["ext_conf"] = "wire/ext_conf_internalversion.xml" DATA_FILE_EXT_AUTOUPGRADE_INTERNALVERSION = DATA_FILE.copy() DATA_FILE_EXT_AUTOUPGRADE_INTERNALVERSION["ext_conf"] = "wire/ext_conf_autoupgrade_internalversion.xml" +DATA_FILE_EXT_ROLLINGUPGRADE = DATA_FILE.copy() +DATA_FILE_EXT_ROLLINGUPGRADE["ext_conf"] = "wire/ext_conf_upgradeguid.xml" + class WireProtocolData(object): def __init__(self, data_files=DATA_FILE): self.emulate_stale_goal_state = False diff --git a/tests/protocol/test_metadata.py b/tests/protocol/test_metadata.py index 5047b86..5f90f12 100644 --- a/tests/protocol/test_metadata.py +++ b/tests/protocol/test_metadata.py @@ -39,7 +39,7 @@ class TestMetadataProtocolGetters(AgentTestCase): protocol.get_certs() ext_handlers, etag = protocol.get_ext_handlers() for ext_handler in ext_handlers.extHandlers: - protocol.get_ext_handler_pkgs(ext_handler) + protocol.get_ext_handler_pkgs(ext_handler, etag) def test_getters(self, *args): test_data = MetadataProtocolData(DATA_FILE) diff --git a/tests/protocol/test_wire.py b/tests/protocol/test_wire.py index d19bab1..9e475ec 100644 --- a/tests/protocol/test_wire.py +++ b/tests/protocol/test_wire.py @@ -14,6 +14,9 @@ # # Requires Python 2.4+ and Openssl 1.0+ # + +import glob + from azurelinuxagent.common import event from azurelinuxagent.common.protocol.wire import * from tests.protocol.mockwiredata import * @@ -25,10 +28,10 @@ wireserver_url = '168.63.129.16' @patch("time.sleep") @patch("azurelinuxagent.common.protocol.wire.CryptUtil") -class TestWireProtocolGetters(AgentTestCase): +class TestWireProtocol(AgentTestCase): def setUp(self): - super(TestWireProtocolGetters, self).setUp() + super(TestWireProtocol, self).setUp() HostPluginProtocol.set_default_channel(False) def _test_getters(self, test_data, MockCryptUtil, _): @@ -40,8 +43,9 @@ class TestWireProtocolGetters(AgentTestCase): protocol.get_vminfo() protocol.get_certs() ext_handlers, etag = protocol.get_ext_handlers() + self.assertEqual("1", etag) for ext_handler in ext_handlers.extHandlers: - protocol.get_ext_handler_pkgs(ext_handler) + protocol.get_ext_handler_pkgs(ext_handler, etag) crt1 = os.path.join(self.tmp_dir, '33B0ABCE4673538650971C10F7D7397E71561F35.crt') @@ -54,6 +58,8 @@ class TestWireProtocolGetters(AgentTestCase): self.assertTrue(os.path.isfile(crt2)) self.assertTrue(os.path.isfile(prv2)) + self.assertEqual("1", protocol.get_incarnation()) + def test_getters(self, *args): """Normal case""" test_data = WireProtocolData(DATA_FILE) @@ -88,6 +94,7 @@ class TestWireProtocolGetters(AgentTestCase): # HostingEnvironmentConfig, will be retrieved the expected number self.assertEqual(2, test_data.call_counts["hostingenvuri"]) + def test_call_storage_kwargs(self, mock_cryptutil, mock_sleep): @@ -365,11 +372,14 @@ class TestWireProtocolGetters(AgentTestCase): v1_ga_status = { 'version': str(CURRENT_VERSION), 'status': status, - 'osversion': DISTRO_VERSION, - 'osname': DISTRO_NAME, - 'hostname': socket.gethostname(), 'formattedMessage': formatted_msg } + v1_ga_guest_info = { + 'computerName': socket.gethostname(), + 'osName': DISTRO_NAME, + 'osVersion': DISTRO_VERSION, + 'version': str(CURRENT_VERSION), + } v1_agg_status = { 'guestAgentStatus': v1_ga_status, 'handlerAggregateStatus': [] @@ -377,7 +387,8 @@ class TestWireProtocolGetters(AgentTestCase): v1_vm_status = { 'version': '1.1', 'timestampUTC': timestamp, - 'aggregateStatus': v1_agg_status + 'aggregateStatus': v1_agg_status, + 'guestOSInfo' : v1_ga_guest_info } self.assertEqual(json.dumps(v1_vm_status), actual.to_json()) @@ -390,5 +401,6 @@ class MockResponse: def read(self): return self.body + if __name__ == '__main__': unittest.main() |