diff --git a/moto/rds/models.py b/moto/rds/models.py index 7e9bfb7f1bb3..1772cc7a2935 100644 --- a/moto/rds/models.py +++ b/moto/rds/models.py @@ -389,6 +389,7 @@ def __init__( db_cluster_identifier: str, engine: str, allocated_storage: Optional[int] = None, + auto_minor_version_upgrade: bool = True, engine_version: Optional[str] = None, master_username: Optional[str] = None, master_user_password: Optional[str] = None, @@ -413,6 +414,7 @@ def __init__( self.database_name = database_name self.db_cluster_identifier = db_cluster_identifier self.db_cluster_instance_class = kwargs.get("db_cluster_instance_class") + self.auto_minor_version_upgrade = auto_minor_version_upgrade self.deletion_protection = deletion_protection self.engine = engine if self.engine not in ClusterEngine.list_cluster_engines(): diff --git a/moto/timestreamwrite/responses.py b/moto/timestreamwrite/responses.py index 2c4ff9ed8017..492e1fc16cbd 100644 --- a/moto/timestreamwrite/responses.py +++ b/moto/timestreamwrite/responses.py @@ -1,9 +1,10 @@ import json +from typing import Iterable from moto.core.responses import BaseResponse from moto.timestreamquery.models import TimestreamQueryBackend, timestreamquery_backends -from .models import TimestreamWriteBackend, timestreamwrite_backends +from .models import TimestreamTable, TimestreamWriteBackend, timestreamwrite_backends class TimestreamWriteResponse(BaseResponse): @@ -85,7 +86,12 @@ def describe_table(self) -> str: def list_tables(self) -> str: database_name = self._get_param("DatabaseName") - tables = self.timestreamwrite_backend.list_tables(database_name) + if database_name is None: + tables: Iterable[TimestreamTable] = [] + for db in self.timestreamwrite_backend.list_databases(): + tables = list(tables) + list(db.list_tables()) + else: + tables = self.timestreamwrite_backend.list_tables(database_name) return json.dumps(dict(Tables=[t.description() for t in tables])) def update_table(self) -> str: diff --git a/tests/test_rds/test_rds.py b/tests/test_rds/test_rds.py index 5763cc82208e..d993b055eabe 100644 --- a/tests/test_rds/test_rds.py +++ b/tests/test_rds/test_rds.py @@ -61,6 +61,7 @@ def test_create_database(client): DBSecurityGroups=["my_sg"], VpcSecurityGroupIds=["sg-123456"], EnableCloudwatchLogsExports=["audit", "error"], + AutoMinorVersionUpgrade=False, ) db_instance = database["DBInstance"] assert db_instance["AllocatedStorage"] == 10 @@ -83,6 +84,7 @@ def test_create_database(client): assert db_instance["EnabledCloudwatchLogsExports"] == ["audit", "error"] assert db_instance["Endpoint"]["Port"] == 1234 assert db_instance["DbInstancePort"] == 1234 + assert db_instance["AutoMinorVersionUpgrade"] is False @mock_aws diff --git a/tests/test_rds/test_rds_clusters.py b/tests/test_rds/test_rds_clusters.py index 9f1885db89b3..ba94a8b30b71 100644 --- a/tests/test_rds/test_rds_clusters.py +++ b/tests/test_rds/test_rds_clusters.py @@ -337,10 +337,13 @@ def test_create_db_cluster_additional_parameters(client): }, VpcSecurityGroupIds=["sg1", "sg2"], EnableIAMDatabaseAuthentication=True, + AutoMinorVersionUpgrade=False, ) cluster = resp["DBCluster"] + assert cluster["AutoMinorVersionUpgrade"] is False + assert cluster["DBClusterIdentifier"] == "cluster-id" assert cluster["AvailabilityZones"] == ["eu-north-1b"] assert cluster["DatabaseName"] == "users" assert cluster["Engine"] == "aurora-postgresql" diff --git a/tests/test_timestreamwrite/test_timestreamwrite_table.py b/tests/test_timestreamwrite/test_timestreamwrite_table.py index 38ddd40b852b..e5a077c23cf4 100644 --- a/tests/test_timestreamwrite/test_timestreamwrite_table.py +++ b/tests/test_timestreamwrite/test_timestreamwrite_table.py @@ -198,6 +198,39 @@ def test_create_multiple_tables(): assert {t["TableStatus"] for t in tables} == {"ACTIVE"} +@mock_aws +def test_list_tables_without_database(): + ts = boto3.client("timestream-write", region_name="us-east-1") + ts.create_database(DatabaseName="mydatabase") + + for idx in range(0, 5): + ts.create_table( + DatabaseName="mydatabase", + TableName=f"mytable_{idx}", + RetentionProperties={ + "MemoryStoreRetentionPeriodInHours": 7, + "MagneticStoreRetentionPeriodInDays": 42, + }, + ) + + database = ts.describe_database(DatabaseName="mydatabase")["Database"] + + assert database["TableCount"] == 5 + + # database_name is optional in api call + tables = ts.list_tables()["Tables"] + assert len(tables) == 5 + assert {t["DatabaseName"] for t in tables} == {"mydatabase"} + assert {t["TableName"] for t in tables} == { + "mytable_0", + "mytable_1", + "mytable_2", + "mytable_3", + "mytable_4", + } + assert {t["TableStatus"] for t in tables} == {"ACTIVE"} + + @mock_aws def test_delete_table(): ts = boto3.client("timestream-write", region_name="us-east-1")