Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
betodealmeida committed Apr 13, 2021
1 parent fe6fdc3 commit f8bb103
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
10 changes: 5 additions & 5 deletions superset/db_engine_specs/mssql.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

# Regular expressions to catch custom errors
TEST_CONNECTION_ACCESS_DENIED_REGEX = re.compile("Adaptive Server connection failed")
TEXT_CONNECTION_INVALID_HOSTNAME_REGEX = re.compile(
TEST_CONNECTION_INVALID_HOSTNAME_REGEX = re.compile(
r"Adaptive Server is unavailable or does not exist \((?P<hostname>.*?)\)"
"(?!.*Net-Lib error).*$"
)
Expand Down Expand Up @@ -69,18 +69,18 @@ class MssqlEngineSpec(BaseEngineSpec):
__('Either the username "%(username)s" or the password is incorrect.'),
SupersetErrorType.TEST_CONNECTION_ACCESS_DENIED_ERROR,
),
TEXT_CONNECTION_INVALID_HOSTNAME_REGEX: (
TEST_CONNECTION_INVALID_HOSTNAME_REGEX: (
__('The hostname "%(hostname)s" cannot be resolved.'),
SupersetErrorType.TEST_CONNECTION_INVALID_HOSTNAME_ERROR,
),
TEST_CONNECTION_PORT_CLOSED_REGEX: (
__("Port %(port)s on hostname %(hostname)s refused the connection."),
__('Port %(port)s on hostname "%(hostname)s" refused the connection.'),
SupersetErrorType.TEST_CONNECTION_PORT_CLOSED_ERROR,
),
TEST_CONNECTION_HOST_DOWN_REGEX: (
__(
"The host %(hostname)s might be down, and can't be "
"reached on port %(port)s"
'The host "%(hostname)s" might be down, and can\'t be '
"reached on port %(port)s."
),
SupersetErrorType.TEST_CONNECTION_HOST_DOWN_ERROR,
),
Expand Down
6 changes: 3 additions & 3 deletions superset/db_engine_specs/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ class PostgresBaseEngineSpec(BaseEngineSpec):
SupersetErrorType.TEST_CONNECTION_INVALID_HOSTNAME_ERROR,
),
TEST_CONNECTION_PORT_CLOSED_REGEX: (
__("Port %(port)s on hostname %(hostname)s refused the connection."),
__('Port %(port)s on hostname "%(hostname)s" refused the connection.'),
SupersetErrorType.TEST_CONNECTION_PORT_CLOSED_ERROR,
),
TEST_CONNECTION_HOST_DOWN_REGEX: (
__(
"The host %(hostname)s might be down, and can't be "
"reached on port %(port)s"
'The host "%(hostname)s" might be down, and can\'t be '
"reached on port %(port)s."
),
SupersetErrorType.TEST_CONNECTION_HOST_DOWN_ERROR,
),
Expand Down
10 changes: 5 additions & 5 deletions tests/db_engine_specs/mssql_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def test_extract_errors(self):
assert result == [
SupersetError(
error_type=SupersetErrorType.TEST_CONNECTION_PORT_CLOSED_ERROR,
message="Port 12345 on hostname localhost refused the connection.",
message='Port 12345 on hostname "localhost" refused the connection.',
level=ErrorLevel.ERROR,
extra={
"engine_name": "Microsoft SQL",
Expand Down Expand Up @@ -224,8 +224,8 @@ def test_extract_errors(self):
SupersetError(
error_type=SupersetErrorType.TEST_CONNECTION_HOST_DOWN_ERROR,
message=(
"The host example.com might be down, "
"and can't be reached on port 12345"
'The host "example.com" might be down, '
"and can't be reached on port 12345."
),
level=ErrorLevel.ERROR,
extra={
Expand Down Expand Up @@ -257,8 +257,8 @@ def test_extract_errors(self):
SupersetError(
error_type=SupersetErrorType.TEST_CONNECTION_HOST_DOWN_ERROR,
message=(
"The host 93.184.216.34 might be down, "
"and can't be reached on port 12345"
'The host "93.184.216.34" might be down, '
"and can't be reached on port 12345."
),
level=ErrorLevel.ERROR,
extra={
Expand Down
10 changes: 5 additions & 5 deletions tests/db_engine_specs/postgres_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def test_extract_errors(self):
assert result == [
SupersetError(
error_type=SupersetErrorType.TEST_CONNECTION_PORT_CLOSED_ERROR,
message="Port 12345 on hostname localhost refused the connection.",
message='Port 12345 on hostname "localhost" refused the connection.',
level=ErrorLevel.ERROR,
extra={
"engine_name": "PostgreSQL",
Expand All @@ -294,8 +294,8 @@ def test_extract_errors(self):
SupersetError(
error_type=SupersetErrorType.TEST_CONNECTION_HOST_DOWN_ERROR,
message=(
"The host example.com might be down, "
"and can't be reached on port 12345"
'The host "example.com" might be down, '
"and can't be reached on port 12345."
),
level=ErrorLevel.ERROR,
extra={
Expand Down Expand Up @@ -323,8 +323,8 @@ def test_extract_errors(self):
SupersetError(
error_type=SupersetErrorType.TEST_CONNECTION_HOST_DOWN_ERROR,
message=(
"The host 93.184.216.34 might be down, "
"and can't be reached on port 12345"
'The host "93.184.216.34" might be down, '
"and can't be reached on port 12345."
),
level=ErrorLevel.ERROR,
extra={
Expand Down

0 comments on commit f8bb103

Please sign in to comment.