2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-25 07:58:24 +00:00

[fix] [test] disable production after test, reread and update supervisor

This commit is contained in:
Anand Doshi 2016-07-14 15:04:51 +05:30
parent 3b1e23b1b2
commit 97a4a30432
2 changed files with 13 additions and 4 deletions

View File

@ -1,4 +1,4 @@
from bench.utils import get_program, exec_cmd, get_cmd_output, fix_prod_setup_perms, get_bench_name, find_executable from bench.utils import get_program, exec_cmd, get_cmd_output, fix_prod_setup_perms, get_bench_name, find_executable, CommandFailedError
from bench.config.supervisor import generate_supervisor_config from bench.config.supervisor import generate_supervisor_config
from bench.config.nginx import make_nginx_conf from bench.config.nginx import make_nginx_conf
import os, subprocess import os, subprocess
@ -95,9 +95,12 @@ def is_running_systemd():
return False return False
def reload_supervisor(): def reload_supervisor():
exec_cmd('sudo supervisorctl reload') try:
# exec_cmd('sudo supervisorctl reread') exec_cmd('sudo supervisorctl reread')
# exec_cmd('sudo supervisorctl update') exec_cmd('sudo supervisorctl update')
except CommandFailedError:
exec_cmd('sudo supervisorctl reload')
def reload_nginx(): def reload_nginx():
subprocess.check_output(['sudo', find_executable('nginx'), '-t']) subprocess.check_output(['sudo', find_executable('nginx'), '-t'])

View File

@ -32,6 +32,10 @@ class TestSetupProduction(test_init.TestBenchInit):
bench.utils.setup_sudoers(user) bench.utils.setup_sudoers(user)
self.assert_sudoers(user) self.assert_sudoers(user)
for bench_name in ("test-bench-1", "test-bench-2"):
bench_path = os.path.join(os.path.abspath(self.benches_path), bench_name)
disable_production(bench_path)
def test_setup_production_v6(self): def test_setup_production_v6(self):
bench_name = 'test-bench-v6' bench_name = 'test-bench-v6'
self.test_init(bench_name, frappe_branch='master') self.test_init(bench_name, frappe_branch='master')
@ -47,6 +51,8 @@ class TestSetupProduction(test_init.TestBenchInit):
self.assert_supervisor_config(bench_name, use_rq=False) self.assert_supervisor_config(bench_name, use_rq=False)
self.assert_supervisor_process(bench_name, use_rq=False) self.assert_supervisor_process(bench_name, use_rq=False)
disable_production(bench_path)
def test_disable_production(self): def test_disable_production(self):
bench_name = 'test-disable-prod' bench_name = 'test-disable-prod'
self.test_init(bench_name, frappe_branch='master') self.test_init(bench_name, frappe_branch='master')