def test_remove_proxy_config(self): """ Test removing proxy service for an app. """ self._mock_local_privileged() expected_site_file = os.path.join(taskconfig.NGINX_SITES_ENABLED_DIR, self.app_id) # first try remove before it's created; that should crash self.assertFalse(os.path.isfile(expected_site_file)) with self.assertRaises(utils.InfrastructureException): nginx.remove_local_proxy_config(self.app_id) # now create nginx.update_local_proxy_config( self.app_id, self.bundle_name, self.appservers, self.virtual_hostnames, self.site_media_map, bundle_storage_engine=nginx.SKIP_BUNDLE_INSTALL, ) self.assertTrue(os.path.isfile(expected_site_file)) self.assertEqual(len(self.local_privileged_cmds), 1) self.assertEqual(self.local_privileged_cmds[0], ["kick_nginx"]) # now remove for real nginx.remove_local_proxy_config(self.app_id) self.assertFalse(os.path.isfile(expected_site_file)) self.assertEqual(len(self.local_privileged_cmds), 2) self.assertEqual(self.local_privileged_cmds[1], ["kick_nginx"])
def remove_proxy_conf(job_id, zoomdb, app_id): nginx.remove_local_proxy_config(app_id)