Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9aeb4ae

Browse files
authored
Fix regression in RDS validator (#2346)
1 parent 442b087 commit 9aeb4ae

2 files changed

Lines changed: 41 additions & 2 deletions

File tree

tests/test_rds.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,45 @@ def test_gp3_storage_performance(self):
271271
):
272272
i.to_dict()
273273

274+
# Check startswith match for oracle and sqlserver engines
275+
i = rds.DBInstance(
276+
"Database2",
277+
Engine="oracle-se2",
278+
EngineVersion="15.3",
279+
StorageType="gp3",
280+
Iops=10000,
281+
AllocatedStorage="10",
282+
MasterUsername="test",
283+
MasterUserPassword="test",
284+
)
285+
with self.assertRaisesRegex(
286+
ValueError,
287+
r"AllocatedStorage must be at least 200",
288+
):
289+
i.to_dict()
290+
291+
i.AllocatedStorage = "200"
292+
i.to_dict()
293+
294+
i = rds.DBInstance(
295+
"Database2",
296+
Engine="sqlserver-se",
297+
EngineVersion="15.3",
298+
StorageType="gp3",
299+
Iops=1000,
300+
AllocatedStorage="10",
301+
MasterUsername="test",
302+
MasterUserPassword="test",
303+
)
304+
with self.assertRaisesRegex(
305+
ValueError,
306+
r"AllocatedStorage must be at least 20",
307+
):
308+
i.to_dict()
309+
310+
i.AllocatedStorage = "20"
311+
i.to_dict()
312+
274313
def test_io1_storage_type_and_iops(self):
275314
i = rds.DBInstance(
276315
"NoAZAndMultiAZ",

troposphere/validators/rds.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,9 @@ def validate_dbinstance(self) -> None:
483483
max_iops_to_allocated_storage_ratio = 500.0
484484
if engine in ["mariadb", "mysql", "postgres"]:
485485
min_storage_size = 400
486-
elif engine in ["oracle"]:
486+
elif engine.startswith("oracle"):
487487
min_storage_size = 200
488-
elif engine in ["sqlserver"]:
488+
elif engine.startswith("sqlserver"):
489489
min_storage_size = 20
490490
min_iops_to_allocated_storage_ratio = 0.5
491491
else:

0 commit comments

Comments
 (0)