Ejemplo n.º 1
0
 def test_db_joined(self):
     self.get_relation_ip.return_value = '10.0.0.1'
     relations.db_joined()
     self.relation_set.assert_called_with(database='glance',
                                          username='******',
                                          hostname='10.0.0.1')
     self.get_relation_ip.assert_called_with('shared-db', cidr_network=None)
Ejemplo n.º 2
0
 def test_db_joined(self):
     self.unit_get.return_value = 'glance.foohost.com'
     self.is_relation_made.return_value = False
     relations.db_joined()
     self.relation_set.assert_called_with(database='glance',
                                          username='******',
                                          hostname='glance.foohost.com')
     self.unit_get.assert_called_with('private-address')
Ejemplo n.º 3
0
    def test_db_joined_with_postgresql(self):
        self.is_relation_made.return_value = True

        with self.assertRaises(Exception) as context:
            relations.db_joined()
        self.assertEqual(context.exception.message,
                         'Attempting to associate a mysql database when there '
                         'is already associated a postgresql one')
Ejemplo n.º 4
0
 def test_db_joined(self):
     self.unit_get.return_value = 'glance.foohost.com'
     self.is_relation_made.return_value = False
     relations.db_joined()
     self.relation_set.assert_called_with(database='glance',
                                          username='******',
                                          hostname='glance.foohost.com')
     self.unit_get.assert_called_with('private-address')
    def test_db_joined_with_postgresql(self):
        self.is_relation_made.return_value = True

        with self.assertRaises(Exception) as context:
            relations.db_joined()
        self.assertEqual(
            context.exception.message,
            'Attempting to associate a mysql database when there '
            'is already associated a postgresql one')
Ejemplo n.º 6
0
 def test_db_joined_network_spaces(self):
     self.network_get_primary_address.side_effect = None
     self.network_get_primary_address.return_value = '192.168.20.1'
     self.unit_get.return_value = 'glance.foohost.com'
     self.is_relation_made.return_value = False
     relations.db_joined()
     self.relation_set.assert_called_with(database='glance',
                                          username='******',
                                          hostname='192.168.20.1')
     self.assertFalse(self.unit_get.called)
Ejemplo n.º 7
0
 def test_db_joined_network_spaces(self):
     self.network_get_primary_address.side_effect = None
     self.network_get_primary_address.return_value = '192.168.20.1'
     self.unit_get.return_value = 'glance.foohost.com'
     self.is_relation_made.return_value = False
     relations.db_joined()
     self.relation_set.assert_called_with(database='glance',
                                          username='******',
                                          hostname='192.168.20.1')
     self.assertFalse(self.unit_get.called)
Ejemplo n.º 8
0
    def test_db_joined_with_ipv6(self):
        self.test_config.set('prefer-ipv6', True)
        self.is_relation_made.return_value = False
        relations.db_joined()
        relation_data = {
            'database': 'glance',
            'username': '******',
        }
        relation_data['hostname'] = '2001:db8:1::1'

        self.sync_db_with_multi_ipv6_addresses.assert_called_with(
            'glance', 'glance')
Ejemplo n.º 9
0
    def test_db_joined_with_ipv6(self):
        self.test_config.set('prefer-ipv6', True)
        self.is_relation_made.return_value = False
        relations.db_joined()
        relation_data = {
            'database': 'glance',
            'username': '******',
        }
        relation_data['hostname'] = '2001:db8:1::1'

        self.sync_db_with_multi_ipv6_addresses.assert_called_with(
            'glance', 'glance')