コード例 #1
0
async def test_gateway_request_timeout_pad_option(
    jp_configurable_serverapp,
    monkeypatch,
    request_timeout,
    kernel_launch_timeout,
    expected_request_timeout,
    expected_kernel_launch_timeout,
):
    argv = [
        f"--GatewayClient.request_timeout={request_timeout}",
        "--GatewayClient.launch_timeout_pad=5",
    ]

    GatewayClient.clear_instance()
    app = jp_configurable_serverapp(argv=argv)

    monkeypatch.setattr(GatewayClient, "KERNEL_LAUNCH_TIMEOUT",
                        kernel_launch_timeout)
    GatewayClient.instance().init_static_args()

    assert app.gateway_config.request_timeout == expected_request_timeout
    assert GatewayClient.instance(
    ).KERNEL_LAUNCH_TIMEOUT == expected_kernel_launch_timeout

    GatewayClient.clear_instance()
コード例 #2
0
def init_gateway(monkeypatch):
    """Initializes the server for use as a gateway client."""
    # Clear the singleton first since previous tests may not have used a gateway.
    GatewayClient.clear_instance()
    monkeypatch.setenv("JUPYTER_GATEWAY_URL", mock_gateway_url)
    monkeypatch.setenv("JUPYTER_GATEWAY_HTTP_USER", mock_http_user)
    monkeypatch.setenv("JUPYTER_GATEWAY_REQUEST_TIMEOUT", "44.4")
    monkeypatch.setenv("JUPYTER_GATEWAY_CONNECT_TIMEOUT", "44.4")
    yield
    GatewayClient.clear_instance()
コード例 #3
0
async def test_gateway_cli_options(jp_configurable_serverapp):
    argv = [
        '--gateway-url=' + mock_gateway_url,
        '--GatewayClient.http_user='******'--GatewayClient.connect_timeout=44.4',
        '--GatewayClient.request_timeout=44.4'
    ]

    GatewayClient.clear_instance()
    app = jp_configurable_serverapp(argv=argv)

    assert app.gateway_config.gateway_enabled is True
    assert app.gateway_config.url == mock_gateway_url
    assert app.gateway_config.http_user == mock_http_user
    assert app.gateway_config.connect_timeout == app.gateway_config.request_timeout
    assert app.gateway_config.connect_timeout == 44.4
    GatewayClient.clear_instance()
コード例 #4
0
async def test_gateway_cli_options(jp_configurable_serverapp):
    argv = [
        '--gateway-url=' + mock_gateway_url,
        '--GatewayClient.http_user='******'--GatewayClient.connect_timeout=44.4',
        '--GatewayClient.request_timeout=96.0'
    ]

    GatewayClient.clear_instance()
    app = jp_configurable_serverapp(argv=argv)

    assert app.gateway_config.gateway_enabled is True
    assert app.gateway_config.url == mock_gateway_url
    assert app.gateway_config.http_user == mock_http_user
    assert app.gateway_config.connect_timeout == 44.4
    assert app.gateway_config.request_timeout == 96.0
    GatewayClient.instance().init_static_args()
    assert GatewayClient.instance().KERNEL_LAUNCH_TIMEOUT == 96  # Ensure KLT gets set from request-timeout
    GatewayClient.clear_instance()
コード例 #5
0
async def test_gateway_cli_options(jp_configurable_serverapp):
    argv = [
        "--gateway-url=" + mock_gateway_url,
        "--GatewayClient.http_user="******"--GatewayClient.connect_timeout=44.4",
        "--GatewayClient.request_timeout=96.0",
        "--GatewayClient.launch_timeout_pad=5.1",
    ]

    GatewayClient.clear_instance()
    app = jp_configurable_serverapp(argv=argv)

    assert app.gateway_config.gateway_enabled is True
    assert app.gateway_config.url == mock_gateway_url
    assert app.gateway_config.http_user == mock_http_user
    assert app.gateway_config.connect_timeout == 44.4
    assert app.gateway_config.request_timeout == 96.0
    assert app.gateway_config.launch_timeout_pad == 5.1
    GatewayClient.instance().init_static_args()
    assert (GatewayClient.instance().KERNEL_LAUNCH_TIMEOUT == 90
            )  # Ensure KLT gets set from request-timeout - launch_timeout_pad
    GatewayClient.clear_instance()
コード例 #6
0
 def teardown_class(cls):
     GatewayClient.clear_instance()
     super(TestGateway, cls).teardown_class()
コード例 #7
0
 def setup_class(cls):
     GatewayClient.clear_instance()
     super(TestGateway, cls).setup_class()