Пример #1
0
 def test_is_perf_monitored_resource_list(self):
     cli = self.perf_mon()
     cli._rsc_clz_list = [UnityDisk]
     assert_that(cli._is_perf_monitored(UnityDiskList(cli=cli)),
                 equal_to(True))
     assert_that(cli._is_perf_monitored(UnityLunList(cli=cli)),
                 equal_to(False))
Пример #2
0
 def test_make_body_complex(self):
     service_levels = [ServiceLevelEnum.BASIC, ServiceLevelEnum.BRONZE]
     param = {
         'a': 1,
         'b': UnityLun(_id='lun1'),
         'c': UnityLunList(cli=t_rest()),
         'd': [UnityLun(_id='lun10'),
               UnityLun(_id='lun11'), 0.1],
         'e': {
             'f': UnityLun(_id='lun12')
         },
         'g': 'string',
         'h': 0.2,
         'i': service_levels,
         'j': ServiceLevelEnumList.parse(service_levels)
     }
     ret = UnityClient.make_body(param)
     expected = {
         'a':
         1,
         'b': {
             'id': 'lun1'
         },
         'c': [{
             'id': 'sv_2'
         }, {
             'id': 'sv_3'
         }, {
             'id': 'sv_5'
         }, {
             'id': 'sv_6'
         }, {
             'id': 'sv_7'
         }],
         'd': [{
             'id': 'lun10'
         }, {
             'id': 'lun11'
         }, 0.1],
         'e': {
             'f': {
                 'id': 'lun12'
             }
         },
         'g':
         'string',
         'h':
         0.2,
         'i': [0, 1],
         'j': [0, 1]
     }
     assert_that(ret, equal_to(expected))
Пример #3
0
    def test_is_perf_metric_enabled_rsc_specific(self):
        cli = self.perf_mon()
        cli.enable_perf_metric(0, lambda: 1, [UnityDisk])
        enabled = cli.is_perf_metric_enabled(UnityDiskList(cli=cli))
        assert_that(enabled, equal_to(True))

        enabled = cli.is_perf_metric_enabled(UnityLunList(cli=cli))
        assert_that(enabled, equal_to(False))

        enabled = cli.is_perf_metric_enabled(UnityDisk(_id='', cli=cli))
        assert_that(enabled, equal_to(True))

        enabled = cli.is_perf_metric_enabled(UnityLun(_id='', cli=cli))
        assert_that(enabled, equal_to(False))
Пример #4
0
 def test_get_lun_all_0(self):
     lun_list = UnityLunList.get(cli=t_rest())
     assert_that(len(lun_list), equal_to(5))
Пример #5
0
 def test_get_lun_sv3_nested_property_no_update(self):
     lun = UnityLunList.get(_id='sv_3', cli=t_rest())
     sr = lun.storage_resource
     assert_that(sr._cli, equal_to(t_rest()))
Пример #6
0
 def test_get_lun_all_0(self):
     lun_list = UnityLunList.get(cli=t_rest())
     assert_that(len(lun_list), equal_to(5))
Пример #7
0
 def test_get_lun_sv3_nested_property_no_update(self):
     lun = UnityLunList.get(_id='sv_3', cli=t_rest())
     sr = lun.storage_resource
     assert_that(sr._cli, equal_to(t_rest()))