Skip to content

Clarify coverage error messages to distinguish license and emulation limits #12547

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

Merged
merged 3 commits into from
Apr 23, 2025
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
21 changes: 10 additions & 11 deletions localstack-core/localstack/utils/coverage_docs.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
COVERAGE_LINK_BASE = "https://docs.localstack.cloud/references/coverage/"
MESSAGE_TEMPLATE = (
f"API %sfor service '%s' not yet implemented or pro feature"
f" - please check {COVERAGE_LINK_BASE}%s for further information"
)
_COVERAGE_LINK_BASE = "https://docs.localstack.cloud/references/coverage"

Copy link
Member

@silv-io silv-io Apr 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This link will probably be replaced by the feature catalog in the future, but for now it's the only thing we have.

/cc @k-a-il for the future, when this will have to change


def get_coverage_link_for_service(service_name: str, action_name: str) -> str:
Expand All @@ -11,11 +7,14 @@ def get_coverage_link_for_service(service_name: str, action_name: str) -> str:
available_services = SERVICE_PLUGINS.list_available()

if service_name not in available_services:
return MESSAGE_TEMPLATE % ("", service_name, "")

return (
f"The API for service '{service_name}' is either not included in your current license plan "
"or has not yet been emulated by LocalStack. "
f"Please refer to {_COVERAGE_LINK_BASE} for more details."
)
else:
return MESSAGE_TEMPLATE % (
f"action '{action_name}' ",
service_name,
f"coverage_{service_name}/",
return (
f"The API action '{action_name}' for service '{service_name}' is either not available in "
"your current license plan or has not yet been emulated by LocalStack. "
f"Please refer to {_COVERAGE_LINK_BASE}/coverage_{service_name} for more information."
)
14 changes: 10 additions & 4 deletions tests/unit/aws/test_skeleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,11 @@ def test_skeleton_e2e_sqs_send_message():
[
(
TestSqsApiNotImplemented(),
"API action 'SendMessage' for service 'sqs' not yet implemented or pro feature"
" - please check https://docs.localstack.cloud/references/coverage/coverage_sqs/ for further information",
(
"The API action 'SendMessage' for service 'sqs' is either not available "
"in your current license plan or has not yet been emulated by LocalStack. "
"Please refer to https://docs.localstack.cloud/references/coverage/coverage_sqs for more information."
),
),
(
TestSqsApiNotImplementedWithMessage(),
Expand Down Expand Up @@ -312,8 +315,11 @@ def test_dispatch_missing_method_returns_internal_failure():
assert "Error" in parsed_response
assert parsed_response["Error"] == {
"Code": "InternalFailure",
"Message": "API action 'DeleteQueue' for service 'sqs' not yet implemented or pro feature - please check "
"https://docs.localstack.cloud/references/coverage/coverage_sqs/ for further information",
"Message": (
"The API action 'DeleteQueue' for service 'sqs' is either not available in your "
"current license plan or has not yet been emulated by LocalStack. "
"Please refer to https://docs.localstack.cloud/references/coverage/coverage_sqs for more information."
),
}


Expand Down
14 changes: 8 additions & 6 deletions tests/unit/utils/test_coverage_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@

def test_coverage_link_for_existing_service():
coverage_link = get_coverage_link_for_service("s3", "random_action")
assert (
coverage_link
== "API action 'random_action' for service 's3' not yet implemented or pro feature - please check https://docs.localstack.cloud/references/coverage/coverage_s3/ for further information"
assert coverage_link == (
"The API action 'random_action' for service 's3' is either not available in your current "
"license plan or has not yet been emulated by LocalStack. "
"Please refer to https://docs.localstack.cloud/references/coverage/coverage_s3 for more information."
)


def test_coverage_link_for_non_existing_service():
coverage_link = get_coverage_link_for_service("dummy_service", "random_action")
assert (
coverage_link
== "API for service 'dummy_service' not yet implemented or pro feature - please check https://docs.localstack.cloud/references/coverage/ for further information"
assert coverage_link == (
"The API for service 'dummy_service' is either not included in your current license plan or "
"has not yet been emulated by LocalStack. "
"Please refer to https://docs.localstack.cloud/references/coverage for more details."
)
Loading