def test_primary_node_selected(self):
        cluster = self.create_env()
        ha_nodes = DeploymentHASerializer.serialize_nodes(cluster.nodes)
        mn_nodes = DeploymentMultinodeSerializer.serialize_nodes(cluster.nodes)

        def primary_nodes_count(nodes):
            return len(filter(lambda x: x['role'] == 'primary-mongo', nodes))

        self.assertEquals(1, primary_nodes_count(ha_nodes))
        self.assertEquals(1, primary_nodes_count(mn_nodes))
Ejemplo n.º 2
0
    def test_primary_node_selected(self):
        cluster = self.create_env()
        ha_nodes = DeploymentHASerializer.serialize_nodes(cluster.nodes)
        mn_nodes = DeploymentMultinodeSerializer.serialize_nodes(cluster.nodes)

        def primary_nodes_count(nodes):
            return len(filter(lambda x: x['role'] == 'primary-mongo', nodes))

        self.assertEquals(1, primary_nodes_count(ha_nodes))
        self.assertEquals(1, primary_nodes_count(mn_nodes))
 def test_set_deployment_priorities(self):
     nodes = [
         {'role': 'mongo'},
         {'role': 'mongo'},
         {'role': 'primary-mongo'},
         {'role': 'controller'},
         {'role': 'ceph-osd'},
         {'role': 'other'}
     ]
     serializer = DeploymentMultinodeSerializer()
     serializer.set_deployment_priorities(nodes)
     expected_priorities = [
         {'role': 'mongo', 'priority': 100},
         {'role': 'mongo', 'priority': 200},
         {'role': 'primary-mongo', 'priority': 300},
         {'role': 'controller', 'priority': 400},
         {'role': 'ceph-osd', 'priority': 500},
         {'role': 'other', 'priority': 500}
     ]
     self.assertEquals(expected_priorities, nodes)
 def test_set_critital_node(self):
     nodes = [
         {'role': 'mongo'},
         {'role': 'mongo'},
         {'role': 'primary-mongo'},
         {'role': 'controller'},
         {'role': 'ceph-osd'},
         {'role': 'other'}
     ]
     serializer = DeploymentMultinodeSerializer()
     serializer.set_critical_nodes(self.cluster, nodes)
     expected_ciritial_roles = [
         {'role': 'mongo', 'fail_if_error': False},
         {'role': 'mongo', 'fail_if_error': False},
         {'role': 'primary-mongo', 'fail_if_error': True},
         {'role': 'controller', 'fail_if_error': True},
         {'role': 'ceph-osd', 'fail_if_error': True},
         {'role': 'other', 'fail_if_error': False}
     ]
     self.assertEqual(expected_ciritial_roles, nodes)
Ejemplo n.º 5
0
 def test_set_deployment_priorities(self):
     nodes = [{
         'role': 'mongo'
     }, {
         'role': 'mongo'
     }, {
         'role': 'primary-mongo'
     }, {
         'role': 'controller'
     }, {
         'role': 'ceph-osd'
     }, {
         'role': 'other'
     }]
     serializer = DeploymentMultinodeSerializer()
     serializer.set_deployment_priorities(nodes)
     expected_priorities = [{
         'role': 'mongo',
         'priority': 100
     }, {
         'role': 'mongo',
         'priority': 200
     }, {
         'role': 'primary-mongo',
         'priority': 300
     }, {
         'role': 'controller',
         'priority': 400
     }, {
         'role': 'ceph-osd',
         'priority': 500
     }, {
         'role': 'other',
         'priority': 500
     }]
     self.assertEquals(expected_priorities, nodes)
 def serialize(self, cluster):
     TaskHelper.prepare_for_deployment(cluster.nodes)
     return DeploymentMultinodeSerializer.serialize(cluster, cluster.nodes)
 def test_mongo_roles_equals_in_defferent_modes(self):
     cluster = self.create_env()
     ha_nodes = DeploymentHASerializer.serialize_nodes(cluster.nodes)
     mn_nodes = DeploymentMultinodeSerializer.serialize_nodes(cluster.nodes)
     self.assertEquals(mn_nodes, ha_nodes)
Ejemplo n.º 8
0
 def serialize(self, cluster):
     TaskHelper.prepare_for_deployment(cluster.nodes)
     return DeploymentMultinodeSerializer.serialize(cluster, cluster.nodes)
Ejemplo n.º 9
0
 def test_mongo_roles_equals_in_defferent_modes(self):
     cluster = self.create_env()
     ha_nodes = DeploymentHASerializer.serialize_nodes(cluster.nodes)
     mn_nodes = DeploymentMultinodeSerializer.serialize_nodes(cluster.nodes)
     self.assertEquals(mn_nodes, ha_nodes)