Ejemplo n.º 1
0
 def setUp(self):
     super(TestProtectionGroup, self).setUp()
     self.sess = mock.Mock(spec=adapter.Adapter)
     self.sess.get = mock.Mock()
     self.sess.default_microversion = '1'
     self.sess._get_connection = mock.Mock(return_value=self.cloud)
     self.sot = _protection_group.ProtectionGroup()
Ejemplo n.º 2
0
 def test_delete_protection_group_tasks(self):
     endpoint = self.proxy.get_endpoint()
     group = _protection_group.ProtectionGroup()
     self._verify(
         mock_method='otcextensions.sdk.sdrs.v1.task_center.'
                     'FailedTask.delete_protection_tasks',
         test_method=self.proxy.delete_protection_group_tasks,
         method_args=[group],
         expected_args=[self.session, endpoint, group.id]
     )
Ejemplo n.º 3
0
 def test_disable_protection(self):
     group = _protection_group.ProtectionGroup()
     self._verify(
         'otcextensions.sdk.sdrs.v1.protection_group.'
         'ProtectionGroup.disable_protection_group',
         self.proxy.disable_protection,
         method_args=[group],
         expected_args=[self.proxy],
         expected_kwargs={
             'protection_group': group.id
         }
     )
Ejemplo n.º 4
0
 def test_protection_group_update(self):
     group = _protection_group.ProtectionGroup()
     name = 'name'
     self._verify(
         'openstack.proxy.Proxy._update',
         self.proxy.update_protection_group,
         method_args=[group, name],
         expected_args=[_protection_group.ProtectionGroup, group],
         expected_kwargs={
             'name': name
         }
     )
Ejemplo n.º 5
0
 def test_perfrom_failover(self):
     group = _protection_group.ProtectionGroup()
     self._verify(
         'otcextensions.sdk.sdrs.v1.protection_group.'
         'ProtectionGroup.perform_failover',
         self.proxy.perform_failover,
         method_args=[group],
         expected_args=[self.proxy],
         expected_kwargs={
             'protection_group': group.id
         }
     )
Ejemplo n.º 6
0
 def test_perfrom_planned_failover(self):
     group = _protection_group.ProtectionGroup()
     priority_station = 'target'
     self._verify(
         'otcextensions.sdk.sdrs.v1.protection_group.'
         'ProtectionGroup.perform_planned_failover',
         self.proxy.perform_planned_failover,
         method_args=[group, priority_station],
         expected_args=[self.proxy],
         expected_kwargs={
             'protection_group': group.id,
             'priority_station': priority_station
         }
     )
Ejemplo n.º 7
0
 def test_make_it(self):
     test_protection_group = _protection_group.ProtectionGroup(**EXAMPLE)
     self.assertEqual(EXAMPLE['id'], test_protection_group.id)
     self.assertEqual(EXAMPLE['description'],
                      test_protection_group.description)
     self.assertEqual(EXAMPLE['source_availability_zone'],
                      test_protection_group.source_availability_zone)
     self.assertEqual(EXAMPLE['target_availability_zone'],
                      test_protection_group.target_availability_zone)
     self.assertEqual(EXAMPLE['domain_id'], test_protection_group.domain_id)
     self.assertEqual(EXAMPLE['domain_name'],
                      test_protection_group.domain_name)
     self.assertEqual(EXAMPLE['status'], test_protection_group.status)
     self.assertEqual(EXAMPLE['protected_status'],
                      test_protection_group.protected_status)
     self.assertEqual(EXAMPLE['replication_status'],
                      test_protection_group.replication_status)
     self.assertEqual(EXAMPLE['health_status'],
                      test_protection_group.health_status)
     self.assertEqual(EXAMPLE['progress'], test_protection_group.progress)
     self.assertEqual(EXAMPLE['priority_station'],
                      test_protection_group.priority_station)
     self.assertEqual(EXAMPLE['protected_instance_num'],
                      test_protection_group.protected_instance_num)
     self.assertEqual(EXAMPLE['replication_num'],
                      test_protection_group.replication_num)
     self.assertEqual(EXAMPLE['disaster_recovery_drill_num'],
                      test_protection_group.disaster_recovery_drill_num)
     self.assertEqual(EXAMPLE['source_vpc_id'],
                      test_protection_group.source_vpc_id)
     self.assertEqual(EXAMPLE['target_vpc_id'],
                      test_protection_group.target_vpc_id)
     self.assertEqual(EXAMPLE['test_vpc_id'],
                      test_protection_group.test_vpc_id)
     self.assertEqual(EXAMPLE['dr_type'], test_protection_group.dr_type)
     self.assertEqual(EXAMPLE['created_at'],
                      test_protection_group.created_at)
     self.assertEqual(EXAMPLE['updated_at'],
                      test_protection_group.updated_at)
     self.assertEqual(EXAMPLE['protection_type'],
                      test_protection_group.protection_type)
     self.assertEqual(EXAMPLE['replication_model'],
                      test_protection_group.replication_model)
Ejemplo n.º 8
0
 def test_basic(self):
     sot = _protection_group.ProtectionGroup()
     self.assertEqual('server_group', sot.resource_key)
     self.assertEqual('server_groups', sot.resources_key)
     self.assertEqual('/server-groups', sot.base_path)
     self.assertTrue(sot.allow_list)
     self.assertTrue(sot.allow_create)
     self.assertTrue(sot.allow_fetch)
     self.assertTrue(sot.allow_commit)
     self.assertTrue(sot.allow_delete)
     self.assertDictEqual(
         {
             'availability_zone': 'availability_zone',
             'limit': 'limit',
             'marker': 'marker',
             'name': 'name',
             'offset': 'offset',
             'query_type': 'query_type',
             'status': 'status'
         }, sot._query_mapping._mapping)