Exemple #1
0
 def test_no_sites(self):
     cfg = facade.Facade({
         "local": {
             "role": DrRole.PRIMARY.value,
         },
         "remote_sites": [],
     })
     self.assertEqual(cfg.get_remote_site_list(), [])
Exemple #2
0
 def test_local_role(self):
     for role in DrRole:
         with self.subTest(local_role=role.value):
             cfg = facade.Facade({
                 "local": {
                     "role": role.value,
                 },
                 "remote_sites": [],
             })
             self.assertEqual(cfg.local_role, role)
Exemple #3
0
 def test_no_nodes(self):
     cfg = facade.Facade({
         "local": {
             "role": DrRole.PRIMARY.value,
         },
         "remote_sites": [
             {
                 "role": DrRole.RECOVERY.value,
                 "nodes": [],
             },
         ],
     })
     self.assertEqual(cfg.get_remote_site_list(), [
         facade.DrSite(role=DrRole.RECOVERY, node_name_list=[]),
     ])
Exemple #4
0
 def test_more_sites(self):
     cfg = facade.Facade({
         "local": {
             "role": DrRole.RECOVERY.value,
         },
         "remote_sites": [
             {
                 "role": DrRole.PRIMARY.value,
                 "nodes": [
                     {
                         "name": "nodeA1"
                     },
                     {
                         "name": "nodeA2"
                     },
                 ],
             },
             {
                 "role": DrRole.RECOVERY.value,
                 "nodes": [
                     {
                         "name": "nodeB1"
                     },
                     {
                         "name": "nodeB2"
                     },
                 ],
             },
         ],
     })
     self.assertEqual(
         cfg.get_remote_site_list(),
         [
             facade.DrSite(role=DrRole.PRIMARY,
                           node_name_list=["nodeA1", "nodeA2"]),
             facade.DrSite(role=DrRole.RECOVERY,
                           node_name_list=["nodeB1", "nodeB2"]),
         ],
     )