Skip to content
Draft
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
12 changes: 6 additions & 6 deletions .github/workflows/aws-tests-s3-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ on:
type: choice
description: Loglevel for PyTest
options:
- DEBUG
- INFO
- WARNING
- ERROR
- CRITICAL
- DEBUG
- INFO
- WARNING
- ERROR
- CRITICAL
default: WARNING

# Only one pull-request triggered run should be executed at a time
Expand Down Expand Up @@ -129,7 +129,7 @@ jobs:
- name: Run S3 Image tests
timeout-minutes: 10
env:
PYTEST_ARGS: "${{ env.TINYBIRD_PYTEST_ARGS }}-o junit_family=legacy --junitxml=target/pytest-junit-s3-image-${{ matrix.arch }}.xml"
PYTEST_ARGS: "${{ env.TINYBIRD_PYTEST_ARGS }}-o junit_family=legacy --junitxml=target/pytest-junit-s3-image-${{ matrix.arch }}.xml --ignore tests/aws/services/s3/resources"
TEST_PATH: "tests/aws/services/s3"
DEBUG: 1
run: |
Expand Down
31 changes: 31 additions & 0 deletions localstack-core/localstack/testing/testselection/matching.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import fnmatch
import glob
import pathlib
import re
from collections import defaultdict
Expand Down Expand Up @@ -162,6 +163,34 @@ def generic_service_test_matching_rule(
return set()


def cloudformation_resource_provider_rule(
changed_file_path: str,
search_patterns: Iterable[str] = DEFAULT_SEARCH_PATTERNS,
test_dirs: Iterable[str] = ("tests/aws/services",),
) -> Iterable[str]:
root_dir = (pathlib.Path(__file__).parent / ".." / ".." / ".." / "..").resolve()
match = None
for pattern in search_patterns:
match = re.findall(pattern, changed_file_path)
if match:
break

if not match:
return []

changed_service = match[0]
if changed_service != "cloudformation":
return []

out = set()
for test_dir in test_dirs:
resources_dirs = list(glob.iglob(f"{root_dir / test_dir}/*/resources"))
for resource_dir in resources_dirs:
out.add(str(pathlib.Path(resource_dir).relative_to(root_dir)))

return out


MatchingRule = Callable[[str], Iterable[str]]


Expand Down Expand Up @@ -206,4 +235,6 @@ def check_rule_has_matches(rule: MatchingRule, files: Iterable[str]) -> bool:
Matchers.glob(".git-blame-ignore-revs").ignore(),
# lambda
Matchers.glob("tests/aws/services/lambda_/functions/**").service_tests(services=["lambda"]),
# CloudFormation
cloudformation_resource_provider_rule,
]
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import requests
from localstack_snapshot.snapshots.transformer import SortingTransformer
from tests.aws.services.apigateway.apigateway_fixtures import api_invoke_url

from localstack import constants
from localstack.aws.api.lambda_ import Runtime
Expand All @@ -14,7 +15,6 @@
from localstack.utils.run import to_str
from localstack.utils.strings import to_bytes
from localstack.utils.sync import retry
from tests.aws.services.apigateway.apigateway_fixtures import api_invoke_url

PARENT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
TEST_LAMBDA_PYTHON_ECHO = os.path.join(PARENT_DIR, "lambda_/functions/lambda_echo.py")
Expand Down Expand Up @@ -297,6 +297,7 @@ def test_cfn_deploy_apigateway_models(deploy_cfn_template, snapshot, aws_client)


@markers.aws.validated
@markers.snapshot.skip_snapshot_verify(paths=["$..endpointConfiguration.ipAddressType"])
def test_cfn_deploy_apigateway_integration(deploy_cfn_template, snapshot, aws_client):
snapshot.add_transformer(snapshot.transform.key_value("cacheNamespace"))

Expand Down Expand Up @@ -331,6 +332,7 @@ def test_cfn_deploy_apigateway_integration(deploy_cfn_template, snapshot, aws_cl
# TODO: missing from LS response
"$.get-stage.methodSettings",
"$.get-stage.tags",
"$..endpointConfiguration.ipAddressType",
]
)
def test_cfn_deploy_apigateway_from_s3_swagger(
Expand Down Expand Up @@ -529,6 +531,7 @@ def test_update_apigateway_stage(deploy_cfn_template, snapshot, aws_client):


@markers.aws.validated
@markers.snapshot.skip_snapshot_verify(paths=["$..endpointConfiguration.ipAddressType"])
def test_api_gateway_with_policy_as_dict(deploy_cfn_template, snapshot, aws_client):
template = """
Parameters:
Expand Down
Loading
Loading