예제 #1
0
    def test_stop_plugin_nginx_reload(self):
        plugin = NginxPlugin()

        plugin.start_plugin(
            {
                'server_name': 'http//www.example.org',
                'vhost_file': self.make_temp_file(),
                'locations_dir': self.make_temp_dir()
            }, JunebugConfig({}))

        properties = self.create_channel_properties(config={
            'web_path': '/foo/bar',
            'web_port': 2323,
        })

        chan4 = yield self.create_channel(self.service,
                                          self.redis,
                                          id='chan4',
                                          properties=properties)

        chan5 = yield self.create_channel(self.service,
                                          self.redis,
                                          id='chan5',
                                          properties=properties)

        plugin.channel_started(chan4)
        plugin.channel_started(chan5)

        self.nginx_reloads()  # flush reloads
        plugin.stop_plugin()
        self.assertEqual(self.nginx_reloads(), 1)
예제 #2
0
    def test_stop_plugin_nginx_reload(self):
        plugin = NginxPlugin()

        plugin.start_plugin({
            'server_name': 'http//www.example.org',
            'vhost_file': self.make_temp_file(),
            'locations_dir': self.make_temp_dir()
        }, JunebugConfig({}))

        properties = self.create_channel_properties(
            web_path='/foo/bar',
            web_port=2323)

        chan4 = yield self.create_channel(
            self.service, self.redis, id='chan4', properties=properties)

        chan5 = yield self.create_channel(
            self.service, self.redis, id='chan5', properties=properties)

        plugin.channel_started(chan4)
        plugin.channel_started(chan5)

        calls = self.patch_subprocess_call((
            (['which', 'nginx'], 0),
        ))

        plugin.stop_plugin()

        self.assertEqual(calls.count(['nginx', '-s', 'reload']), 1)
예제 #3
0
    def test_stop_plugin_nginx_reload(self):
        plugin = NginxPlugin()

        plugin.start_plugin(
            {
                'server_name': 'http//www.example.org',
                'vhost_file': self.make_temp_file(),
                'locations_dir': self.make_temp_dir()
            }, JunebugConfig({}))

        properties = self.create_channel_properties(web_path='/foo/bar',
                                                    web_port=2323)

        chan4 = yield self.create_channel(self.service,
                                          self.redis,
                                          id='chan4',
                                          properties=properties)

        chan5 = yield self.create_channel(self.service,
                                          self.redis,
                                          id='chan5',
                                          properties=properties)

        plugin.channel_started(chan4)
        plugin.channel_started(chan5)

        calls = self.patch_subprocess_call(((['which', 'nginx'], 0), ))

        plugin.stop_plugin()

        self.assertEqual(calls.count(['nginx', '-s', 'reload']), 1)
예제 #4
0
    def test_stop_plugin_nginx_reload(self):
        plugin = NginxPlugin()

        plugin.start_plugin({
            'server_name': 'http//www.example.org',
            'vhost_file': self.make_temp_file(),
            'locations_dir': self.make_temp_dir()
        }, JunebugConfig({}))

        properties = self.create_channel_properties(config={
            'web_path': '/foo/bar',
            'web_port': 2323,
        })

        chan4 = yield self.create_channel(
            self.service, self.redis, id='chan4', properties=properties)

        chan5 = yield self.create_channel(
            self.service, self.redis, id='chan5', properties=properties)

        plugin.channel_started(chan4)
        plugin.channel_started(chan5)

        self.nginx_reloads()  # flush reloads
        plugin.stop_plugin()
        self.assertEqual(self.nginx_reloads(), 1)
예제 #5
0
    def test_stop_plugin_remove_vhost_config(self):
        plugin = NginxPlugin()
        vhost_filename = self.make_temp_file()

        plugin.start_plugin({
            'server_name': 'http//www.example.org',
            'vhost_file': vhost_filename,
            'locations_dir': self.make_temp_dir()
        }, JunebugConfig({}))

        self.assertTrue(path.exists(vhost_filename))
        plugin.stop_plugin()
        self.assertFalse(path.exists(vhost_filename))
예제 #6
0
    def test_stop_plugin_remove_vhost_config(self):
        plugin = NginxPlugin()
        vhost_filename = self.make_temp_file()

        plugin.start_plugin(
            {
                'server_name': 'http//www.example.org',
                'vhost_file': vhost_filename,
                'locations_dir': self.make_temp_dir()
            }, JunebugConfig({}))

        self.assertTrue(path.exists(vhost_filename))
        plugin.stop_plugin()
        self.assertFalse(path.exists(vhost_filename))
예제 #7
0
    def test_stop_plugin_remove_location_configs(self):
        plugin = NginxPlugin()
        locations_dirname = self.make_temp_dir()

        plugin.start_plugin(
            {
                'server_name': 'http//www.example.org',
                'vhost_file': self.make_temp_file(),
                'locations_dir': locations_dirname
            }, JunebugConfig({}))

        properties = self.create_channel_properties(config={
            'web_path': '/foo/bar',
            'web_port': 2323,
        })

        chan4 = yield self.create_channel(self.service,
                                          self.redis,
                                          id='chan4',
                                          properties=properties)

        chan5 = yield self.create_channel(self.service,
                                          self.redis,
                                          id='chan5',
                                          properties=properties)

        plugin.channel_started(chan4)
        plugin.channel_started(chan5)

        self.assertTrue(path.exists(path.join(locations_dirname,
                                              'chan4.conf')))

        self.assertTrue(path.exists(path.join(locations_dirname,
                                              'chan5.conf')))

        plugin.stop_plugin()

        self.assertFalse(
            path.exists(path.join(locations_dirname, 'chan4.conf')))

        self.assertFalse(
            path.exists(path.join(locations_dirname, 'chan5.conf')))
예제 #8
0
    def test_stop_plugin_remove_location_configs(self):
        plugin = NginxPlugin()
        locations_dirname = self.make_temp_dir()

        plugin.start_plugin({
            'server_name': 'http//www.example.org',
            'vhost_file': self.make_temp_file(),
            'locations_dir': locations_dirname
        }, JunebugConfig({}))

        properties = self.create_channel_properties(config={
            'web_path': '/foo/bar',
            'web_port': 2323,
        })

        chan4 = yield self.create_channel(
            self.service, self.redis, id='chan4', properties=properties)

        chan5 = yield self.create_channel(
            self.service, self.redis, id='chan5', properties=properties)

        plugin.channel_started(chan4)
        plugin.channel_started(chan5)

        self.assertTrue(
            path.exists(path.join(locations_dirname, 'chan4.conf')))

        self.assertTrue(
            path.exists(path.join(locations_dirname, 'chan5.conf')))

        plugin.stop_plugin()

        self.assertFalse(
            path.exists(path.join(locations_dirname, 'chan4.conf')))

        self.assertFalse(
            path.exists(path.join(locations_dirname, 'chan5.conf')))