Example #1
0
 def test_role_filter_with_valid_runlist(self):
     """Should return a role list when a valid run list is given"""
     role_list = filters.get_role_list(self.run_list)
     expected_roles = ['dbserver', 'webserver', 'worker', 'loadbalancer']
     self.assertEqual(len(role_list), len(expected_roles))
     for role in role_list:
         self.assertTrue(role in expected_roles)
         expected_roles.remove(role)
     self.assertEqual(len(expected_roles), 0)
Example #2
0
 def test_role_filter_with_runlist_and_exclude_node_prefix(self):
     """Should exclude roles with prefix when EXCLUDE_ROLE_PREFIX is set"""
     role_to_filter = REPO['EXCLUDE_ROLE_PREFIX'] + "_filterthisrole"
     run_list_with_excluded = self.run_list + [role_to_filter]
     role_list = filters.get_role_list(run_list_with_excluded)
     expected_roles = ['dbserver', 'webserver', 'worker', 'loadbalancer']
     self.assertEqual(len(role_list), len(expected_roles))
     for role in role_list:
         self.assertTrue(role in expected_roles)
         expected_roles.remove(role)
     self.assertEqual(len(expected_roles), 0)
Example #3
0
 def test_role_filter_with_wrong_runlist(self):
     """Should return an empty role list when an invalid run list is given
     """
     role_list = filters.get_role_list(None)
     self.assertEqual(role_list, [])