-
Couldn't load subscription status.
- Fork 2
IN-923 Raise exceptions for failed connection tests / IN-925 Add Makefile commands to run Carbon feeds #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -114,6 +114,7 @@ def run_connection_test(self) -> None: | |
| except Exception as error: | ||
| error_message = f"Failed to connect to the Data Warehouse: {error}" | ||
| logger.exception(error_message) | ||
| raise | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
| else: | ||
| dbapi_connection = connection.connection | ||
| version = ( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -188,11 +188,19 @@ def test_cli_connection_tests_success(caplog, functional_engine, runner): | |
| assert "Successfully connected to the Symplectic Elements FTP server" in caplog.text | ||
|
|
||
|
|
||
| def test_cli_connection_tests_fail( | ||
| caplog, ftp_server, monkeypatch, nonfunctional_engine, runner | ||
| def test_cli_database_connection_test_fails(caplog, nonfunctional_engine, runner): | ||
| with patch("carbon.cli.DatabaseEngine") as mocked_engine: | ||
| mocked_engine.return_value = nonfunctional_engine | ||
| result = runner.invoke(main, ["--run_connection_tests"]) | ||
| assert result.exit_code == 1 | ||
|
|
||
| assert "Failed to connect to the Data Warehouse" in caplog.text | ||
|
Comment on lines
+191
to
+197
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To me, this is a nice test. The fixture |
||
|
|
||
|
|
||
| def test_cli_ftp_connection_test_fails( | ||
| caplog, ftp_server, functional_engine, monkeypatch, runner | ||
| ): | ||
| ftp_socket, _ = ftp_server | ||
|
|
||
| monkeypatch.setenv( | ||
| "SYMPLECTIC_FTP_JSON", | ||
| ( | ||
|
|
@@ -202,10 +210,10 @@ def test_cli_connection_tests_fail( | |
| '"SYMPLECTIC_FTP_PASS": "invalid_password"}' | ||
| ), | ||
| ) | ||
|
|
||
| with patch("carbon.cli.DatabaseEngine") as mocked_engine: | ||
| mocked_engine.return_value = nonfunctional_engine | ||
| mocked_engine.return_value = functional_engine | ||
| result = runner.invoke(main, ["--run_connection_tests"]) | ||
| assert result.exit_code == 0 | ||
| assert result.exit_code == 1 | ||
|
|
||
| assert "Failed to connect to the Data Warehouse" in caplog.text | ||
| assert "Failed to connect to the Symplectic Elements FTP server" in caplog.text | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 - think it's good that application bails given a connection error, as it cannot really do its work without it