Skip to content
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

Minor: Fix kafkaconnect test connection #18965

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,18 @@ def get_cluster_info(self) -> Optional[dict]:
"""
Get the version and other details of the Kafka Connect cluster.
"""
try:
result = self.client.get_cluster_info()
return result

except Exception as exc:
logger.debug(traceback.format_exc())
logger.error(f"Unable to get cluster info :{exc}")
return self.client.get_cluster_info()

return None
def get_connectors_list(
self,
expand: str = None,
pattern: str = None,
state: str = None,
) -> dict:
"""
Get the list of connectors from Kafka Connect cluster.
"""
return self.client.list_connectors(expand=expand, pattern=pattern, state=state)

def get_connectors(
self,
Expand All @@ -85,12 +88,8 @@ def get_connectors(
pattern (str): Only list connectors that match the regex pattern.
state (str): Only list connectors that match the state.
"""

try:
result = self.client.list_connectors(
expand=expand, pattern=pattern, state=state
)
return result
return self.get_connectors_list(expand=expand, pattern=pattern, state=state)
except Exception as exc:
logger.debug(traceback.format_exc())
logger.error(f"Unable to get connectors list {exc}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_connection(

test_fn = {
"GetClusterInfo": client.get_cluster_info,
"GetPipelines": client.get_connectors,
"GetPipelines": client.get_connectors_list,
"GetPlugins": client.get_connector_plugins,
}

Expand Down
Loading