コード例 #1
0
ファイル: test_supervisor.py プロジェクト: wosc/batou
def supervisor(root, request):
    # Urks. Otherwise OS X ends up with socket paths that are too long.
    supervisor = batou.lib.supervisor.Supervisor(
        pidfile="supervisor.pid", socketpath="/tmp/batou-test-supervisor.sock")
    root.component += supervisor
    root.component.deploy()
    yield supervisor
    supervisor.cmd("{}/bin/supervisorctl shutdown".format(supervisor.workdir))
コード例 #2
0
ファイル: test_supervisor.py プロジェクト: wosc/batou
def test_waits_for_start(root, supervisor):
    root.component += batou.lib.supervisor.Program(
        "foo",
        command_absolute=False,
        command="bash",
        args='-c "sleep 1; touch %s/foo; sleep 3600"' % (root.workdir),
        options=dict(startsecs=2))
    root.component.deploy()
    assert os.path.exists("%s/foo" % root.workdir)

    supervisor.cmd("{}/check_supervisor".format(supervisor.workdir))
コード例 #3
0
ファイル: test_supervisor.py プロジェクト: wosc/batou
def test_starts_stopped_program(root, supervisor):
    root.component += batou.lib.supervisor.Program(
        "foo",
        command_absolute=False,
        command="bash",
        args='-c "sleep 3600"',
        options=dict(startsecs=2),
    )
    root.component.deploy()
    supervisor.cmd("{}/bin/supervisorctl stop foo".format(supervisor.workdir))
    root.component.deploy()
    assert ("RUNNING" in supervisor.cmd(
        "{}/bin/supervisorctl status foo".format(supervisor.workdir))[0])
コード例 #4
0
ファイル: test_supervisor.py プロジェクト: wosc/batou
def test_enable_true_reports_not_running_when_daemon_stopped(root, supervisor):
    supervisor.cmd("{}/bin/supervisorctl shutdown".format(supervisor.workdir))
    # assert nothing raised
    root.component.deploy()