Ejemplo n.º 1
0
def start_mysql(sys_argv):
    """Start the mysql container on setup,
    stop and remove it on teardown.
    """
    from derex.runner.ddc import ddc_services

    with sys_argv(["ddc-services", "up", "-d", "mysql"]):
        ddc_services()
Ejemplo n.º 2
0
def test_derex_reset_mysql(sys_argv, mocker, workdir_copy):
    """Test the open edx ironwood docker compose shortcut."""
    mocker.patch("derex.runner.ddc.check_services", return_value=True)
    client = mocker.patch("derex.runner.docker_utils.client")
    client.containers.get.return_value.exec_run.side_effect = [
        SimpleNamespace(exit_code=-1)
    ] + list(repeat(SimpleNamespace(exit_code=0), 10))

    with sys_argv(["ddc-services", "up", "-d"]):
        ddc_services()
    with workdir_copy(MINIMAL_PROJ):
        result = runner.invoke(derex_cli_group, ["mysql", "reset"])
    assert_result_ok(result)
    assert result.exit_code == 0
Ejemplo n.º 3
0
def test_ddc_services(sys_argv, capsys):
    """Test the derex docker compose shortcut."""
    from derex.runner.ddc import ddc_services

    os.environ["DEREX_ADMIN_SERVICES"] = "False"
    with sys_argv(["ddc-services", "config"]):
        ddc_services()
    output = capsys.readouterr().out
    assert "mongodb" in output
    assert "adminer" not in output

    os.environ["DEREX_ADMIN_SERVICES"] = "True"
    with sys_argv(["ddc-services", "config"]):
        ddc_services()
    output = capsys.readouterr().out
    assert "adminer" in output
Ejemplo n.º 4
0
def test_ddc_services(sys_argv, capsys, monkeypatch, complete_project):
    """Test the derex docker compose shortcut."""
    from derex.runner.ddc import ddc_services
    from derex.runner.project import Project

    os.environ["DEREX_ADMIN_SERVICES"] = "False"
    with sys_argv(["ddc-services", "config"]):
        ddc_services()
    output = capsys.readouterr().out
    assert "mongodb" in output
    assert "adminer" not in output

    os.environ["DEREX_ADMIN_SERVICES"] = "True"
    with sys_argv(["ddc-services", "config"]):
        ddc_services()
    output = capsys.readouterr().out
    assert "adminer" in output

    with complete_project:
        monkeypatch.setenv("DEREX_ETC_PATH",
                           str(Project().root / "derex_etc_dir"))
        with sys_argv(["ddc-services", "config"]):
            ddc_services()

    output = capsys.readouterr().out
    assert "my-overridden-secret-password" in output
Ejemplo n.º 5
0
def start_mongodb(sys_argv):
    """Ensure the mongodb service is up"""
    with sys_argv(["ddc-services", "up", "-d", "mongodb"]):
        ddc_services()
Ejemplo n.º 6
0
def start_mongodb(sys_argv):
    """Start the mongodb container on setup,
    stop and remove it on teardown.
    """
    with sys_argv(["ddc-services", "up", "-d", "mongodb"]):
        ddc_services()
Ejemplo n.º 7
0
def start_mysql(sys_argv):
    """Ensure the mysql service is up"""
    from derex.runner.ddc import ddc_services

    with sys_argv(["ddc-services", "up", "-d", "mysql"]):
        ddc_services()