Repository: getmoto/moto
Pull request #8406 (2024-12-16 19:15:28)

Create RDS test clients with fixture
Create RDS test clients with a fixture to get rid of copy&paste code in the tests. The variable is now consistently called `client`.

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/getmoto/moto/pull/8406?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getmoto) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 94.57%. Comparing base [(`479c211`)](https://app.codecov.io/gh/getmoto/moto/commit/479c2119e030ad961f6b783ff461a20663f31a36?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getmoto) to head [(`7b25083`)](https://app.codecov.io/gh/getmoto/moto/commit/7b25083a15364c12f06b66aa7e7463a9d45d02dd?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getmoto).
> Report is 2 commits behind head on master.

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##           master    #8406      +/-   ##
==========================================
- Coverage   94.59%   94.57%   -0.03%     
==========================================
  Files        1163     1163              
  Lines      101636   101636              
==========================================
- Hits        96147    96119      -28     
- Misses       5489     5517      +28     
```

| [Flag](https://app.codecov.io/gh/getmoto/moto/pull/8406/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getmoto) | Coverage Δ | |
|---|---|---|
| [servertests](https://app.codecov.io/gh/getmoto/moto/pull/8406/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getmoto) | `?` | |
| [unittests](https://app.codecov.io/gh/getmoto/moto/pull/8406/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getmoto) | `94.57% <ø> (ø)` | |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getmoto#carryforward-flags-in-the-pull-request-comment) to find out more.

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/getmoto/moto/pull/8406?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getmoto).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getmoto).

snordhausen: I'll look into what's breaking the server tests, I can reproduce the issue locally.
bpandola: @snordhausen This may help: https://docs.getmoto.org/en/latest/docs/getting_started.html#pytest-fixtures-example-usage

Patch:
diff --git a/moto/dynamodb/exceptions.py b/moto/dynamodb/exceptions.py
index dc344f10d..4f0d7a426 100644
--- a/moto/dynamodb/exceptions.py
+++ b/moto/dynamodb/exceptions.py
@@ -121,6 +121,11 @@ class ExpressionAttributeValueNotDefined(InvalidUpdateExpression):
         )
 
 
+class ExpressionAttributeValuesEmpty(MockValidationException):
+    def __init__(self) -> None:
+        super().__init__("ExpressionAttributeValues must not be empty")
+
+
 class UpdateExprSyntaxError(InvalidUpdateExpression):
     update_expr_syntax_error_msg = "Syntax error; {error_detail}"
 
diff --git a/moto/dynamodb/parsing/key_condition_expression.py b/moto/dynamodb/parsing/key_condition_expression.py
index 11d8d8703..fb2fa8ff3 100644
--- a/moto/dynamodb/parsing/key_condition_expression.py
+++ b/moto/dynamodb/parsing/key_condition_expression.py
@@ -164,6 +164,10 @@ def parse_expression(
             # (hash_key = :id) and (sortkey = :sk)
             #                     ^
             if current_stage in [EXPRESSION_STAGES.INITIAL_STAGE]:
+                if not current_phrase:
+                    # hashkey = :id and (begins_with(sortkey, :sk))
+                    #                   ^
+                    continue
                 if current_phrase not in ["begins_with", ""]:
                     raise MockValidationException(
                         f"Invalid KeyConditionExpression: Invalid function name; function: {current_phrase}"
diff --git a/moto/dynamodb/responses.py b/moto/dynamodb/responses.py
index c79331afc..383d77679 100644
--- a/moto/dynamodb/responses.py
+++ b/moto/dynamodb/responses.py
@@ -14,6 +14,7 @@ from moto.dynamodb.parsing.reserved_keywords import ReservedKeywords
 from moto.utilities.aws_headers import amz_crc32
 
 from .exceptions import (
+    ExpressionAttributeValuesEmpty,
     InvalidProjectionExpression,
     KeyIsEmptyStringException,
     MockValidationException,
@@ -1012,7 +1013,7 @@ class DynamoHandler(BaseResponse):
         if values is None:
             return {}
         if len(values) == 0:
-            raise MockValidationException("ExpressionAttributeValues must not be empty")
+            raise ExpressionAttributeValuesEmpty
         for key in values.keys():
             if not key.startswith(":"):
                 raise MockValidationException(
@@ -1134,10 +1135,16 @@ class DynamoHandler(BaseResponse):
         # Validate first - we should error before we start the transaction
         for item in transact_items:
             if "Put" in item:
+                if item["Put"].get("ExpressionAttributeValues") == {}:
+                    raise ExpressionAttributeValuesEmpty
+
                 item_attrs = item["Put"]["Item"]
                 table = self.dynamodb_backend.get_table(item["Put"]["TableName"])
                 validate_put_has_empty_keys(item_attrs, table)
             if "Update" in item:
+                if item["Update"].get("ExpressionAttributeValues") == {}:
+                    raise ExpressionAttributeValuesEmpty
+
                 item_attrs = item["Update"]["Key"]
                 table = self.dynamodb_backend.get_table(item["Update"]["TableName"])
                 validate_put_has_empty_keys(
diff --git a/moto/logs/models.py b/moto/logs/models.py
index 3d78a740d..646cb1083 100644
--- a/moto/logs/models.py
+++ b/moto/logs/models.py
@@ -1,3 +1,4 @@
+import re
 from datetime import datetime, timedelta
 from gzip import compress as gzip_compress
 from typing import Any, Dict, Iterable, List, Optional, Tuple
@@ -598,7 +599,8 @@ class LogGroup(CloudFormationModel):
 
     def to_describe_dict(self) -> Dict[str, Any]:
         log_group = {
-            "arn": self.arn,
+            "arn": f"{self.arn}:*",
+            "logGroupArn": self.arn,
             "creationTime": self.creation_time,
             "logGroupName": self.name,
             "metricFilterCount": 0,
@@ -898,12 +900,12 @@ class LogsBackend(BaseBackend):
         descending: bool,
         limit: int,
         log_group_name: str,
+        log_group_id: str,
         log_stream_name_prefix: str,
         next_token: Optional[str],
         order_by: str,
     ) -> Tuple[List[Dict[str, Any]], Optional[str]]:
-        if log_group_name not in self.groups:
-            raise ResourceNotFoundException()
+        log_group = self._find_log_group(log_group_id, log_group_name)
         if limit > 50:
             raise InvalidParameterException(
                 constraint="Member must have value less than or equal to 50",
@@ -920,7 +922,6 @@ class LogsBackend(BaseBackend):
             raise InvalidParameterException(
                 msg="Cannot order by LastEventTime with a logStreamNamePrefix."
             )
-        log_group = self.groups[log_group_name]
         return log_group.describe_log_streams(
             descending=descending,
             limit=limit,
@@ -968,6 +969,7 @@ class LogsBackend(BaseBackend):
     def get_log_events(
         self,
         log_group_name: str,
+        log_group_id: str,
         log_stream_name: str,
         start_time: str,
         end_time: str,
@@ -975,15 +977,15 @@ class LogsBackend(BaseBackend):
         next_token: Optional[str],
         start_from_head: str,
     ) -> Tuple[List[Dict[str, Any]], Optional[str], Optional[str]]:
-        if log_group_name not in self.groups:
-            raise ResourceNotFoundException()
+        log_group = self._find_log_group(
+            log_group_id=log_group_id, log_group_name=log_group_name
+        )
         if limit and limit > 10000:
             raise InvalidParameterException(
                 constraint="Member must have value less than or equal to 10000",
                 parameter="limit",
                 value=limit,
             )
-        log_group = self.groups[log_group_name]
         return log_group.get_log_events(
             log_stream_name, start_time, end_time, limit, next_token, start_from_head
         )
@@ -1327,5 +1329,25 @@ class LogsBackend(BaseBackend):
     def untag_resource(self, arn: str, tag_keys: List[str]) -> None:
         self.tagger.untag_resource_using_names(arn, tag_keys)
 
+    def _find_log_group(self, log_group_id: str, log_group_name: str) -> LogGroup:
+        log_group: Optional[LogGroup] = None
+        if log_group_name:
+            log_group = self.groups.get(log_group_name)
+        elif log_group_id:
+            if not re.fullmatch(r"[\w#+=/:,.@-]*", log_group_id):
+                raise InvalidParameterException(
+                    msg=f"1 validation error detected: Value '{log_group_id}' at 'logGroupIdentifier' failed to satisfy constraint: Member must satisfy regular expression pattern: [\\w#+=/:,.@-]*"
+                )
+            for log_group in self.groups.values():
+                if log_group.arn == log_group_id:
+                    log_group = log_group
+        else:
+            raise InvalidParameterException(
+                "Should provider either name or id, but not both"
+            )
+        if not log_group:
+            raise ResourceNotFoundException()
+        return log_group
+
 
 logs_backends = BackendDict(LogsBackend, "logs")
diff --git a/moto/logs/responses.py b/moto/logs/responses.py
index da45f0472..44e7ffb06 100644
--- a/moto/logs/responses.py
+++ b/moto/logs/responses.py
@@ -236,6 +236,7 @@ class LogsResponse(BaseResponse):
 
     def describe_log_streams(self) -> str:
         log_group_name = self._get_param("logGroupName")
+        log_group_id = self._get_param("logGroupIdentifier")
         log_stream_name_prefix = self._get_param("logStreamNamePrefix", "")
         descending = self._get_param("descending", False)
         limit = self._get_param("limit", 50)
@@ -243,12 +244,13 @@ class LogsResponse(BaseResponse):
         order_by = self._get_param("orderBy", "LogStreamName")
 
         streams, next_token = self.logs_backend.describe_log_streams(
-            descending,
-            limit,
-            log_group_name,
-            log_stream_name_prefix,
-            next_token,
-            order_by,
+            descending=descending,
+            limit=limit,
+            log_group_name=log_group_name,
+            log_group_id=log_group_id,
+            log_stream_name_prefix=log_stream_name_prefix,
+            next_token=next_token,
+            order_by=order_by,
         )
         return json.dumps({"logStreams": streams, "nextToken": next_token})
 
@@ -272,6 +274,7 @@ class LogsResponse(BaseResponse):
 
     def get_log_events(self) -> str:
         log_group_name = self._get_param("logGroupName")
+        log_group_id = self._get_param("logGroupIdentifier")
         log_stream_name = self._get_param("logStreamName")
         start_time = self._get_param("startTime")
         end_time = self._get_param("endTime")
@@ -284,13 +287,14 @@ class LogsResponse(BaseResponse):
             next_backward_token,
             next_forward_token,
         ) = self.logs_backend.get_log_events(
-            log_group_name,
-            log_stream_name,
-            start_time,
-            end_time,
-            limit,
-            next_token,
-            start_from_head,
+            log_group_name=log_group_name,
+            log_group_id=log_group_id,
+            log_stream_name=log_stream_name,
+            start_time=start_time,
+            end_time=end_time,
+            limit=limit,
+            next_token=next_token,
+            start_from_head=start_from_head,
         )
         return json.dumps(
             {


Test patch:
diff --git a/tests/test_dynamodb/exceptions/test_dynamodb_transactions.py b/tests/test_dynamodb/exceptions/test_dynamodb_transactions.py
index 722f10565..a7a9f31ca 100644
--- a/tests/test_dynamodb/exceptions/test_dynamodb_transactions.py
+++ b/tests/test_dynamodb/exceptions/test_dynamodb_transactions.py
@@ -273,3 +273,45 @@ def test_transaction_with_empty_key(table_name=None):
         err["Message"]
         == "One or more parameter values are not valid. The AttributeValue for a key attribute cannot contain an empty string value. Key: pk"
     )
+
+
+@pytest.mark.aws_verified
+@dynamodb_aws_verified()
+def test_transact_write_items__empty_expr_attr_values(table_name=None):
+    dynamodb = boto3.client("dynamodb", region_name="us-east-1")
+
+    with pytest.raises(ClientError) as exc:
+        dynamodb.transact_write_items(
+            TransactItems=[
+                {
+                    "Put": {
+                        "Item": {"pk": {"S": "tenant#0000001-tenant#0000001"}},
+                        "ConditionExpression": "attribute_not_exists(#n0)",
+                        "TableName": table_name,
+                        "ExpressionAttributeNames": {"#n0": "pk"},
+                        "ExpressionAttributeValues": {},
+                    }
+                },
+            ]
+        )
+    err = exc.value.response["Error"]
+    assert err["Code"] == "ValidationException"
+    assert err["Message"] == "ExpressionAttributeValues must not be empty"
+
+    with pytest.raises(ClientError) as exc:
+        dynamodb.transact_write_items(
+            TransactItems=[
+                {
+                    "Update": {
+                        "Key": {"pk": {"S": "globals"}},
+                        "UpdateExpression": "SET #0 = {'S': 'asdf'}",
+                        "ExpressionAttributeNames": {"#0": "tenant_count"},
+                        "ExpressionAttributeValues": {},
+                        "TableName": table_name,
+                    }
+                },
+            ]
+        )
+    err = exc.value.response["Error"]
+    assert err["Code"] == "ValidationException"
+    assert err["Message"] == "ExpressionAttributeValues must not be empty"
diff --git a/tests/test_dynamodb/test_dynamodb_query.py b/tests/test_dynamodb/test_dynamodb_query.py
index c5619a3ad..846eb5c62 100644
--- a/tests/test_dynamodb/test_dynamodb_query.py
+++ b/tests/test_dynamodb/test_dynamodb_query.py
@@ -867,3 +867,28 @@ def test_query_gsi_pagination_with_string_gsi_range_no_sk(table_name=None):
     results = page1["Items"] + page2["Items"]
     subjects = set([int(r["pk"]) for r in results])
     assert subjects == set(range(10))
+
+
+@pytest.mark.aws_verified
+@dynamodb_aws_verified(add_range=True)
+def test_key_condition_expression_with_brackets(table_name=None):
+    dynamodb = boto3.resource("dynamodb", region_name="us-east-1")
+    table = dynamodb.Table(table_name)
+
+    table.put_item(Item={"pk": "TEST", "sk": "aa"})
+    table.put_item(Item={"pk": "TEST", "sk": "ab"})
+    table.put_item(Item={"pk": "TEST", "sk": "ac"})
+
+    results = table.query(
+        KeyConditionExpression="(#0 = :0) AND (begins_with(#1, :1))",
+        ExpressionAttributeNames={"#0": "pk", "#1": "sk"},
+        ExpressionAttributeValues={":0": "TEST", ":1": "a"},
+    )
+    assert results["Count"] == 3
+
+    results = table.query(
+        KeyConditionExpression="(#0 = :0) AND (#1 BETWEEN :1 AND :2)",
+        ExpressionAttributeNames={"#0": "pk", "#1": "sk"},
+        ExpressionAttributeValues={":0": "TEST", ":1": "ab", ":2": "ab"},
+    )
+    assert results["Items"] == [{"pk": "TEST", "sk": "ab"}]
diff --git a/tests/test_logs/test_export_tasks.py b/tests/test_logs/test_export_tasks.py
index 2ca54efca..1b86da62c 100644
--- a/tests/test_logs/test_export_tasks.py
+++ b/tests/test_logs/test_export_tasks.py
@@ -1,6 +1,5 @@
 import copy
 import json
-import os
 from datetime import datetime, timedelta
 from uuid import UUID, uuid4
 
@@ -8,14 +7,9 @@ import boto3
 import pytest
 from botocore.exceptions import ClientError
 
-from moto import mock_aws, settings
+from moto import mock_aws
 from moto.core.utils import unix_time_millis
-
-TEST_REGION = "us-east-1" if settings.TEST_SERVER_MODE else "us-west-2"
-allow_aws_request = (
-    os.environ.get("MOTO_TEST_ALLOW_AWS_REQUEST", "false").lower() == "true"
-)
-
+from tests import allow_aws_request
 
 S3_POLICY = {
     "Version": "2012-10-17",
@@ -49,7 +43,7 @@ S3_POLICY = {
 
 @pytest.fixture()
 def logs():
-    if allow_aws_request:
+    if allow_aws_request():
         yield boto3.client("logs", region_name="us-east-1")
     else:
         with mock_aws():
diff --git a/tests/test_logs/test_logs.py b/tests/test_logs/test_logs.py
index be8ebdb29..cec52981c 100644
--- a/tests/test_logs/test_logs.py
+++ b/tests/test_logs/test_logs.py
@@ -1,5 +1,6 @@
 import json
 from datetime import timedelta
+from uuid import uuid4
 
 import boto3
 import pytest
@@ -9,6 +10,7 @@ from freezegun import freeze_time
 from moto import mock_aws, settings
 from moto.core.utils import unix_time_millis, utcnow
 from moto.logs.models import MAX_RESOURCE_POLICIES_PER_REGION
+from tests import allow_aws_request, aws_verified
 
 TEST_REGION = "us-east-1" if settings.TEST_SERVER_MODE else "us-west-2"
 
@@ -47,258 +49,21 @@ access_policy_doc = json.dumps(
 )
 
 
-@mock_aws
-def test_describe_metric_filters_happy_prefix():
-    conn = boto3.client("logs", "us-west-2")
-
-    response1 = put_metric_filter(conn, count=1)
-    assert response1["ResponseMetadata"]["HTTPStatusCode"] == 200
-    response2 = put_metric_filter(conn, count=2)
-    assert response2["ResponseMetadata"]["HTTPStatusCode"] == 200
-
-    response = conn.describe_metric_filters(filterNamePrefix="filter")
-
-    assert len(response["metricFilters"]) == 2
-    assert response["metricFilters"][0]["filterName"] == "filterName1"
-    assert response["metricFilters"][1]["filterName"] == "filterName2"
-
-
-@mock_aws
-def test_describe_metric_filters_happy_log_group_name():
-    conn = boto3.client("logs", "us-west-2")
-
-    response1 = put_metric_filter(conn, count=1)
-    assert response1["ResponseMetadata"]["HTTPStatusCode"] == 200
-    response2 = put_metric_filter(conn, count=2)
-    assert response2["ResponseMetadata"]["HTTPStatusCode"] == 200
-
-    response = conn.describe_metric_filters(logGroupName="logGroupName2")
-
-    assert len(response["metricFilters"]) == 1
-    assert response["metricFilters"][0]["logGroupName"] == "logGroupName2"
-
-
-@mock_aws
-def test_describe_metric_filters_happy_metric_name():
-    conn = boto3.client("logs", "us-west-2")
-
-    response1 = put_metric_filter(conn, count=1)
-    assert response1["ResponseMetadata"]["HTTPStatusCode"] == 200
-    response2 = put_metric_filter(conn, count=2)
-    assert response2["ResponseMetadata"]["HTTPStatusCode"] == 200
-
-    response = conn.describe_metric_filters(
-        metricName="metricName1", metricNamespace="metricNamespace1"
-    )
-
-    assert len(response["metricFilters"]) == 1
-    metrics = response["metricFilters"][0]["metricTransformations"]
-    assert metrics[0]["metricName"] == "metricName1"
-    assert metrics[0]["metricNamespace"] == "metricNamespace1"
+@pytest.fixture(name="log_group_name")
+def create_log_group():
+    if allow_aws_request():
+        yield from _create_log_group()
+    else:
+        with mock_aws():
+            yield from _create_log_group()
 
 
-@mock_aws
-def test_put_metric_filters_validation():
-    conn = boto3.client("logs", "us-west-2")
-
-    invalid_filter_name = "X" * 513
-    invalid_filter_pattern = "X" * 1025
-    invalid_metric_transformations = [
-        {
-            "defaultValue": 1,
-            "metricName": "metricName",
-            "metricNamespace": "metricNamespace",
-            "metricValue": "metricValue",
-        },
-        {
-            "defaultValue": 1,
-            "metricName": "metricName",
-            "metricNamespace": "metricNamespace",
-            "metricValue": "metricValue",
-        },
-    ]
-
-    test_cases = [
-        build_put_case(name="Invalid filter name", filter_name=invalid_filter_name),
-        build_put_case(
-            name="Invalid filter pattern", filter_pattern=invalid_filter_pattern
-        ),
-        build_put_case(
-            name="Invalid filter metric transformations",
-            metric_transformations=invalid_metric_transformations,
-        ),
-    ]
-
-    for test_case in test_cases:
-        with pytest.raises(ClientError) as exc:
-            conn.put_metric_filter(**test_case["input"])
-        response = exc.value.response
-        assert response["ResponseMetadata"]["HTTPStatusCode"] == 400
-        assert response["Error"]["Code"] == "InvalidParameterException"
-
-
-@mock_aws
-def test_describe_metric_filters_validation():
-    conn = boto3.client("logs", "us-west-2")
-
-    length_over_512 = "X" * 513
-    length_over_255 = "X" * 256
-
-    test_cases = [
-        build_describe_case(
-            name="Invalid filter name prefix", filter_name_prefix=length_over_512
-        ),
-        build_describe_case(
-            name="Invalid log group name", log_group_name=length_over_512
-        ),
-        build_describe_case(name="Invalid metric name", metric_name=length_over_255),
-        build_describe_case(
-            name="Invalid metric namespace", metric_namespace=length_over_255
-        ),
-    ]
-
-    for test_case in test_cases:
-        with pytest.raises(ClientError) as exc:
-            conn.describe_metric_filters(**test_case["input"])
-        response = exc.value.response
-        assert response["ResponseMetadata"]["HTTPStatusCode"] == 400
-        assert response["Error"]["Code"] == "InvalidParameterException"
-
-
-@mock_aws
-def test_describe_metric_filters_multiple_happy():
-    conn = boto3.client("logs", "us-west-2")
-
-    response = put_metric_filter(conn, 1)
-    assert response["ResponseMetadata"]["HTTPStatusCode"] == 200
-
-    response = put_metric_filter(conn, 2)
-    assert response["ResponseMetadata"]["HTTPStatusCode"] == 200
-    response = conn.describe_metric_filters(
-        filterNamePrefix="filter", logGroupName="logGroupName1"
-    )
-    assert response["metricFilters"][0]["filterName"] == "filterName1"
-
-    response = conn.describe_metric_filters(filterNamePrefix="filter")
-    assert response["metricFilters"][0]["filterName"] == "filterName1"
-
-    response = conn.describe_metric_filters(logGroupName="logGroupName1")
-    assert response["metricFilters"][0]["filterName"] == "filterName1"
-
-    response = conn.describe_metric_filters(
-        metricName="metricName1", metricNamespace="metricNamespace1"
-    )
-    assert response["metricFilters"][0]["filterName"] == "filterName1"
-
-
-@mock_aws
-def test_put_and_describe_metric_filter_with_non_alphanumerics_in_namespace():
-    """
-    Should allow namespaces as described here:
-    https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Namespace
-    """
-    conn = boto3.client("logs", "us-west-2")
-    namespace = "A.B-c_d/1#2:metricNamespace"
-    response = conn.put_metric_filter(
-        filterName="filterName",
-        filterPattern="filterPattern",
-        logGroupName="logGroupName",
-        metricTransformations=[
-            {
-                "metricName": "metricName",
-                "metricNamespace": namespace,
-                "metricValue": "metricValue",
-            },
-        ],
-    )
-    assert response["ResponseMetadata"]["HTTPStatusCode"] == 200
-
-    response = conn.describe_metric_filters(
-        metricName="metricName", metricNamespace=namespace
-    )
-    assert response["metricFilters"][0]["filterName"] == "filterName"
-
-
-@mock_aws
-def test_delete_metric_filter():
-    client = boto3.client("logs", "us-west-2")
-
-    lg_name = "/hello-world/my-cool-endpoint"
-    client.create_log_group(logGroupName=lg_name)
-    client.put_metric_filter(
-        logGroupName=lg_name,
-        filterName="my-cool-filter",
-        filterPattern="{ $.val = * }",
-        metricTransformations=[
-            {
-                "metricName": "my-metric",
-                "metricNamespace": "my-namespace",
-                "metricValue": "$.value",
-            }
-        ],
-    )
-
-    response = client.delete_metric_filter(
-        filterName="filterName", logGroupName=lg_name
-    )
-    assert response["ResponseMetadata"]["HTTPStatusCode"] == 200
-
-    response = client.describe_metric_filters(
-        filterNamePrefix="filter", logGroupName="logGroupName2"
-    )
-    assert response["metricFilters"] == []
-
-
-@mock_aws
-@pytest.mark.parametrize(
-    "filter_name, failing_constraint",
-    [
-        (
-            "X" * 513,
-            "Minimum length of 1. Maximum length of 512.",
-        ),  # filterName too long
-        ("x:x", "Must match pattern"),  # invalid filterName pattern
-    ],
-)
-def test_delete_metric_filter_invalid_filter_name(filter_name, failing_constraint):
-    conn = boto3.client("logs", "us-west-2")
-    with pytest.raises(ClientError) as exc:
-        conn.delete_metric_filter(filterName=filter_name, logGroupName="valid")
-    response = exc.value.response
-    assert response["ResponseMetadata"]["HTTPStatusCode"] == 400
-    assert response["Error"]["Code"] == "InvalidParameterException"
-    assert (
-        f"Value '{filter_name}' at 'filterName' failed to satisfy constraint"
-        in response["Error"]["Message"]
-    )
-    assert failing_constraint in response["Error"]["Message"]
-
-
-@mock_aws
-@pytest.mark.parametrize(
-    "log_group_name, failing_constraint",
-    [
-        (
-            "X" * 513,
-            "Minimum length of 1. Maximum length of 512.",
-        ),  # logGroupName too long
-        ("x!x", "Must match pattern"),  # invalid logGroupName pattern
-    ],
-)
-def test_delete_metric_filter_invalid_log_group_name(
-    log_group_name, failing_constraint
-):
-    conn = boto3.client("logs", "us-west-2")
-    with pytest.raises(ClientError) as exc:
-        conn.delete_metric_filter(filterName="valid", logGroupName=log_group_name)
-    response = exc.value.response
-    assert response["ResponseMetadata"]["HTTPStatusCode"] == 400
-    assert response["Error"]["Code"] == "InvalidParameterException"
-    assert (
-        f"Value '{log_group_name}' at 'logGroupName' failed to satisfy constraint"
-        in response["Error"]["Message"]
-    )
-    assert failing_constraint in response["Error"]["Message"]
+def _create_log_group():
+    conn = boto3.client("logs", TEST_REGION)
+    log_group_name = f"test_log_group_{str(uuid4())[0:6]}"
+    conn.create_log_group(logGroupName=log_group_name)
+    yield log_group_name
+    conn.delete_log_group(logGroupName=log_group_name)
 
 
 @mock_aws
@@ -377,84 +142,6 @@ def test_destinations():
     assert response["ResponseMetadata"]["HTTPStatusCode"] == 200
 
 
-def put_metric_filter(conn, count=1):
-    count = str(count)
-    return conn.put_metric_filter(
-        filterName="filterName" + count,
-        filterPattern="filterPattern" + count,
-        logGroupName="logGroupName" + count,
-        metricTransformations=[
-            {
-                "defaultValue": int(count),
-                "metricName": "metricName" + count,
-                "metricNamespace": "metricNamespace" + count,
-                "metricValue": "metricValue" + count,
-            },
-        ],
-    )
-
-
-def build_put_case(
-    name,
-    filter_name="filterName",
-    filter_pattern="filterPattern",
-    log_group_name="logGroupName",
-    metric_transformations=None,
-):
-    return {
-        "name": name,
-        "input": build_put_input(
-            filter_name, filter_pattern, log_group_name, metric_transformations
-        ),
-    }
-
-
-def build_put_input(
-    filter_name, filter_pattern, log_group_name, metric_transformations
-):
-    if metric_transformations is None:
-        metric_transformations = [
-            {
-                "defaultValue": 1,
-                "metricName": "metricName",
-                "metricNamespace": "metricNamespace",
-                "metricValue": "metricValue",
-            },
-        ]
-    return {
-        "filterName": filter_name,
-        "filterPattern": filter_pattern,
-        "logGroupName": log_group_name,
-        "metricTransformations": metric_transformations,
-    }
-
-
-def build_describe_input(
-    filter_name_prefix, log_group_name, metric_name, metric_namespace
-):
-    return {
-        "filterNamePrefix": filter_name_prefix,
-        "logGroupName": log_group_name,
-        "metricName": metric_name,
-        "metricNamespace": metric_namespace,
-    }
-
-
-def build_describe_case(
-    name,
-    filter_name_prefix="filterNamePrefix",
-    log_group_name="logGroupName",
-    metric_name="metricName",
-    metric_namespace="metricNamespace",
-):
-    return {
-        "name": name,
-        "input": build_describe_input(
-            filter_name_prefix, log_group_name, metric_name, metric_namespace
-        ),
-    }
-
-
 @mock_aws
 @pytest.mark.parametrize(
     "kms_key_id",
@@ -885,6 +572,82 @@ def test_get_log_events():
     )
 
 
+@pytest.mark.aws_verified
+@aws_verified
+def test_arn_formats_log_group_and_stream(account_id, log_group_name):
+    client = boto3.client("logs", TEST_REGION)
+
+    # Verify that we return all LogGroup ARN's
+    group = client.describe_log_groups(logGroupNamePrefix=log_group_name)["logGroups"][
+        0
+    ]
+    assert group["logGroupName"] == log_group_name
+    assert (
+        group["arn"]
+        == f"arn:aws:logs:{TEST_REGION}:{account_id}:log-group:{log_group_name}:*"
+    )
+    assert (
+        group["logGroupArn"]
+        == f"arn:aws:logs:{TEST_REGION}:{account_id}:log-group:{log_group_name}"
+    )
+
+    client.create_log_stream(logGroupName=log_group_name, logStreamName="stream")
+
+    # Verify that LogStreams have the correct ARN
+    stream = client.describe_log_streams(logGroupName=log_group_name)["logStreams"][0]
+    assert stream["logStreamName"] == "stream"
+    assert (
+        stream["arn"]
+        == f"arn:aws:logs:{TEST_REGION}:{account_id}:log-group:{log_group_name}:log-stream:stream"
+    )
+
+    # Verify that LogStreams can be found using the logStreamIdentifier
+    stream = client.describe_log_streams(logGroupIdentifier=group["logGroupArn"])[
+        "logStreams"
+    ][0]
+    assert stream["logStreamName"] == "stream"
+
+    # We can't use the ARN, as that throws a ValidationError
+    with pytest.raises(ClientError) as exc:
+        client.describe_log_streams(logGroupIdentifier=group["arn"])
+    err = exc.value.response["Error"]
+    assert err["Code"] == "InvalidParameterException"
+    assert (
+        err["Message"]
+        == f"1 validation error detected: Value '{group['arn']}' at 'logGroupIdentifier' failed to satisfy constraint: Member must satisfy regular expression pattern: [\\w#+=/:,.@-]*"
+    )
+
+
+@pytest.mark.aws_verified
+@aws_verified
+def test_get_log_events_using_arn(account_id, log_group_name):
+    client = boto3.client("logs", TEST_REGION)
+
+    group = client.describe_log_groups(logGroupNamePrefix=log_group_name)["logGroups"][
+        0
+    ]
+
+    client.create_log_stream(logGroupName=log_group_name, logStreamName="stream")
+
+    # Verify we can call this method with all variantions
+    # Note that we don't verify whether it returns anything - we just want to ensure that the parameters are valid
+    client.get_log_events(logGroupName=log_group_name, logStreamName="stream")
+    client.get_log_events(logGroupIdentifier=log_group_name, logStreamName="stream")
+    client.get_log_events(
+        logGroupIdentifier=group["logGroupArn"], logStreamName="stream"
+    )
+
+    # We can't use the ARN, as that throws a ValidationError
+    with pytest.raises(ClientError) as exc:
+        client.get_log_events(logGroupIdentifier=group["arn"], logStreamName="stream")
+    err = exc.value.response["Error"]
+    assert err["Code"] == "InvalidParameterException"
+    assert (
+        err["Message"]
+        == f"1 validation error detected: Value '{group['arn']}' at 'logGroupIdentifier' failed to satisfy constraint: Member must satisfy regular expression pattern: [\\w#+=/:,.@-]*"
+    )
+
+
 @mock_aws
 def test_get_log_events_with_start_from_head():
     client = boto3.client("logs", TEST_REGION)
diff --git a/tests/test_logs/test_logs_cloudformation.py b/tests/test_logs/test_logs_cloudformation.py
index ab39d682e..632c5e791 100644
--- a/tests/test_logs/test_logs_cloudformation.py
+++ b/tests/test_logs/test_logs_cloudformation.py
@@ -1,33 +1,52 @@
 import json
+from uuid import uuid4
 
 import boto3
+import pytest
 
-from moto import mock_aws
+from tests import aws_verified
 
 
-@mock_aws
+@aws_verified
+@pytest.mark.aws_verified
 def test_tagging():
     logs_client = boto3.client("logs", region_name="us-east-1")
     cf_client = boto3.client("cloudformation", region_name="us-east-1")
 
+    log_group_name = f"/moto/test/{str(uuid4())}"
+
     template = {
         "AWSTemplateFormatVersion": "2010-09-09",
         "Resources": {
             "testGroup": {
                 "Type": "AWS::Logs::LogGroup",
-                "Properties": {"Tags": [{"Key": "foo", "Value": "bar"}]},
+                "Properties": {
+                    "LogGroupName": log_group_name,
+                    "Tags": [{"Key": "foo", "Value": "bar"}],
+                },
             }
         },
     }
     template_json = json.dumps(template)
+    stack_name = f"moto-test-{str(uuid4())[0:6]}"
     cf_client.create_stack(
-        StackName="test_stack",
+        StackName=stack_name,
         TemplateBody=template_json,
     )
+    waiter = cf_client.get_waiter("stack_create_complete")
+    waiter.wait(StackName=stack_name)
+
+    group = logs_client.describe_log_groups(logGroupNamePrefix=log_group_name)[
+        "logGroups"
+    ][0]
 
-    arn = logs_client.describe_log_groups()["logGroups"][0]["arn"]
-    tags = logs_client.list_tags_for_resource(resourceArn=arn)["tags"]
-    assert tags == {"foo": "bar"}
+    tags = logs_client.list_tags_for_resource(resourceArn=group["logGroupArn"])["tags"]
+    assert tags["foo"] == "bar"
 
-    cf_client.delete_stack(StackName="test_stack")
-    assert logs_client.describe_log_groups()["logGroups"] == []
+    cf_client.delete_stack(StackName=stack_name)
+    waiter = cf_client.get_waiter("stack_delete_complete")
+    waiter.wait(StackName=stack_name)
+    assert (
+        logs_client.describe_log_groups(logGroupNamePrefix=log_group_name)["logGroups"]
+        == []
+    )
diff --git a/tests/test_logs/test_logs_filter.py b/tests/test_logs/test_logs_filter_log_events.py
similarity index 100%
rename from tests/test_logs/test_logs_filter.py
rename to tests/test_logs/test_logs_filter_log_events.py
diff --git a/tests/test_logs/test_logs_metric_filters.py b/tests/test_logs/test_logs_metric_filters.py
new file mode 100644
index 000000000..68e889c92
--- /dev/null
+++ b/tests/test_logs/test_logs_metric_filters.py
@@ -0,0 +1,337 @@
+import boto3
+import pytest
+from botocore.exceptions import ClientError
+
+from moto import mock_aws
+
+
+@mock_aws
+def test_describe_metric_filters_happy_prefix():
+    conn = boto3.client("logs", "us-west-2")
+
+    response1 = put_metric_filter(conn, count=1)
+    assert response1["ResponseMetadata"]["HTTPStatusCode"] == 200
+    response2 = put_metric_filter(conn, count=2)
+    assert response2["ResponseMetadata"]["HTTPStatusCode"] == 200
+
+    response = conn.describe_metric_filters(filterNamePrefix="filter")
+
+    assert len(response["metricFilters"]) == 2
+    assert response["metricFilters"][0]["filterName"] == "filterName1"
+    assert response["metricFilters"][1]["filterName"] == "filterName2"
+
+
+@mock_aws
+def test_describe_metric_filters_happy_log_group_name():
+    conn = boto3.client("logs", "us-west-2")
+
+    response1 = put_metric_filter(conn, count=1)
+    assert response1["ResponseMetadata"]["HTTPStatusCode"] == 200
+    response2 = put_metric_filter(conn, count=2)
+    assert response2["ResponseMetadata"]["HTTPStatusCode"] == 200
+
+    response = conn.describe_metric_filters(logGroupName="logGroupName2")
+
+    assert len(response["metricFilters"]) == 1
+    assert response["metricFilters"][0]["logGroupName"] == "logGroupName2"
+
+
+@mock_aws
+def test_describe_metric_filters_happy_metric_name():
+    conn = boto3.client("logs", "us-west-2")
+
+    response1 = put_metric_filter(conn, count=1)
+    assert response1["ResponseMetadata"]["HTTPStatusCode"] == 200
+    response2 = put_metric_filter(conn, count=2)
+    assert response2["ResponseMetadata"]["HTTPStatusCode"] == 200
+
+    response = conn.describe_metric_filters(
+        metricName="metricName1", metricNamespace="metricNamespace1"
+    )
+
+    assert len(response["metricFilters"]) == 1
+    metrics = response["metricFilters"][0]["metricTransformations"]
+    assert metrics[0]["metricName"] == "metricName1"
+    assert metrics[0]["metricNamespace"] == "metricNamespace1"
+
+
+@mock_aws
+def test_put_metric_filters_validation():
+    conn = boto3.client("logs", "us-west-2")
+
+    invalid_filter_name = "X" * 513
+    invalid_filter_pattern = "X" * 1025
+    invalid_metric_transformations = [
+        {
+            "defaultValue": 1,
+            "metricName": "metricName",
+            "metricNamespace": "metricNamespace",
+            "metricValue": "metricValue",
+        },
+        {
+            "defaultValue": 1,
+            "metricName": "metricName",
+            "metricNamespace": "metricNamespace",
+            "metricValue": "metricValue",
+        },
+    ]
+
+    test_cases = [
+        build_put_case(name="Invalid filter name", filter_name=invalid_filter_name),
+        build_put_case(
+            name="Invalid filter pattern", filter_pattern=invalid_filter_pattern
+        ),
+        build_put_case(
+            name="Invalid filter metric transformations",
+            metric_transformations=invalid_metric_transformations,
+        ),
+    ]
+
+    for test_case in test_cases:
+        with pytest.raises(ClientError) as exc:
+            conn.put_metric_filter(**test_case["input"])
+        response = exc.value.response
+        assert response["ResponseMetadata"]["HTTPStatusCode"] == 400
+        assert response["Error"]["Code"] == "InvalidParameterException"
+
+
+@mock_aws
+def test_describe_metric_filters_validation():
+    conn = boto3.client("logs", "us-west-2")
+
+    length_over_512 = "X" * 513
+    length_over_255 = "X" * 256
+
+    test_cases = [
+        build_describe_case(
+            name="Invalid filter name prefix", filter_name_prefix=length_over_512
+        ),
+        build_describe_case(
+            name="Invalid log group name", log_group_name=length_over_512
+        ),
+        build_describe_case(name="Invalid metric name", metric_name=length_over_255),
+        build_describe_case(
+            name="Invalid metric namespace", metric_namespace=length_over_255
+        ),
+    ]
+
+    for test_case in test_cases:
+        with pytest.raises(ClientError) as exc:
+            conn.describe_metric_filters(**test_case["input"])
+        response = exc.value.response
+        assert response["ResponseMetadata"]["HTTPStatusCode"] == 400
+        assert response["Error"]["Code"] == "InvalidParameterException"
+
+
+@mock_aws
+def test_describe_metric_filters_multiple_happy():
+    conn = boto3.client("logs", "us-west-2")
+
+    response = put_metric_filter(conn, 1)
+    assert response["ResponseMetadata"]["HTTPStatusCode"] == 200
+
+    response = put_metric_filter(conn, 2)
+    assert response["ResponseMetadata"]["HTTPStatusCode"] == 200
+    response = conn.describe_metric_filters(
+        filterNamePrefix="filter", logGroupName="logGroupName1"
+    )
+    assert response["metricFilters"][0]["filterName"] == "filterName1"
+
+    response = conn.describe_metric_filters(filterNamePrefix="filter")
+    assert response["metricFilters"][0]["filterName"] == "filterName1"
+
+    response = conn.describe_metric_filters(logGroupName="logGroupName1")
+    assert response["metricFilters"][0]["filterName"] == "filterName1"
+
+    response = conn.describe_metric_filters(
+        metricName="metricName1", metricNamespace="metricNamespace1"
+    )
+    assert response["metricFilters"][0]["filterName"] == "filterName1"
+
+
+@mock_aws
+def test_put_and_describe_metric_filter_with_non_alphanumerics_in_namespace():
+    """
+    Should allow namespaces as described here:
+    https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Namespace
+    """
+    conn = boto3.client("logs", "us-west-2")
+    namespace = "A.B-c_d/1#2:metricNamespace"
+    response = conn.put_metric_filter(
+        filterName="filterName",
+        filterPattern="filterPattern",
+        logGroupName="logGroupName",
+        metricTransformations=[
+            {
+                "metricName": "metricName",
+                "metricNamespace": namespace,
+                "metricValue": "metricValue",
+            },
+        ],
+    )
+    assert response["ResponseMetadata"]["HTTPStatusCode"] == 200
+
+    response = conn.describe_metric_filters(
+        metricName="metricName", metricNamespace=namespace
+    )
+    assert response["metricFilters"][0]["filterName"] == "filterName"
+
+
+@mock_aws
+def test_delete_metric_filter():
+    client = boto3.client("logs", "us-west-2")
+
+    lg_name = "/hello-world/my-cool-endpoint"
+    client.create_log_group(logGroupName=lg_name)
+    client.put_metric_filter(
+        logGroupName=lg_name,
+        filterName="my-cool-filter",
+        filterPattern="{ $.val = * }",
+        metricTransformations=[
+            {
+                "metricName": "my-metric",
+                "metricNamespace": "my-namespace",
+                "metricValue": "$.value",
+            }
+        ],
+    )
+
+    response = client.delete_metric_filter(
+        filterName="filterName", logGroupName=lg_name
+    )
+    assert response["ResponseMetadata"]["HTTPStatusCode"] == 200
+
+    response = client.describe_metric_filters(
+        filterNamePrefix="filter", logGroupName="logGroupName2"
+    )
+    assert response["metricFilters"] == []
+
+
+@mock_aws
+@pytest.mark.parametrize(
+    "filter_name, failing_constraint",
+    [
+        (
+            "X" * 513,
+            "Minimum length of 1. Maximum length of 512.",
+        ),  # filterName too long
+        ("x:x", "Must match pattern"),  # invalid filterName pattern
+    ],
+)
+def test_delete_metric_filter_invalid_filter_name(filter_name, failing_constraint):
+    conn = boto3.client("logs", "us-west-2")
+    with pytest.raises(ClientError) as exc:
+        conn.delete_metric_filter(filterName=filter_name, logGroupName="valid")
+    response = exc.value.response
+    assert response["ResponseMetadata"]["HTTPStatusCode"] == 400
+    assert response["Error"]["Code"] == "InvalidParameterException"
+    assert (
+        f"Value '{filter_name}' at 'filterName' failed to satisfy constraint"
+        in response["Error"]["Message"]
+    )
+    assert failing_constraint in response["Error"]["Message"]
+
+
+@mock_aws
+@pytest.mark.parametrize(
+    "log_group_name, failing_constraint",
+    [
+        (
+            "X" * 513,
+            "Minimum length of 1. Maximum length of 512.",
+        ),  # logGroupName too long
+        ("x!x", "Must match pattern"),  # invalid logGroupName pattern
+    ],
+)
+def test_delete_metric_filter_invalid_log_group_name(
+    log_group_name, failing_constraint
+):
+    conn = boto3.client("logs", "us-west-2")
+    with pytest.raises(ClientError) as exc:
+        conn.delete_metric_filter(filterName="valid", logGroupName=log_group_name)
+    response = exc.value.response
+    assert response["ResponseMetadata"]["HTTPStatusCode"] == 400
+    assert response["Error"]["Code"] == "InvalidParameterException"
+    assert (
+        f"Value '{log_group_name}' at 'logGroupName' failed to satisfy constraint"
+        in response["Error"]["Message"]
+    )
+    assert failing_constraint in response["Error"]["Message"]
+
+
+def put_metric_filter(conn, count=1):
+    count = str(count)
+    return conn.put_metric_filter(
+        filterName="filterName" + count,
+        filterPattern="filterPattern" + count,
+        logGroupName="logGroupName" + count,
+        metricTransformations=[
+            {
+                "defaultValue": int(count),
+                "metricName": "metricName" + count,
+                "metricNamespace": "metricNamespace" + count,
+                "metricValue": "metricValue" + count,
+            },
+        ],
+    )
+
+
+def build_put_case(
+    name,
+    filter_name="filterName",
+    filter_pattern="filterPattern",
+    log_group_name="logGroupName",
+    metric_transformations=None,
+):
+    return {
+        "name": name,
+        "input": build_put_input(
+            filter_name, filter_pattern, log_group_name, metric_transformations
+        ),
+    }
+
+
+def build_put_input(
+    filter_name, filter_pattern, log_group_name, metric_transformations
+):
+    if metric_transformations is None:
+        metric_transformations = [
+            {
+                "defaultValue": 1,
+                "metricName": "metricName",
+                "metricNamespace": "metricNamespace",
+                "metricValue": "metricValue",
+            },
+        ]
+    return {
+        "filterName": filter_name,
+        "filterPattern": filter_pattern,
+        "logGroupName": log_group_name,
+        "metricTransformations": metric_transformations,
+    }
+
+
+def build_describe_input(
+    filter_name_prefix, log_group_name, metric_name, metric_namespace
+):
+    return {
+        "filterNamePrefix": filter_name_prefix,
+        "logGroupName": log_group_name,
+        "metricName": metric_name,
+        "metricNamespace": metric_namespace,
+    }
+
+
+def build_describe_case(
+    name,
+    filter_name_prefix="filterNamePrefix",
+    log_group_name="logGroupName",
+    metric_name="metricName",
+    metric_namespace="metricNamespace",
+):
+    return {
+        "name": name,
+        "input": build_describe_input(
+            filter_name_prefix, log_group_name, metric_name, metric_namespace
+        ),
+    }
diff --git a/tests/test_logs/test_logs_tags.py b/tests/test_logs/test_logs_tags.py
index c3988e7ed..3640420e9 100644
--- a/tests/test_logs/test_logs_tags.py
+++ b/tests/test_logs/test_logs_tags.py
@@ -26,7 +26,7 @@ def test_log_groups_tags():
     log_group_name = "test"
 
     logs.create_log_group(logGroupName=log_group_name, tags={"key1": "val1"})
-    arn = logs.describe_log_groups()["logGroups"][0]["arn"]
+    arn = logs.describe_log_groups()["logGroups"][0]["logGroupArn"]
 
     _verify_tag_operations(arn, logs)
 
diff --git a/tests/test_rds/test_rds_clusters.py b/tests/test_rds/test_rds_clusters.py
index a12fb3832..24c549913 100644
--- a/tests/test_rds/test_rds_clusters.py
+++ b/tests/test_rds/test_rds_clusters.py
@@ -10,18 +10,20 @@ from moto.core import DEFAULT_ACCOUNT_ID as ACCOUNT_ID
 RDS_REGION = "eu-north-1"
 
 
+@pytest.fixture(name="client")
 @mock_aws
-def test_describe_db_cluster_initial():
-    client = boto3.client("rds", region_name=RDS_REGION)
+def get_rds_client():
+    return boto3.client("rds", region_name=RDS_REGION)
 
+
+@mock_aws
+def test_describe_db_cluster_initial(client):
     resp = client.describe_db_clusters()
     assert len(resp["DBClusters"]) == 0
 
 
 @mock_aws
-def test_describe_db_cluster_fails_for_non_existent_cluster():
-    client = boto3.client("rds", region_name=RDS_REGION)
-
+def test_describe_db_cluster_fails_for_non_existent_cluster(client):
     resp = client.describe_db_clusters()
     assert len(resp["DBClusters"]) == 0
     with pytest.raises(ClientError) as ex:
@@ -32,9 +34,7 @@ def test_describe_db_cluster_fails_for_non_existent_cluster():
 
 
 @mock_aws
-def test_create_db_cluster_invalid_engine():
-    client = boto3.client("rds", region_name=RDS_REGION)
-
+def test_create_db_cluster_invalid_engine(client):
     with pytest.raises(ClientError) as ex:
         client.create_db_cluster(
             DBClusterIdentifier="cluster-id", Engine="aurora-postgresql"
@@ -47,9 +47,7 @@ def test_create_db_cluster_invalid_engine():
 
 
 @mock_aws
-def test_create_db_cluster_needs_master_username():
-    client = boto3.client("rds", region_name=RDS_REGION)
-
+def test_create_db_cluster_needs_master_username(client):
     with pytest.raises(ClientError) as ex:
         client.create_db_cluster(
             DBClusterIdentifier="cluster-id", Engine="aurora-postgresql"
@@ -62,9 +60,7 @@ def test_create_db_cluster_needs_master_username():
 
 
 @mock_aws
-def test_create_db_cluster_needs_master_user_password():
-    client = boto3.client("rds", region_name=RDS_REGION)
-
+def test_create_db_cluster_needs_master_user_password(client):
     with pytest.raises(ClientError) as ex:
         client.create_db_cluster(
             DBClusterIdentifier="cluster-id",
@@ -79,9 +75,7 @@ def test_create_db_cluster_needs_master_user_password():
 
 
 @mock_aws
-def test_create_db_cluster_needs_long_master_user_password():
-    client = boto3.client("rds", region_name=RDS_REGION)
-
+def test_create_db_cluster_needs_long_master_user_password(client):
     with pytest.raises(ClientError) as ex:
         client.create_db_cluster(
             DBClusterIdentifier="cluster-id",
@@ -98,9 +92,7 @@ def test_create_db_cluster_needs_long_master_user_password():
 
 
 @mock_aws
-def test_modify_db_cluster_needs_long_master_user_password():
-    client = boto3.client("rds", region_name=RDS_REGION)
-
+def test_modify_db_cluster_needs_long_master_user_password(client):
     client.create_db_cluster(
         DBClusterIdentifier="cluster-id",
         Engine="aurora-postgresql",
@@ -122,8 +114,7 @@ def test_modify_db_cluster_needs_long_master_user_password():
 
 
 @mock_aws
-def test_modify_db_cluster_new_cluster_identifier():
-    client = boto3.client("rds", region_name=RDS_REGION)
+def test_modify_db_cluster_new_cluster_identifier(client):
     old_id = "cluster-id"
     new_id = "new-cluster-id"
 
@@ -152,8 +143,7 @@ def test_modify_db_cluster_new_cluster_identifier():
 
 @pytest.mark.parametrize("with_custom_kms_key", [True, False])
 @mock_aws
-def test_modify_db_cluster_manage_master_user_password(with_custom_kms_key):
-    client = boto3.client("rds", region_name=RDS_REGION)
+def test_modify_db_cluster_manage_master_user_password(client, with_custom_kms_key):
     cluster_id = "cluster-id"
     custom_kms_key = f"arn:aws:kms:{RDS_REGION}:123456789012:key/abcd1234-56ef-78gh-90ij-klmnopqrstuv"
     custom_kms_key_args = (
@@ -207,8 +197,7 @@ def test_modify_db_cluster_manage_master_user_password(with_custom_kms_key):
 
 @pytest.mark.parametrize("with_apply_immediately", [True, False])
 @mock_aws
-def test_modify_db_cluster_rotate_master_user_password(with_apply_immediately):
-    client = boto3.client("rds", region_name=RDS_REGION)
+def test_modify_db_cluster_rotate_master_user_password(client, with_apply_immediately):
     cluster_id = "cluster-id"
 
     client.create_db_cluster(
@@ -248,9 +237,7 @@ def test_modify_db_cluster_rotate_master_user_password(with_apply_immediately):
 
 
 @mock_aws
-def test_create_db_cluster__verify_default_properties():
-    client = boto3.client("rds", region_name=RDS_REGION)
-
+def test_create_db_cluster__verify_default_properties(client):
     resp = client.create_db_cluster(
         DBClusterIdentifier="cluster-id",
         Engine="aurora-mysql",
@@ -317,9 +304,7 @@ def test_create_db_cluster__verify_default_properties():
 
 
 @mock_aws
-def test_create_db_cluster_additional_parameters():
-    client = boto3.client("rds", region_name=RDS_REGION)
-
+def test_create_db_cluster_additional_parameters(client):
     resp = client.create_db_cluster(
         AvailabilityZones=["eu-north-1b"],
         DatabaseName="users",
@@ -378,9 +363,7 @@ def test_create_db_cluster_additional_parameters():
 
 
 @mock_aws
-def test_describe_db_cluster_after_creation():
-    client = boto3.client("rds", region_name=RDS_REGION)
-
+def test_describe_db_cluster_after_creation(client):
     client.create_db_cluster(
         DBClusterIdentifier="cluster-id1",
         Engine="aurora-postgresql",
@@ -411,9 +394,7 @@ def test_describe_db_cluster_after_creation():
 
 
 @mock_aws
-def test_delete_db_cluster():
-    client = boto3.client("rds", region_name=RDS_REGION)
-
+def test_delete_db_cluster(client):
     client.create_db_cluster(
         DBClusterIdentifier="cluster-id",
         Engine="aurora-postgresql",
@@ -427,9 +408,7 @@ def test_delete_db_cluster():
 
 
 @mock_aws
-def test_delete_db_cluster_do_snapshot():
-    client = boto3.client("rds", region_name=RDS_REGION)
-
+def test_delete_db_cluster_do_snapshot(client):
     client.create_db_cluster(
         DBClusterIdentifier="cluster-id",
         Engine="aurora-postgresql",
@@ -448,9 +427,7 @@ def test_delete_db_cluster_do_snapshot():
 
 
 @mock_aws
-def test_delete_db_cluster_that_is_protected():
-    client = boto3.client("rds", region_name=RDS_REGION)
-
+def test_delete_db_cluster_that_is_protected(client):
     client.create_db_cluster(
         DBClusterIdentifier="cluster-id",
         Engine="aurora-postgresql",
@@ -466,9 +443,7 @@ def test_delete_db_cluster_that_is_protected():
 
 
 @mock_aws
-def test_delete_db_cluster_unknown_cluster():
-    client = boto3.client("rds", region_name=RDS_REGION)
-
+def test_delete_db_cluster_unknown_cluster(client):
     with pytest.raises(ClientError) as ex:
         client.delete_db_cluster(DBClusterIdentifier="cluster-unknown")
     err = ex.value.response["Error"]
@@ -477,9 +452,7 @@ def test_delete_db_cluster_unknown_cluster():
 
 
 @mock_aws
-def test_start_db_cluster_unknown_cluster():
-    client = boto3.client("rds", region_name=RDS_REGION)
-
+def test_start_db_cluster_unknown_cluster(client):
     with pytest.raises(ClientError) as ex:
         client.start_db_cluster(DBClusterIdentifier="cluster-unknown")
     err = ex.value.response["Error"]
@@ -488,9 +461,7 @@ def test_start_db_cluster_unknown_cluster():
 
 
 @mock_aws
-def test_start_db_cluster_after_stopping():
-    client = boto3.client("rds", region_name=RDS_REGION)
-
+def test_start_db_cluster_after_stopping(client):
     client.create_db_cluster(
         DBClusterIdentifier="cluster-id",
         Engine="aurora-postgresql",
@@ -505,9 +476,7 @@ def test_start_db_cluster_after_stopping():
 
 
 @mock_aws
-def test_start_db_cluster_without_stopping():
-    client = boto3.client("rds", region_name=RDS_REGION)
-
+def test_start_db_cluster_without_stopping(client):
     client.create_db_cluster(
         DBClusterIdentifier="cluster-id",
         Engine="aurora-postgresql",
@@ -523,9 +492,7 @@ def test_start_db_cluster_without_stopping():
 
 
 @mock_aws
-def test_stop_db_cluster():
-    client = boto3.client("rds", region_name=RDS_REGION)
-
+def test_stop_db_cluster(client):
     client.create_db_cluster(
         DBClusterIdentifier="cluster-id",
         Engine="aurora-postgresql",
@@ -544,9 +511,7 @@ def test_stop_db_cluster():
 
 
 @mock_aws
-def test_stop_db_cluster_already_stopped():
-    client = boto3.client("rds", region_name=RDS_REGION)
-
+def test_stop_db_cluster_already_stopped(client):
     client.create_db_cluster(
         DBClusterIdentifier="cluster-id",
         Engine="aurora-postgresql",
@@ -564,9 +529,7 @@ def test_stop_db_cluster_already_stopped():
 
 
 @mock_aws
-def test_stop_db_cluster_unknown_cluster():
-    client = boto3.client("rds", region_name=RDS_REGION)
-
+def test_stop_db_cluster_unknown_cluster(client):
     with pytest.raises(ClientError) as ex:
         client.stop_db_cluster(DBClusterIdentifier="cluster-unknown")
     err = ex.value.response["Error"]
@@ -575,10 +538,9 @@ def test_stop_db_cluster_unknown_cluster():
 
 
 @mock_aws
-def test_create_db_cluster_snapshot_fails_for_unknown_cluster():
-    conn = boto3.client("rds", region_name="us-west-2")
+def test_create_db_cluster_snapshot_fails_for_unknown_cluster(client):
     with pytest.raises(ClientError) as exc:
-        conn.create_db_cluster_snapshot(
+        client.create_db_cluster_snapshot(
             DBClusterIdentifier="db-primary-1", DBClusterSnapshotIdentifier="snapshot-1"
         )
     err = exc.value.response["Error"]
@@ -586,9 +548,8 @@ def test_create_db_cluster_snapshot_fails_for_unknown_cluster():
 
 
 @mock_aws
-def test_create_db_cluster_snapshot():
-    conn = boto3.client("rds", region_name="us-west-2")
-    conn.create_db_cluster(
+def test_create_db_cluster_snapshot(client):
+    client.create_db_cluster(
         DBClusterIdentifier="db-primary-1",
         AllocatedStorage=10,
         Engine="postgres",
@@ -599,7 +560,7 @@ def test_create_db_cluster_snapshot():
         Port=1234,
     )
 
-    snapshot = conn.create_db_cluster_snapshot(
+    snapshot = client.create_db_cluster_snapshot(
         DBClusterIdentifier="db-primary-1", DBClusterSnapshotIdentifier="g-1"
     ).get("DBClusterSnapshot")
 
@@ -607,16 +568,16 @@ def test_create_db_cluster_snapshot():
     assert snapshot["DBClusterIdentifier"] == "db-primary-1"
     assert snapshot["DBClusterSnapshotIdentifier"] == "g-1"
     assert snapshot["SnapshotType"] == "manual"
-    result = conn.list_tags_for_resource(ResourceName=snapshot["DBClusterSnapshotArn"])
+    result = client.list_tags_for_resource(
+        ResourceName=snapshot["DBClusterSnapshotArn"]
+    )
     assert result["TagList"] == []
 
 
 @mock_aws
-def test_create_db_cluster_snapshot_copy_tags():
-    conn = boto3.client("rds", region_name="us-west-2")
-
+def test_create_db_cluster_snapshot_copy_tags(client):
     dbci = "db-primary-1"
-    conn.create_db_cluster(
+    client.create_db_cluster(
         DBClusterIdentifier=dbci,
         AllocatedStorage=10,
         Engine="postgres",
@@ -629,7 +590,7 @@ def test_create_db_cluster_snapshot_copy_tags():
         CopyTagsToSnapshot=True,
     )
 
-    snapshot = conn.create_db_cluster_snapshot(
+    snapshot = client.create_db_cluster_snapshot(
         DBClusterIdentifier=dbci, DBClusterSnapshotIdentifier="g-1"
     ).get("DBClusterSnapshot")
 
@@ -637,13 +598,15 @@ def test_create_db_cluster_snapshot_copy_tags():
     assert snapshot.get("DBClusterIdentifier") == dbci
     assert snapshot.get("DBClusterSnapshotIdentifier") == "g-1"
 
-    result = conn.list_tags_for_resource(ResourceName=snapshot["DBClusterSnapshotArn"])
+    result = client.list_tags_for_resource(
+        ResourceName=snapshot["DBClusterSnapshotArn"]
+    )
     assert result["TagList"] == [
         {"Value": "bar", "Key": "foo"},
         {"Value": "bar1", "Key": "foo1"},
     ]
 
-    snapshot = conn.describe_db_cluster_snapshots(DBClusterIdentifier=dbci)[
+    snapshot = client.describe_db_cluster_snapshots(DBClusterIdentifier=dbci)[
         "DBClusterSnapshots"
     ][0]
     assert snapshot["TagList"] == [
@@ -653,11 +616,9 @@ def test_create_db_cluster_snapshot_copy_tags():
 
 
 @mock_aws
-def test_copy_db_cluster_snapshot_fails_for_unknown_snapshot():
-    conn = boto3.client("rds", region_name="us-west-2")
-
+def test_copy_db_cluster_snapshot_fails_for_unknown_snapshot(client):
     with pytest.raises(ClientError) as exc:
-        conn.copy_db_cluster_snapshot(
+        client.copy_db_cluster_snapshot(
             SourceDBClusterSnapshotIdentifier="snapshot-1",
             TargetDBClusterSnapshotIdentifier="snapshot-2",
         )
@@ -667,10 +628,8 @@ def test_copy_db_cluster_snapshot_fails_for_unknown_snapshot():
 
 
 @mock_aws
-def test_copy_db_cluster_snapshot():
-    conn = boto3.client("rds", region_name="us-west-2")
-
-    conn.create_db_cluster(
+def test_copy_db_cluster_snapshot(client):
+    client.create_db_cluster(
         DBClusterIdentifier="db-primary-1",
         AllocatedStorage=10,
         Engine="postgres",
@@ -681,11 +640,11 @@ def test_copy_db_cluster_snapshot():
         Port=1234,
     )
 
-    conn.create_db_cluster_snapshot(
+    client.create_db_cluster_snapshot(
         DBClusterIdentifier="db-primary-1", DBClusterSnapshotIdentifier="snapshot-1"
     ).get("DBClusterSnapshot")
 
-    target_snapshot = conn.copy_db_cluster_snapshot(
+    target_snapshot = client.copy_db_cluster_snapshot(
         SourceDBClusterSnapshotIdentifier="snapshot-1",
         TargetDBClusterSnapshotIdentifier="snapshot-2",
     ).get("DBClusterSnapshot")
@@ -693,17 +652,15 @@ def test_copy_db_cluster_snapshot():
     assert target_snapshot.get("Engine") == "postgres"
     assert target_snapshot.get("DBClusterIdentifier") == "db-primary-1"
     assert target_snapshot.get("DBClusterSnapshotIdentifier") == "snapshot-2"
-    result = conn.list_tags_for_resource(
+    result = client.list_tags_for_resource(
         ResourceName=target_snapshot["DBClusterSnapshotArn"]
     )
     assert result["TagList"] == []
 
 
 @mock_aws
-def test_copy_db_cluster_snapshot_fails_for_existed_target_snapshot():
-    conn = boto3.client("rds", region_name="us-west-2")
-
-    conn.create_db_cluster(
+def test_copy_db_cluster_snapshot_fails_for_existed_target_snapshot(client):
+    client.create_db_cluster(
         DBClusterIdentifier="db-primary-1",
         AllocatedStorage=10,
         Engine="postgres",
@@ -714,16 +671,16 @@ def test_copy_db_cluster_snapshot_fails_for_existed_target_snapshot():
         Port=1234,
     )
 
-    conn.create_db_cluster_snapshot(
+    client.create_db_cluster_snapshot(
         DBClusterIdentifier="db-primary-1", DBClusterSnapshotIdentifier="snapshot-1"
     ).get("DBClusterSnapshot")
 
-    conn.create_db_cluster_snapshot(
+    client.create_db_cluster_snapshot(
         DBClusterIdentifier="db-primary-1", DBClusterSnapshotIdentifier="snapshot-2"
     ).get("DBClusterSnapshot")
 
     with pytest.raises(ClientError) as exc:
-        conn.copy_db_cluster_snapshot(
+        client.copy_db_cluster_snapshot(
             SourceDBClusterSnapshotIdentifier="snapshot-1",
             TargetDBClusterSnapshotIdentifier="snapshot-2",
         )
@@ -736,9 +693,8 @@ def test_copy_db_cluster_snapshot_fails_for_existed_target_snapshot():
 
 
 @mock_aws
-def test_describe_db_cluster_snapshots():
-    conn = boto3.client("rds", region_name="us-west-2")
-    conn.create_db_cluster(
+def test_describe_db_cluster_snapshots(client):
+    client.create_db_cluster(
         DBClusterIdentifier="db-primary-1",
         AllocatedStorage=10,
         Engine="postgres",
@@ -749,16 +705,16 @@ def test_describe_db_cluster_snapshots():
         Port=1234,
     )
 
-    created = conn.create_db_cluster_snapshot(
+    created = client.create_db_cluster_snapshot(
         DBClusterIdentifier="db-primary-1", DBClusterSnapshotIdentifier="snapshot-1"
     ).get("DBClusterSnapshot")
 
     assert created.get("Engine") == "postgres"
 
-    by_database_id = conn.describe_db_cluster_snapshots(
+    by_database_id = client.describe_db_cluster_snapshots(
         DBClusterIdentifier="db-primary-1"
     ).get("DBClusterSnapshots")
-    by_snapshot_id = conn.describe_db_cluster_snapshots(
+    by_snapshot_id = client.describe_db_cluster_snapshots(
         DBClusterSnapshotIdentifier="snapshot-1"
     ).get("DBClusterSnapshots")
     assert by_snapshot_id == by_database_id
@@ -767,19 +723,18 @@ def test_describe_db_cluster_snapshots():
     assert snapshot == created
     assert snapshot.get("Engine") == "postgres"
 
-    conn.create_db_cluster_snapshot(
+    client.create_db_cluster_snapshot(
         DBClusterIdentifier="db-primary-1", DBClusterSnapshotIdentifier="snapshot-2"
     )
-    snapshots = conn.describe_db_cluster_snapshots(
+    snapshots = client.describe_db_cluster_snapshots(
         DBClusterIdentifier="db-primary-1"
     ).get("DBClusterSnapshots")
     assert len(snapshots) == 2
 
 
 @mock_aws
-def test_delete_db_cluster_snapshot():
-    conn = boto3.client("rds", region_name="us-west-2")
-    conn.create_db_cluster(
+def test_delete_db_cluster_snapshot(client):
+    client.create_db_cluster(
         DBClusterIdentifier="db-primary-1",
         AllocatedStorage=10,
         Engine="postgres",
@@ -789,20 +744,19 @@ def test_delete_db_cluster_snapshot():
         MasterUserPassword="hunter2000",
         Port=1234,
     )
-    conn.create_db_cluster_snapshot(
+    client.create_db_cluster_snapshot(
         DBClusterIdentifier="db-primary-1", DBClusterSnapshotIdentifier="snapshot-1"
     )
 
-    conn.describe_db_cluster_snapshots(DBClusterSnapshotIdentifier="snapshot-1")
-    conn.delete_db_cluster_snapshot(DBClusterSnapshotIdentifier="snapshot-1")
+    client.describe_db_cluster_snapshots(DBClusterSnapshotIdentifier="snapshot-1")
+    client.delete_db_cluster_snapshot(DBClusterSnapshotIdentifier="snapshot-1")
     with pytest.raises(ClientError):
-        conn.describe_db_cluster_snapshots(DBClusterSnapshotIdentifier="snapshot-1")
+        client.describe_db_cluster_snapshots(DBClusterSnapshotIdentifier="snapshot-1")
 
 
 @mock_aws
-def test_restore_db_cluster_from_snapshot():
-    conn = boto3.client("rds", region_name="us-west-2")
-    conn.create_db_cluster(
+def test_restore_db_cluster_from_snapshot(client):
+    client.create_db_cluster(
         DBClusterIdentifier="db-primary-1",
         AllocatedStorage=10,
         Engine="postgres",
@@ -812,14 +766,14 @@ def test_restore_db_cluster_from_snapshot():
         MasterUserPassword="hunter2000",
         Port=1234,
     )
-    assert len(conn.describe_db_clusters()["DBClusters"]) == 1
+    assert len(client.describe_db_clusters()["DBClusters"]) == 1
 
-    conn.create_db_cluster_snapshot(
+    client.create_db_cluster_snapshot(
         DBClusterIdentifier="db-primary-1", DBClusterSnapshotIdentifier="snapshot-1"
     )
 
     # restore
-    new_cluster = conn.restore_db_cluster_from_snapshot(
+    new_cluster = client.restore_db_cluster_from_snapshot(
         DBClusterIdentifier="db-restore-1",
         SnapshotIdentifier="snapshot-1",
         Engine="postgres",
@@ -831,17 +785,14 @@ def test_restore_db_cluster_from_snapshot():
     assert new_cluster["Port"] == 1234
 
     # Verify it exists
-    assert len(conn.describe_db_clusters()["DBClusters"]) == 2
-    assert (
-        len(conn.describe_db_clusters(DBClusterIdentifier="db-restore-1")["DBClusters"])
-        == 1
-    )
+    assert len(client.describe_db_clusters()["DBClusters"]) == 2
+    resp = client.describe_db_clusters(DBClusterIdentifier="db-restore-1")
+    assert len(resp["DBClusters"]) == 1
 
 
 @mock_aws
-def test_restore_db_cluster_from_snapshot_and_override_params():
-    conn = boto3.client("rds", region_name="us-west-2")
-    conn.create_db_cluster(
+def test_restore_db_cluster_from_snapshot_and_override_params(client):
+    client.create_db_cluster(
         DBClusterIdentifier="db-primary-1",
         AllocatedStorage=10,
         Engine="postgres",
@@ -851,13 +802,13 @@ def test_restore_db_cluster_from_snapshot_and_override_params():
         MasterUserPassword="hunter2000",
         Port=1234,
     )
-    assert len(conn.describe_db_clusters()["DBClusters"]) == 1
-    conn.create_db_cluster_snapshot(
+    assert len(client.describe_db_clusters()["DBClusters"]) == 1
+    client.create_db_cluster_snapshot(
         DBClusterIdentifier="db-primary-1", DBClusterSnapshotIdentifier="snapshot-1"
     )
 
     # restore with some updated attributes
-    new_cluster = conn.restore_db_cluster_from_snapshot(
+    new_cluster = client.restore_db_cluster_from_snapshot(
         DBClusterIdentifier="db-restore-1",
         SnapshotIdentifier="snapshot-1",
         Engine="postgres",
@@ -871,9 +822,8 @@ def test_restore_db_cluster_from_snapshot_and_override_params():
 
 
 @mock_aws
-def test_add_tags_to_cluster():
-    conn = boto3.client("rds", region_name="us-west-2")
-    resp = conn.create_db_cluster(
+def test_add_tags_to_cluster(client):
+    resp = client.create_db_cluster(
         DBClusterIdentifier="db-primary-1",
         AllocatedStorage=10,
         Engine="postgres",
@@ -886,23 +836,22 @@ def test_add_tags_to_cluster():
     )
     cluster_arn = resp["DBCluster"]["DBClusterArn"]
 
-    conn.add_tags_to_resource(
+    client.add_tags_to_resource(
         ResourceName=cluster_arn, Tags=[{"Key": "k2", "Value": "v2"}]
     )
 
-    tags = conn.list_tags_for_resource(ResourceName=cluster_arn)["TagList"]
+    tags = client.list_tags_for_resource(ResourceName=cluster_arn)["TagList"]
     assert tags == [{"Key": "k1", "Value": "v1"}, {"Key": "k2", "Value": "v2"}]
 
-    conn.remove_tags_from_resource(ResourceName=cluster_arn, TagKeys=["k1"])
+    client.remove_tags_from_resource(ResourceName=cluster_arn, TagKeys=["k1"])
 
-    tags = conn.list_tags_for_resource(ResourceName=cluster_arn)["TagList"]
+    tags = client.list_tags_for_resource(ResourceName=cluster_arn)["TagList"]
     assert tags == [{"Key": "k2", "Value": "v2"}]
 
 
 @mock_aws
-def test_add_tags_to_cluster_snapshot():
-    conn = boto3.client("rds", region_name="us-west-2")
-    conn.create_db_cluster(
+def test_add_tags_to_cluster_snapshot(client):
+    client.create_db_cluster(
         DBClusterIdentifier="db-primary-1",
         AllocatedStorage=10,
         Engine="postgres",
@@ -914,28 +863,26 @@ def test_add_tags_to_cluster_snapshot():
         Tags=[{"Key": "k1", "Value": "v1"}],
         CopyTagsToSnapshot=True,
     )
-    resp = conn.create_db_cluster_snapshot(
+    resp = client.create_db_cluster_snapshot(
         DBClusterIdentifier="db-primary-1", DBClusterSnapshotIdentifier="snapshot-1"
     )
     snapshot_arn = resp["DBClusterSnapshot"]["DBClusterSnapshotArn"]
 
-    conn.add_tags_to_resource(
+    client.add_tags_to_resource(
         ResourceName=snapshot_arn, Tags=[{"Key": "k2", "Value": "v2"}]
     )
 
-    tags = conn.list_tags_for_resource(ResourceName=snapshot_arn)["TagList"]
+    tags = client.list_tags_for_resource(ResourceName=snapshot_arn)["TagList"]
     assert tags == [{"Key": "k1", "Value": "v1"}, {"Key": "k2", "Value": "v2"}]
 
-    conn.remove_tags_from_resource(ResourceName=snapshot_arn, TagKeys=["k1"])
+    client.remove_tags_from_resource(ResourceName=snapshot_arn, TagKeys=["k1"])
 
-    tags = conn.list_tags_for_resource(ResourceName=snapshot_arn)["TagList"]
+    tags = client.list_tags_for_resource(ResourceName=snapshot_arn)["TagList"]
     assert tags == [{"Key": "k2", "Value": "v2"}]
 
 
 @mock_aws
-def test_create_serverless_db_cluster():
-    client = boto3.client("rds", region_name=RDS_REGION)
-
+def test_create_serverless_db_cluster(client):
     resp = client.create_db_cluster(
         DBClusterIdentifier="cluster-id",
         DatabaseName="users",
@@ -957,9 +904,7 @@ def test_create_serverless_db_cluster():
 
 
 @mock_aws
-def test_create_db_cluster_with_enable_http_endpoint_invalid():
-    client = boto3.client("rds", region_name=RDS_REGION)
-
+def test_create_db_cluster_with_enable_http_endpoint_invalid(client):
     resp = client.create_db_cluster(
         DBClusterIdentifier="cluster-id",
         DatabaseName="users",
@@ -976,9 +921,7 @@ def test_create_db_cluster_with_enable_http_endpoint_invalid():
 
 
 @mock_aws
-def test_describe_db_clusters_filter_by_engine():
-    client = boto3.client("rds", region_name=RDS_REGION)
-
+def test_describe_db_clusters_filter_by_engine(client):
     client.create_db_cluster(
         DBClusterIdentifier="id1",
         Engine="aurora-mysql",
@@ -1052,9 +995,8 @@ def test_replicate_cluster():
 
 
 @mock_aws
-def test_createdb_instance_engine_mismatch_fail():
+def test_createdb_instance_engine_mismatch_fail(client):
     # Setup
-    client = boto3.client("rds", "us-east-1")
     cluster_name = "test-cluster"
     client.create_db_cluster(
         DBClusterIdentifier=cluster_name,
@@ -1065,7 +1007,6 @@ def test_createdb_instance_engine_mismatch_fail():
     )
 
     # Execute
-
     with pytest.raises(ClientError) as exc:
         client.create_db_instance(
             DBClusterIdentifier=cluster_name,
@@ -1086,9 +1027,8 @@ def test_createdb_instance_engine_mismatch_fail():
 
 
 @mock_aws
-def test_describe_db_cluster_snapshot_attributes_default():
-    conn = boto3.client("rds", region_name="us-west-2")
-    conn.create_db_cluster(
+def test_describe_db_cluster_snapshot_attributes_default(client):
+    client.create_db_cluster(
         DBClusterIdentifier="db-primary-1",
         AllocatedStorage=10,
         Engine="postgres",
@@ -1099,11 +1039,11 @@ def test_describe_db_cluster_snapshot_attributes_default():
         Port=1234,
     )
 
-    conn.create_db_cluster_snapshot(
+    client.create_db_cluster_snapshot(
         DBClusterIdentifier="db-primary-1", DBClusterSnapshotIdentifier="g-1"
     ).get("DBClusterSnapshot")
 
-    resp = conn.describe_db_cluster_snapshot_attributes(
+    resp = client.describe_db_cluster_snapshot_attributes(
         DBClusterSnapshotIdentifier="g-1"
     )
 
@@ -1117,9 +1057,8 @@ def test_describe_db_cluster_snapshot_attributes_default():
 
 
 @mock_aws
-def test_describe_db_cluster_snapshot_attributes():
-    conn = boto3.client("rds", region_name="us-west-2")
-    conn.create_db_cluster(
+def test_describe_db_cluster_snapshot_attributes(client):
+    client.create_db_cluster(
         DBClusterIdentifier="db-primary-1",
         AllocatedStorage=10,
         Engine="postgres",
@@ -1130,17 +1069,17 @@ def test_describe_db_cluster_snapshot_attributes():
         Port=1234,
     )
 
-    conn.create_db_cluster_snapshot(
+    client.create_db_cluster_snapshot(
         DBClusterIdentifier="db-primary-1", DBClusterSnapshotIdentifier="g-1"
     ).get("DBClusterSnapshot")
 
-    conn.modify_db_cluster_snapshot_attribute(
+    client.modify_db_cluster_snapshot_attribute(
         DBClusterSnapshotIdentifier="g-1",
         AttributeName="restore",
         ValuesToAdd=["test", "test2"],
     )
 
-    resp = conn.describe_db_cluster_snapshot_attributes(
+    resp = client.describe_db_cluster_snapshot_attributes(
         DBClusterSnapshotIdentifier="g-1"
     )
 
@@ -1160,9 +1099,8 @@ def test_describe_db_cluster_snapshot_attributes():
 
 
 @mock_aws
-def test_modify_db_cluster_snapshot_attribute():
-    conn = boto3.client("rds", region_name="us-west-2")
-    conn.create_db_cluster(
+def test_modify_db_cluster_snapshot_attribute(client):
+    client.create_db_cluster(
         DBClusterIdentifier="db-primary-1",
         AllocatedStorage=10,
         Engine="postgres",
@@ -1173,21 +1111,21 @@ def test_modify_db_cluster_snapshot_attribute():
         Port=1234,
     )
 
-    conn.create_db_cluster_snapshot(
+    client.create_db_cluster_snapshot(
         DBClusterIdentifier="db-primary-1", DBClusterSnapshotIdentifier="g-1"
     ).get("DBClusterSnapshot")
 
-    resp = conn.modify_db_cluster_snapshot_attribute(
+    resp = client.modify_db_cluster_snapshot_attribute(
         DBClusterSnapshotIdentifier="g-1",
         AttributeName="restore",
         ValuesToAdd=["test", "test2"],
     )
-    resp = conn.modify_db_cluster_snapshot_attribute(
+    resp = client.modify_db_cluster_snapshot_attribute(
         DBClusterSnapshotIdentifier="g-1",
         AttributeName="restore",
         ValuesToRemove=["test"],
     )
-    resp = conn.modify_db_cluster_snapshot_attribute(
+    resp = client.modify_db_cluster_snapshot_attribute(
         DBClusterSnapshotIdentifier="g-1",
         AttributeName="restore",
         ValuesToAdd=["test3"],
@@ -1208,8 +1146,7 @@ def test_modify_db_cluster_snapshot_attribute():
 
 
 @mock_aws
-def test_backtrack_window():
-    client = boto3.client("rds", region_name=RDS_REGION)
+def test_backtrack_window(client):
     window = 86400
     resp = client.create_db_cluster(
         AvailabilityZones=["eu-north-1b"],
@@ -1253,9 +1190,7 @@ def test_backtrack_window():
         ),
     ],
 )
-def test_backtrack_errors(params):
-    client = boto3.client("rds", region_name=RDS_REGION)
-
+def test_backtrack_errors(client, params):
     with pytest.raises(ClientError) as ex:
         client.create_db_cluster(
             AvailabilityZones=["eu-north-1b"],
diff --git a/tests/test_resourcegroupstaggingapi/test_resourcegroupstagging_logs.py b/tests/test_resourcegroupstaggingapi/test_resourcegroupstagging_logs.py
index 869161ad1..ed313dda8 100644
--- a/tests/test_resourcegroupstaggingapi/test_resourcegroupstagging_logs.py
+++ b/tests/test_resourcegroupstaggingapi/test_resourcegroupstagging_logs.py
@@ -14,7 +14,9 @@ class TestLogsTagging(unittest.TestCase):
         self.resources_untagged = []
         for i in range(3):
             self.logs.create_log_group(logGroupName=f"test{i}", tags={"key1": "val1"})
-        self.arns = [lg["arn"] for lg in self.logs.describe_log_groups()["logGroups"]]
+        self.arns = [
+            lg["logGroupArn"] for lg in self.logs.describe_log_groups()["logGroups"]
+        ]
 
     def test_get_resources_logs(self):
         resp = self.rtapi.get_resources(ResourceTypeFilters=["logs"])