def test_apply_mof(self):
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = MockUtil(self)
     dsc.install_dsc_packages()
     dsc.start_omiservice()
     config = dsc.apply_dsc_meta_configuration('mof/dscnode.nxFile.meta.mof')
     self.assertTrue('ReturnValue=0' in config)
 def test_register(self):
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = MockUtil(self)
     dsc.install_dsc_packages()
     dsc.start_omiservice()
     exit_code, output = dsc.register_automation('somekey','http://dummy','','','','')
     self.assertEqual(exit_code, 0)
 def test_register_without_registration_info(self):
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = MockUtil(self)
     dsc.install_dsc_packages()
     dsc.start_omiservice()
     exit_code, output = dsc.register_automation('','','','','','')
     self.assertEqual(exit_code, 51)
 def test_is_statusfile_update_idempotent(self):
     status_file = 'status/0.status'
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = MockUtil(self)
     dsc.update_statusfile(status_file, '123','345')
     dsc.update_statusfile(status_file, '123','345')
     self.verify_nodeid_vmuuid(status_file)
 def test_is_statusfile_update_idempotent(self):
     status_file = 'status/0.status'
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = MockUtil(self)
     dsc.update_statusfile(status_file, '123', '345')
     dsc.update_statusfile(status_file, '123', '345')
     self.verify_nodeid_vmuuid(status_file)
Example #6
0
 def test_nodeid_with_dsc(self):
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = MockUtil(self)
     dsc.install_dsc_packages()
     dsc.start_omiservice()
     config = dsc.apply_dsc_meta_configuration('mof/dscnode.nxFile.meta.push.mof')
     nodeid = dsc.get_nodeid('/etc/opt/omi/conf/omsconfig/agentid')
     self.assertTrue(nodeid is not None, "nodeid is none")
Example #7
0
 def test_register(self):
     print "Register test case with valid parameters"
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = MockUtil(self)
     dsc.install_dsc_packages()
     dsc.start_omiservice()
     exit_code, output = dsc.register_automation('somekey','http://dummy','test.localhost.mof','15','30','applyandmonitor')
     self.assertEqual(exit_code, 0)
Example #8
0
 def test_is_statusfile_update_register(self):
     status_file = 'status/0.status'
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = MockUtil(self)
     dsc.install_dsc_packages()
     dsc.start_omiservice()
     exit_code, output = dsc.register_automation('somekey','http://dummy','','','','')
     self.verify_nodeid_vmuuid(status_file)
 def test_apply_mof(self):
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = Dummy()
     dsc.hutil.log = waagent.Log
     dsc.install_dsc_packages()
     dsc.start_omiservice()
     dsc.apply_dsc_configuration('mof/localhost.nxFile.mof')
     self.assertTrue(os.path.exists('/tmp/dsctest'))
 def test_is_statusfile_update_register(self):
     status_file = 'status/0.status'
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = MockUtil(self)
     dsc.install_dsc_packages()
     dsc.start_omiservice()
     exit_code, output = dsc.register_automation('somekey','http://dummy','','','','')
     self.verify_nodeid_vmuuid(status_file)
Example #11
0
 def test_register_invalid_configuration_mode(self):
     print "Register test case with invalid configuration mode"
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = MockUtil(self)
     dsc.install_dsc_packages()
     dsc.start_omiservice()
     exit_code, output = dsc.register_automation('somekey','http://dummy','','','','some')	
     self.assertEqual(exit_code, 51)
 def test_apply_mof(self):
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = MockUtil(self)
     dsc.install_dsc_packages()
     dsc.start_omiservice()
     config = dsc.apply_dsc_meta_configuration('mof/dscnode.nxFile.meta.push.mof')
     dsc.apply_dsc_configuration('mof/localhost.nxFile.mof')
     self.assertTrue(os.path.exists('/tmp/dsctest'))
 def test_register_without_registration_info(self):
     print "Register test case with invalid Registration url and Registration key"
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = MockUtil(self)
     dsc.install_dsc_packages()
     dsc.start_omiservice()
     exit_code, output = dsc.register_automation('','','','','','')
     self.assertEqual(exit_code, 51)
 def test_nodeid_with_dsc(self):
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = MockUtil(self)
     dsc.install_dsc_packages()
     dsc.start_omiservice()
     config = dsc.apply_dsc_meta_configuration('mof/dscnode.nxFile.meta.push.mof')
     nodeid = dsc.get_nodeid('/etc/opt/omi/conf/omsconfig/agentid')
     self.assertTrue(nodeid is not None, "nodeid is none")
Example #15
0
 def test_apply_mof(self):
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = Dummy()
     dsc.hutil.log = waagent.Log
     dsc.install_dsc_packages()
     dsc.start_omiservice()
     config = dsc.apply_dsc_meta_configuration('mof/dscnode.nxFile.meta.mof')
     self.assertTrue('ReturnValue=0' in config)
Example #16
0
 def test_apply_mof(self):
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = MockUtil(self)
     dsc.install_dsc_packages()
     dsc.start_omiservice()
     config = dsc.apply_dsc_meta_configuration(
         'mof/dscnode.nxFile.meta.push.mof')
     dsc.apply_dsc_configuration('mof/localhost.nxFile.mof')
     self.assertTrue(os.path.exists('/tmp/dsctest'))
Example #17
0
    def test_statusfile_update(self):
        status_file = 'status/0.status'
        dsc.distro_category = dsc.get_distro_category()
        dsc.hutil = MockUtil(self)

        class cresponse: deserialized_data= { "AccountName" : "test", "ResourceGroupName" : "rgName", "SubscriptionId" : "testsubid" }

        dsc.update_statusfile(status_file, '123','345', cresponse)
        self.verify_nodeid_vmuuid(status_file)
 def test_is_statusfile_update_pull(self):
     status_file = 'status/0.status'
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = MockUtil(self)
     dsc.install_dsc_packages()
     dsc.start_omiservice()
     config = dsc.apply_dsc_meta_configuration('mof/dscnode.nxFile.meta.mof')
     self.assertTrue('ReturnValue=0' in config)
     self.verify_nodeid_vmuuid(status_file)
Example #19
0
 def test_is_statusfile_update_pull(self):
     status_file = 'status/0.status'
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = MockUtil(self)
     dsc.install_dsc_packages()
     dsc.start_omiservice()
     config = dsc.apply_dsc_meta_configuration('mof/dscnode.nxFile.meta.mof')
     self.assertTrue('ReturnValue=0' in config)
     self.verify_nodeid_vmuuid(status_file)
 def test_send_request_to_pullserver(self):
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = MockUtil(self)
     dsc.install_dsc_packages()
     dsc.start_omiservice()
     config = dsc.apply_dsc_meta_configuration('mof/azureautomation.df.meta.mof')
     self.assertTrue('ReturnValue=0' in config)
     
     response  = dsc.send_heart_beat_msg_to_agent_service("install")
     self.assertEqual(response.status_code, 200)
 def test_push_request_properties(self):
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = MockUtil(self)
     dsc.install_dsc_packages()
     dsc.start_omiservice()
     config = dsc.apply_dsc_meta_configuration('mof/dscnode.nxFile.meta.push.mof')
     self.assertTrue('ReturnValue=0' in config)
     
     response  = dsc.send_heart_beat_msg_to_agent_service("install")
     self.assertIsNone(response)
 def test_is_statusfile_update_push(self):
     status_file = 'status/0.status'
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = MockUtil(self)
     dsc.install_dsc_packages()
     dsc.start_omiservice()
     config = dsc.apply_dsc_meta_configuration('mof/dscnode.nxFile.meta.push.mof')
     dsc.apply_dsc_configuration('mof/localhost.nxFile.mof')
     self.assertTrue(os.path.exists('/tmp/dsctest'))
     self.verify_nodeid_vmuuid(status_file)
Example #23
0
 def test_is_statusfile_update_push(self):
     status_file = 'status/0.status'
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = MockUtil(self)
     dsc.install_dsc_packages()
     dsc.start_omiservice()
     config = dsc.apply_dsc_meta_configuration('mof/dscnode.nxFile.meta.push.mof')
     dsc.apply_dsc_configuration('mof/localhost.nxFile.mof')
     self.assertTrue(os.path.exists('/tmp/dsctest'))
     self.verify_nodeid_vmuuid(status_file)
    def test_push_request_properties(self):
        dsc.distro_category = dsc.get_distro_category()
        dsc.hutil = MockUtil(self)
        dsc.install_dsc_packages()
        dsc.start_omiservice()
        config = dsc.apply_dsc_meta_configuration(
            'mof/dscnode.nxFile.meta.push.mof')
        self.assertTrue('ReturnValue=0' in config)

        response = dsc.send_heart_beat_msg_to_agent_service()
        self.assertIsNone(response)
    def test_send_request_to_pullserver(self):
        dsc.distro_category = dsc.get_distro_category()
        dsc.hutil = MockUtil(self)
        dsc.install_dsc_packages()
        dsc.start_omiservice()
        config = dsc.apply_dsc_meta_configuration(
            'mof/azureautomation.df.meta.mof')
        self.assertTrue('ReturnValue=0' in config)

        response = dsc.send_heart_beat_msg_to_agent_service()
        self.assertEqual(response.status_code, 200)
 def test_properties_for_pull(self):
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = MockUtil(self)
     dsc.install_dsc_packages()
     dsc.start_omiservice()
     config = dsc.apply_dsc_meta_configuration('mof/dscnode.nxFile.meta.mof')
     self.assertTrue('ReturnValue=0' in config)
     
     content = dsc.construct_node_extension_properties(config, "upgrade")
     data = json.dumps(content)
     self.assertTrue('OMSCloudId' in data, "OMSCLoudID doesn't exist")
    def test_properties_for_pull(self):
        dsc.distro_category = dsc.get_distro_category()
        dsc.hutil = MockUtil(self)
        dsc.install_dsc_packages()
        dsc.start_omiservice()
        config = dsc.apply_dsc_meta_configuration(
            'mof/dscnode.nxFile.meta.mof')
        self.assertTrue('ReturnValue=0' in config)

        content = dsc.construct_node_extension_properties(config)
        data = json.dumps(content)
        self.assertTrue('OMSCloudId' in data, "OMSCLoudID doesn't exist")
Example #28
0
 def test_nodeid_without_dsc(self):
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = MockUtil(self)
     nodeid = dsc.get_nodeid('/etc/opt/omi/conf/omsconfig/agentid1')
     self.assertTrue(nodeid is None, "nodeid is not none")
 def test_nodeid_without_dsc(self):
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = MockUtil(self)
     nodeid = dsc.get_nodeid('/etc/opt/omi/conf/omsconfig/agentid1')
     self.assertTrue(nodeid is None, "nodeid is not none")
 def test_with_lower_version(self):
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = Dummy()
     dsc.hutil.log = waagent.Log 
     output = dsc.compare_pkg_version('1.0.4.35', 1, 1, 1, 294)
     self.assertEqual(0, output)			
 def test_update_node_properties(self):
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = MockUtil(self)
     
     response  = dsc.update()
     self.assertIsNone(response)
 def test_with_higher_version(self):
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = Dummy()
     dsc.hutil.log = waagent.Log 
     output = dsc.compare_pkg_version('1.2.0.35', 1, 1, 1, 294)
     self.assertEqual(1, output)	
Example #33
0
    def test_update_node_properties(self):
        dsc.distro_category = dsc.get_distro_category()
        dsc.hutil = MockUtil(self)

        response = dsc.update()
        self.assertIsNone(response)
 def test_with_lower_version(self):
     dsc.distro_category = dsc.get_distro_category()
     dsc.hutil = Dummy()
     dsc.hutil.log = waagent.Log 
     output = dsc.compare_pkg_version('1.0.4', 1, 0, 8)
     self.assertEqual(0, output)