Ejemplo n.º 1
0
    def test_delete_listener(self, replace_file):
        # Create a listener first.
        listener = db_api.create_listener({
            'name': 'test_listener',
            'description': 'my test settings',
            'protocol': 'http',
            'protocol_port': 80,
            'algorithm': 'roundrobin'
        })

        self.haproxy.create_listener(listener)

        listener = db_api.get_listener('test_listener')

        config_data = replace_file.call_args[0][1]

        self.assertIn('frontend %s' % listener.name, config_data)

        db_api.delete_listener(listener.name)

        self.haproxy.delete_listener(listener.name)

        config_data = replace_file.call_args[0][1]

        self.assertNotIn('frontend %s' % listener.name, config_data)
        self.assertRaises(exc.NotFoundException, db_api.get_listener,
                          listener.name)
Ejemplo n.º 2
0
    def test_delete_listener(self):
        created = db_api.create_listener(LISTENERS[0])

        fetched = db_api.get_listener(created.name)

        self.assertEqual(created, fetched)

        db_api.delete_listener(created.name)

        self.assertRaises(exc.NotFoundException, db_api.get_listener, created.name)
Ejemplo n.º 3
0
    def test_delete_listener(self):
        created = db_api.create_listener(LISTENERS[0])

        fetched = db_api.get_listener(created.name)

        self.assertEqual(created, fetched)

        db_api.delete_listener(created.name)

        self.assertRaises(
            exc.NotFoundException,
            db_api.get_listener,
            created.name
        )
Ejemplo n.º 4
0
    def test_delete_listener(self, replace_file):
        # Create a listener first.
        listener = db_api.create_listener({
            'name': 'test_listener',
            'description': 'my test settings',
            'protocol': 'http',
            'protocol_port': 80,
            'algorithm': 'roundrobin'
        })

        self.haproxy.create_listener(listener)

        listener = db_api.get_listener('test_listener')

        config_data = replace_file.call_args[0][1]

        self.assertIn(
            'frontend %s' % listener.name,
            config_data
        )

        db_api.delete_listener(listener.name)

        self.haproxy.delete_listener(listener.name)

        config_data = replace_file.call_args[0][1]

        self.assertNotIn(
            'frontend %s' % listener.name,
            config_data
        )
        self.assertRaises(
            exc.NotFoundException,
            db_api.get_listener,
            listener.name
        )