def test_db_joined(self): self.is_relation_made.return_value = False hooks.db_joined() self.relation_set.assert_called_with(relation_id=None, nova_database='nova', nova_username='******', nova_hostname='10.0.0.50') self.get_relation_ip.assert_called_with('shared-db')
def test_db_joined_with_postgresql(self): self.is_relation_made.return_value = True with self.assertRaises(Exception) as context: hooks.db_joined() self.assertEqual(context.exception.message, 'Attempting to associate a mysql database when there ' 'is already associated a postgresql one')
def test_db_joined(self): self.unit_get.return_value = 'nova.foohost.com' hooks.db_joined() self.relation_set.assert_called_with(relation_id=None, nova_database='nova', nova_username='******', nova_hostname='nova.foohost.com') self.unit_get.assert_called_with('private-address')
def test_db_joined(self): self.unit_get.return_value = 'nova.foohost.com' self.is_relation_made.return_value = False hooks.db_joined() self.relation_set.assert_called_with(relation_id=None, nova_database='nova', nova_username='******', nova_hostname='nova.foohost.com') self.unit_get.assert_called_with('private-address')
def test_db_joined_quantum_nvp(self): self.unit_get.return_value = 'nova.foohost.com' self.network_manager.return_value = 'quantum' self.neutron_plugin.return_value = 'nvp' hooks.db_joined(rid='shared-db:0') calls = [call(nova_database='nova', nova_username='******', nova_hostname='nova.foohost.com', relation_id='shared-db:0')] # NVP plugin requires no DB access - check it was not # requested [self.assertIn(c, self.relation_set.call_args_list) for c in calls] self.unit_get.assert_called_with('private-address')
def test_db_joined_quantum_ovs(self): self.unit_get.return_value = 'nova.foohost.com' self.network_manager.return_value = 'quantum' self.neutron_plugin.return_value = 'ovs' hooks.db_joined(rid='shared-db:0') calls = [call(nova_database='nova', nova_username='******', nova_hostname='nova.foohost.com', relation_id='shared-db:0'), call(neutron_database='neutron', neutron_username='******', neutron_hostname='nova.foohost.com', relation_id='shared-db:0')] [self.assertIn(c, self.relation_set.call_args_list) for c in calls] self.unit_get.assert_called_with('private-address')