def test_with_right_number_of_unique_disks_both_nodes(self): # suppose that the user has specified two nodes, and two EBS / PD disks # with different names. This is the desired user behavior. input_yaml = TWO_NODES_TWO_DISKS_CLOUD options = self.default_options.copy() options['ips'] = input_yaml layout = NodeLayout(options) self.assertNotEqual([], layout.nodes) self.assertEquals(DISK_ONE, layout.head_node().disk) self.assertEquals(DISK_TWO, layout.other_nodes()[0].disk)
def test_with_right_number_of_unique_disks_both_nodes(self): # suppose that the user has specified two nodes, and two EBS / PD disks # with different names. This is the desired user behavior. input_yaml = TWO_NODES_TWO_DISKS_CLOUD options = self.default_options.copy() options['ips'] = input_yaml layout = NodeLayout(options) self.assertNotEqual([], layout.nodes) self.assertEquals(DISK_ONE, layout.head_node().disk) self.assertEquals(DISK_TWO, layout.other_nodes()[0].disk)
def test_new_with_right_number_of_unique_disks_one_node(self): # suppose that the user has specified two nodes, and two EBS / PD disks # with different names. This is the desired user behavior. input_yaml = [ {'roles': ['master', 'database'], 'nodes': 1, 'instance_type': 'm1.large'}, {'roles': ['appengine'], 'nodes': 2, 'instance_type': 'm1.large', 'disks': [self.DISK_ONE, self.DISK_TWO]}] options = self.default_options.copy() options['ips'] = input_yaml layout = NodeLayout(options) self.assertNotEqual([], layout.nodes) self.assertEquals(self.DISK_ONE, layout.other_nodes()[0].disk) self.assertEquals(self.DISK_TWO, layout.other_nodes()[1].disk)
def test_with_right_number_of_unique_disks(self): # suppose that the user has specified two nodes, and two EBS / PD disks # with different names. This is the desired user behavior. input_yaml = {'controller': self.ip_1, 'servers': [self.ip_2]} options = self.default_options.copy() options['ips'] = input_yaml options['disks'] = { self.ip_1: 'disk_number_one', self.ip_2: 'disk_number_two' } layout = NodeLayout(options) self.assertEquals(True, layout.is_valid()) self.assertEquals('disk_number_one', layout.head_node().disk) self.assertEquals('disk_number_two', layout.other_nodes()[0].disk)
def test_with_right_number_of_unique_disks(self): # suppose that the user has specified two nodes, and two EBS / PD disks # with different names. This is the desired user behavior. input_yaml = { 'controller' : self.ip_1, 'servers' : [self.ip_2] } options = self.default_options.copy() options['ips'] = input_yaml options['disks'] = { self.ip_1 : 'disk_number_one', self.ip_2 : 'disk_number_two' } layout = NodeLayout(options) self.assertEquals(True, layout.is_valid()) self.assertEquals('disk_number_one', layout.head_node().disk) self.assertEquals('disk_number_two', layout.other_nodes()[0].disk)
def test_new_with_right_number_of_unique_disks_one_node(self): # suppose that the user has specified two nodes, and two EBS / PD disks # with different names. This is the desired user behavior. input_yaml = [{ 'roles': ['master', 'database'], 'nodes': 1, 'instance_type': 'm1.large' }, { 'roles': ['appengine'], 'nodes': 2, 'instance_type': 'm1.large', 'disks': [self.DISK_ONE, self.DISK_TWO] }] options = self.default_options.copy() options['ips'] = input_yaml layout = NodeLayout(options) self.assertNotEqual([], layout.nodes) self.assertEquals(self.DISK_ONE, layout.other_nodes()[0].disk) self.assertEquals(self.DISK_TWO, layout.other_nodes()[1].disk)