def test_delete_member(self):
        created = db_api.create_member(MEMBERS[0])

        fetched = db_api.get_member(created.name)

        self.assertEqual(created, fetched)

        db_api.delete_member(created.name)

        self.assertRaises(exc.NotFoundException, db_api.get_member, created.name)
Esempio n. 2
0
    def test_delete_member(self):
        created = db_api.create_member(MEMBERS[0])

        fetched = db_api.get_member(created.name)

        self.assertEqual(created, fetched)

        db_api.delete_member(created.name)

        self.assertRaises(
            exc.NotFoundException,
            db_api.get_member,
            created.name
        )
Esempio n. 3
0
    def test_delete_member(self, replace_file):
        listener = db_api.create_listener({
            'name': 'test_listener',
            'description': 'my test settings',
            'protocol': 'http',
            'protocol_port': 80,
            'algorithm': 'roundrobin'
        })

        # Create a listener first.
        self.haproxy.create_listener(listener)

        listener = db_api.get_listener('test_listener')

        member = db_api.create_member({
            'listener_id': listener.id,
            'name': 'member1',
            'address': '10.0.0.1',
            'protocol_port': 80,
        })

        self.haproxy.create_member(member)

        member = db_api.get_member('member1')

        config_data = replace_file.call_args[0][1]

        self.assertIn(
            '\tserver %s %s:%s' %
            (member.name, member.address, member.protocol_port),
            config_data
        )

        db_api.delete_member(member.name)

        self.haproxy.delete_member(member)

        config_data = replace_file.call_args[0][1]

        self.assertNotIn(
            '\tserver %s %s:%s' %
            (member.name, member.address, member.protocol_port),
            config_data
        )
        self.assertRaises(
            exc.NotFoundException,
            db_api.get_member,
            member.name
        )
Esempio n. 4
0
    def test_delete_member(self, replace_file):
        listener = db_api.create_listener({
            'name': 'test_listener',
            'description': 'my test settings',
            'protocol': 'http',
            'protocol_port': 80,
            'algorithm': 'roundrobin'
        })

        # Create a listener first.
        self.haproxy.create_listener(listener)

        listener = db_api.get_listener('test_listener')

        member = db_api.create_member({
            'listener_id': listener.id,
            'name': 'member1',
            'address': '10.0.0.1',
            'protocol_port': 80,
        })

        self.haproxy.create_member(member)

        member = db_api.get_member('member1')

        config_data = replace_file.call_args[0][1]

        self.assertIn(
            '\tserver %s %s:%s' %
            (member.name, member.address, member.protocol_port), config_data)

        db_api.delete_member(member.name)

        self.haproxy.delete_member(member)

        config_data = replace_file.call_args[0][1]

        self.assertNotIn(
            '\tserver %s %s:%s' %
            (member.name, member.address, member.protocol_port), config_data)
        self.assertRaises(exc.NotFoundException, db_api.get_member,
                          member.name)