コード例 #1
0
def test_invalid_path_prefix():
    with mock.patch('gevent.pywsgi.WSGIServer'), seven.TemporaryDirectory(
    ) as temp_dir:
        workspace = load_workspace_from_yaml_paths(
            [file_relative_path(__file__, './workspace.yaml')])

        with pytest.raises(Exception) as exc_info:
            host_dagit_ui_with_workspace(
                storage_fallback=temp_dir,
                workspace=workspace,
                host=None,
                port=2343,
                port_lookup=False,
                path_prefix='no-leading-slash',
            )
        assert 'path prefix should begin with a leading' in str(exc_info.value)

        with pytest.raises(Exception) as exc_info:
            host_dagit_ui_with_workspace(
                storage_fallback=temp_dir,
                workspace=workspace,
                host=None,
                port=2343,
                port_lookup=False,
                path_prefix='/extra-trailing-slash/',
            )
        assert 'path prefix should not include a trailing' in str(
            exc_info.value)
コード例 #2
0
ファイル: test_app.py プロジェクト: plawler92/dagster
def test_invalid_path_prefix():
    with mock.patch("gevent.pywsgi.WSGIServer"), tempfile.TemporaryDirectory(
    ) as temp_dir:
        instance = DagsterInstance.local_temp(temp_dir)

        with load_workspace_from_yaml_paths(
            [file_relative_path(__file__, "./workspace.yaml")]) as workspace:
            with pytest.raises(Exception) as exc_info:
                host_dagit_ui_with_workspace(
                    instance=instance,
                    workspace=workspace,
                    host=None,
                    port=2343,
                    port_lookup=False,
                    path_prefix="no-leading-slash",
                )
            assert "path prefix should begin with a leading" in str(
                exc_info.value)

            with pytest.raises(Exception) as exc_info:
                host_dagit_ui_with_workspace(
                    instance=instance,
                    workspace=workspace,
                    host=None,
                    port=2343,
                    port_lookup=False,
                    path_prefix="/extra-trailing-slash/",
                )
            assert "path prefix should not include a trailing" in str(
                exc_info.value)
コード例 #3
0
def test_successful_host_dagit_ui_from_legacy_repository():
    with mock.patch('gevent.pywsgi.WSGIServer'), seven.TemporaryDirectory(
    ) as temp_dir:
        workspace = load_workspace_from_yaml_path(
            file_relative_path(__file__, './workspace.yaml'))
        host_dagit_ui_with_workspace(storage_fallback=temp_dir,
                                     workspace=workspace,
                                     host=None,
                                     port=2343)
コード例 #4
0
ファイル: test_app.py プロジェクト: plawler92/dagster
def test_successful_host_dagit_ui_from_legacy_repository():
    with mock.patch("gevent.pywsgi.WSGIServer"), tempfile.TemporaryDirectory(
    ) as temp_dir:
        instance = DagsterInstance.local_temp(temp_dir)
        with load_workspace_from_yaml_paths(
            [file_relative_path(__file__, "./workspace.yaml")]) as workspace:
            host_dagit_ui_with_workspace(instance=instance,
                                         workspace=workspace,
                                         host=None,
                                         port=2343,
                                         path_prefix="")
コード例 #5
0
def test_valid_path_prefix():
    with mock.patch('gevent.pywsgi.WSGIServer'), seven.TemporaryDirectory(
    ) as temp_dir:
        workspace = load_workspace_from_yaml_paths(
            [file_relative_path(__file__, './workspace.yaml')])
        host_dagit_ui_with_workspace(
            storage_fallback=temp_dir,
            workspace=workspace,
            host=None,
            port=2343,
            port_lookup=False,
            path_prefix='/dagster-path',
        )
コード例 #6
0
def test_successful_host_dagit_ui_from_multiple_workspace_files():
    with mock.patch('gevent.pywsgi.WSGIServer'), seven.TemporaryDirectory(
    ) as temp_dir:
        workspace = load_workspace_from_yaml_paths([
            file_relative_path(__file__, './workspace.yaml'),
            file_relative_path(__file__, './override.yaml'),
        ])

        host_dagit_ui_with_workspace(storage_fallback=temp_dir,
                                     workspace=workspace,
                                     host=None,
                                     port=2343,
                                     path_prefix='')
コード例 #7
0
ファイル: test_app.py プロジェクト: wingyplus/dagster
def test_successful_host_dagit_ui_from_legacy_repository():
    with mock.patch('gevent.pywsgi.WSGIServer'), seven.TemporaryDirectory(
    ) as temp_dir:
        instance = DagsterInstance.get(temp_dir)
        workspace = load_workspace_from_yaml_paths(
            [file_relative_path(__file__, './workspace.yaml')],
            UserProcessApi.CLI,
        )
        host_dagit_ui_with_workspace(instance=instance,
                                     workspace=workspace,
                                     host=None,
                                     port=2343,
                                     path_prefix='')
コード例 #8
0
ファイル: test_app.py プロジェクト: jmsanders/dagster
def test_successful_host_dagit_ui_from_multiple_workspace_files():
    with mock.patch("gevent.pywsgi.WSGIServer"), seven.TemporaryDirectory(
    ) as temp_dir:
        instance = DagsterInstance.get(temp_dir)

        with load_workspace_from_yaml_paths([
                file_relative_path(__file__, "./workspace.yaml"),
                file_relative_path(__file__, "./override.yaml"),
        ], ) as workspace:
            host_dagit_ui_with_workspace(instance=instance,
                                         workspace=workspace,
                                         host=None,
                                         port=2343,
                                         path_prefix="")
コード例 #9
0
ファイル: test_app.py プロジェクト: plawler92/dagster
def test_valid_path_prefix():
    with mock.patch("gevent.pywsgi.WSGIServer"), tempfile.TemporaryDirectory(
    ) as temp_dir:
        instance = DagsterInstance.local_temp(temp_dir)

        with load_workspace_from_yaml_paths(
            [file_relative_path(__file__, "./workspace.yaml")]) as workspace:
            host_dagit_ui_with_workspace(
                instance=instance,
                workspace=workspace,
                host=None,
                port=2343,
                port_lookup=False,
                path_prefix="/dagster-path",
            )
コード例 #10
0
def test_unknown_error():
    class AnException(Exception):
        pass

    def _raise_custom_error():
        raise AnException('foobar')

    with mock.patch(
            'gevent.pywsgi.WSGIServer',
            new=_define_mock_server(
                _raise_custom_error)), seven.TemporaryDirectory() as temp_dir:
        workspace = load_workspace_from_yaml_path(
            file_relative_path(__file__, './workspace.yaml'))
        with pytest.raises(AnException):
            host_dagit_ui_with_workspace(storage_fallback=temp_dir,
                                         workspace=workspace,
                                         host=None,
                                         port=2343)
コード例 #11
0
ファイル: test_app.py プロジェクト: plawler92/dagster
def test_unknown_error():
    class AnException(Exception):
        pass

    def _raise_custom_error():
        raise AnException("foobar")

    with mock.patch("gevent.pywsgi.WSGIServer",
                    new=_define_mock_server(_raise_custom_error)
                    ), tempfile.TemporaryDirectory() as temp_dir:
        instance = DagsterInstance.local_temp(temp_dir)
        with load_workspace_from_yaml_paths(
            [file_relative_path(__file__, "./workspace.yaml")]) as workspace:
            with pytest.raises(AnException):
                host_dagit_ui_with_workspace(instance=instance,
                                             workspace=workspace,
                                             host=None,
                                             port=2343,
                                             path_prefix="")
コード例 #12
0
ファイル: test_app.py プロジェクト: wingyplus/dagster
def test_successful_host_dagit_ui_from_multiple_workspace_files(
        python_user_process_api):
    with mock.patch('gevent.pywsgi.WSGIServer'), seven.TemporaryDirectory(
    ) as temp_dir:
        instance = DagsterInstance.get(temp_dir)

        workspace = load_workspace_from_yaml_paths(
            [
                file_relative_path(__file__, './workspace.yaml'),
                file_relative_path(__file__, './override.yaml'),
            ],
            python_user_process_api,
        )

        host_dagit_ui_with_workspace(instance=instance,
                                     workspace=workspace,
                                     host=None,
                                     port=2343,
                                     path_prefix='')
コード例 #13
0
def test_port_collision():
    def _raise_os_error():
        raise OSError('Address already in use')

    with mock.patch(
            'gevent.pywsgi.WSGIServer', new=_define_mock_server(
                _raise_os_error)), seven.TemporaryDirectory() as temp_dir:
        workspace = load_workspace_from_yaml_path(
            file_relative_path(__file__, './workspace.yaml'))
        with pytest.raises(Exception) as exc_info:
            host_dagit_ui_with_workspace(
                storage_fallback=temp_dir,
                workspace=workspace,
                host=None,
                port=2343,
                port_lookup=False,
            )

        assert 'another instance of dagit ' in str(exc_info.value)
コード例 #14
0
ファイル: test_app.py プロジェクト: plawler92/dagster
def test_port_collision():
    def _raise_os_error():
        raise OSError("Address already in use")

    with mock.patch(
            "gevent.pywsgi.WSGIServer", new=_define_mock_server(
                _raise_os_error)), tempfile.TemporaryDirectory() as temp_dir:
        instance = DagsterInstance.local_temp(temp_dir)
        with load_workspace_from_yaml_paths(
            [file_relative_path(__file__, "./workspace.yaml")]) as workspace:
            with pytest.raises(Exception) as exc_info:
                host_dagit_ui_with_workspace(
                    instance=instance,
                    workspace=workspace,
                    host=None,
                    port=2343,
                    port_lookup=False,
                    path_prefix="",
                )

            assert "another instance of dagit " in str(exc_info.value)
コード例 #15
0
ファイル: test_app.py プロジェクト: wingyplus/dagster
def test_unknown_error():
    class AnException(Exception):
        pass

    def _raise_custom_error():
        raise AnException('foobar')

    with mock.patch(
            'gevent.pywsgi.WSGIServer',
            new=_define_mock_server(
                _raise_custom_error)), seven.TemporaryDirectory() as temp_dir:
        instance = DagsterInstance.get(temp_dir)
        workspace = load_workspace_from_yaml_paths(
            [file_relative_path(__file__, './workspace.yaml')],
            UserProcessApi.CLI,
        )
        with pytest.raises(AnException):
            host_dagit_ui_with_workspace(instance=instance,
                                         workspace=workspace,
                                         host=None,
                                         port=2343,
                                         path_prefix='')
コード例 #16
0
ファイル: test_app.py プロジェクト: wingyplus/dagster
def test_port_collision():
    def _raise_os_error():
        raise OSError('Address already in use')

    with mock.patch(
            'gevent.pywsgi.WSGIServer', new=_define_mock_server(
                _raise_os_error)), seven.TemporaryDirectory() as temp_dir:
        instance = DagsterInstance.get(temp_dir)
        workspace = load_workspace_from_yaml_paths(
            [file_relative_path(__file__, './workspace.yaml')],
            UserProcessApi.CLI,
        )
        with pytest.raises(Exception) as exc_info:
            host_dagit_ui_with_workspace(
                instance=instance,
                workspace=workspace,
                host=None,
                port=2343,
                port_lookup=False,
                path_prefix='',
            )

        assert 'another instance of dagit ' in str(exc_info.value)