2222us_east_region_proxy = "proxy-test-name.proxy-XYZ.us-east-2.rds.amazonaws.com"
2323us_east_region_custom_domain = "custom-test-name.cluster-custom-XYZ.us-east-2.rds.amazonaws.com"
2424china_region_cluster = "database-test-name.cluster-XYZ.cn-northwest-1.rds.amazonaws.com.cn"
25- china_alt_region_cluster = "database-test-name.cluster-XYZ.rds.cn-northwest-1.amazonaws.com.cn"
2625china_region_cluster_read_only = "database-test-name.cluster-ro-XYZ.cn-northwest-1.rds.amazonaws.com.cn"
27- china_alt_region_cluster_read_only = "database-test-name.cluster-ro-XYZ.rds.cn-northwest-1.amazonaws.com.cn"
2826china_region_instance = "instance-test-name.XYZ.cn-northwest-1.rds.amazonaws.com.cn"
29- china_alt_region_instance = "instance-test-name.XYZ.rds.cn-northwest-1.amazonaws.com.cn"
3027china_region_proxy = "proxy-test-name.proxy-XYZ.cn-northwest-1.rds.amazonaws.com.cn"
31- china_alt_region_proxy = "proxy-test-name.proxy-XYZ.rds.cn-northwest-1.amazonaws.com.cn"
3228china_region_custom_domain = "custom-test-name.cluster-custom-XYZ.cn-northwest-1.rds.amazonaws.com.cn"
29+
30+ china_alt_region_cluster = "database-test-name.cluster-XYZ.rds.cn-northwest-1.amazonaws.com.cn"
31+ china_alt_region_cluster_read_only = "database-test-name.cluster-ro-XYZ.rds.cn-northwest-1.amazonaws.com.cn"
32+ china_alt_region_instance = "instance-test-name.XYZ.rds.cn-northwest-1.amazonaws.com.cn"
33+ china_alt_region_proxy = "proxy-test-name.proxy-XYZ.rds.cn-northwest-1.amazonaws.com.cn"
3334china_alt_region_custom_domain = "custom-test-name.cluster-custom-XYZ.rds.cn-northwest-1.amazonaws.com.cn"
35+ china_alt_region_limitless_db_shard_group = "database-test-name.limitless-XYZ.cn-northwest-1.rds.amazonaws.com.cn"
36+ extra_rds_china_path = "database-test-name.cluster-XYZ.rds.cn-northwest-1.rds.amazonaws.com.cn"
37+ missing_cn_china_path = "database-test-name.cluster-XYZ.rds.cn-northwest-1.amazonaws.com"
38+ missing_region_china_path = "database-test-name.cluster-XYZ.rds.amazonaws.com.cn"
39+
40+ us_east_region_elb_url = "elb-name.elb.us-east-2.amazonaws.com"
41+ us_isob_east_region_cluster = "database-test-name.cluster-XYZ.rds.us-isob-east-1.sc2s.sgov.gov"
42+ us_isob_east_region_cluster_read_only = "database-test-name.cluster-ro-XYZ.rds.us-isob-east-1.sc2s.sgov.gov"
43+ us_isob_east_region_instance = "instance-test-name.XYZ.rds.us-isob-east-1.sc2s.sgov.gov"
44+ us_isob_east_region_proxy = "proxy-test-name.proxy-XYZ.rds.us-isob-east-1.sc2s.sgov.gov"
45+ us_isob_east_region_custom_domain = "custom-test-name.cluster-custom-XYZ.rds.us-isob-east-1.sc2s.sgov.gov"
46+ us_isob_east_region_limitless_db_shard_group = "database-test-name.limitless-XYZ.rds.us-isob-east-1.sc2s.sgov.gov"
47+ us_gov_east_region_cluster = "database-test-name.cluster-XYZ.rds.us-gov-east-1.amazonaws.com"
48+
49+ us_iso_east_region_cluster = "database-test-name.cluster-XYZ.rds.us-iso-east-1.c2s.ic.gov"
50+ us_iso_east_region_cluster_read_only = "database-test-name.cluster-ro-XYZ.rds.us-iso-east-1.c2s.ic.gov"
51+ us_iso_east_region_instance = "instance-test-name.XYZ.rds.us-iso-east-1.c2s.ic.gov"
52+ us_iso_east_region_proxy = "proxy-test-name.proxy-XYZ.rds.us-iso-east-1.c2s.ic.gov"
53+ us_iso_east_region_custom_domain = "custom-test-name.cluster-custom-XYZ.rds.us-iso-east-1.c2s.ic.gov"
54+
55+ us_iso_east_region_limitless_db_shard_group = "database-test-name.limitless-XYZ.rds.us-iso-east-1.c2s.ic.gov"
3456
3557
3658@pytest .mark .parametrize ("test_value" , [
3961 china_region_cluster ,
4062 china_alt_region_cluster ,
4163 china_region_cluster_read_only ,
42- china_alt_region_cluster_read_only
64+ china_alt_region_cluster_read_only ,
65+ us_isob_east_region_cluster ,
66+ us_isob_east_region_cluster_read_only ,
67+ us_gov_east_region_cluster ,
68+ us_iso_east_region_cluster ,
69+ us_iso_east_region_cluster_read_only
4370])
4471def test_is_rds_cluster_dns (test_value ):
4572 target = RdsUtils ()
@@ -56,7 +83,15 @@ def test_is_rds_cluster_dns(test_value):
5683 china_region_custom_domain ,
5784 china_alt_region_instance ,
5885 china_alt_region_proxy ,
59- china_alt_region_custom_domain
86+ china_alt_region_custom_domain ,
87+ china_alt_region_limitless_db_shard_group ,
88+ us_east_region_elb_url ,
89+ us_isob_east_region_instance ,
90+ us_isob_east_region_proxy ,
91+ us_isob_east_region_limitless_db_shard_group ,
92+ us_iso_east_region_instance ,
93+ us_iso_east_region_proxy ,
94+ us_iso_east_region_limitless_db_shard_group ,
6095])
6196def test_is_not_rds_cluster_dns (test_value ):
6297 target = RdsUtils ()
@@ -79,7 +114,15 @@ def test_is_not_rds_cluster_dns(test_value):
79114 china_alt_region_cluster_read_only ,
80115 china_alt_region_instance ,
81116 china_alt_region_proxy ,
82- china_alt_region_custom_domain
117+ china_alt_region_custom_domain ,
118+ china_alt_region_limitless_db_shard_group ,
119+ us_isob_east_region_cluster ,
120+ us_isob_east_region_cluster_read_only ,
121+ us_isob_east_region_instance ,
122+ us_isob_east_region_proxy ,
123+ us_isob_east_region_custom_domain ,
124+ us_isob_east_region_limitless_db_shard_group ,
125+ us_gov_east_region_cluster ,
83126])
84127def test_is_rds_dns (test_value ):
85128 target = RdsUtils ()
@@ -101,11 +144,19 @@ def test_is_rds_dns(test_value):
101144 ("?.XYZ.rds.cn-northwest-1.amazonaws.com.cn" , china_alt_region_cluster_read_only ),
102145 ("?.XYZ.rds.cn-northwest-1.amazonaws.com.cn" , china_alt_region_instance ),
103146 ("?.XYZ.rds.cn-northwest-1.amazonaws.com.cn" , china_alt_region_proxy ),
104- ("?.XYZ.rds.cn-northwest-1.amazonaws.com.cn" , china_alt_region_custom_domain )
147+ ("?.XYZ.rds.cn-northwest-1.amazonaws.com.cn" , china_alt_region_custom_domain ),
148+ ("?.XYZ.cn-northwest-1.rds.amazonaws.com.cn" , china_alt_region_limitless_db_shard_group ),
149+ ("?.XYZ.rds.us-isob-east-1.sc2s.sgov.gov" , us_isob_east_region_cluster ),
150+ ("?.XYZ.rds.us-isob-east-1.sc2s.sgov.gov" , us_isob_east_region_cluster_read_only ),
151+ ("?.XYZ.rds.us-isob-east-1.sc2s.sgov.gov" , us_isob_east_region_instance ),
152+ ("?.XYZ.rds.us-isob-east-1.sc2s.sgov.gov" , us_isob_east_region_proxy ),
153+ ("?.XYZ.rds.us-isob-east-1.sc2s.sgov.gov" , us_isob_east_region_custom_domain ),
154+ ("?.XYZ.rds.us-isob-east-1.sc2s.sgov.gov" , us_isob_east_region_limitless_db_shard_group ),
155+ ("?.XYZ.rds.us-gov-east-1.amazonaws.com" , us_gov_east_region_cluster ),
105156])
106157def test_get_rds_instance_host_pattern (expected , test_value ):
107158 target = RdsUtils ()
108- assert expected == target .get_rds_instance_host_pattern (test_value )
159+ assert target .get_rds_instance_host_pattern (test_value ) == expected
109160
110161
111162@pytest .mark .parametrize ("expected, test_value" , [
@@ -123,11 +174,19 @@ def test_get_rds_instance_host_pattern(expected, test_value):
123174 ("cn-northwest-1" , china_alt_region_cluster_read_only ),
124175 ("cn-northwest-1" , china_alt_region_instance ),
125176 ("cn-northwest-1" , china_alt_region_proxy ),
126- ("cn-northwest-1" , china_alt_region_custom_domain )
177+ ("cn-northwest-1" , china_alt_region_custom_domain ),
178+ ("cn-northwest-1" , china_alt_region_limitless_db_shard_group ),
179+ ("us-isob-east-1" , us_isob_east_region_cluster ),
180+ ("us-isob-east-1" , us_isob_east_region_cluster_read_only ),
181+ ("us-isob-east-1" , us_isob_east_region_instance ),
182+ ("us-isob-east-1" , us_isob_east_region_proxy ),
183+ ("us-isob-east-1" , us_isob_east_region_custom_domain ),
184+ ("us-isob-east-1" , us_isob_east_region_limitless_db_shard_group ),
185+ ("us-gov-east-1" , us_gov_east_region_cluster ),
127186])
128187def test_get_rds_region (expected , test_value ):
129188 target = RdsUtils ()
130- assert expected == target .get_rds_region (test_value )
189+ assert target .get_rds_region (test_value ) == expected
131190
132191
133192@pytest .mark .parametrize ("test_value" , [
@@ -152,7 +211,13 @@ def test_is_writer_cluster_dns(test_value):
152211 china_alt_region_cluster_read_only ,
153212 china_alt_region_instance ,
154213 china_alt_region_proxy ,
155- china_alt_region_custom_domain
214+ china_alt_region_custom_domain ,
215+ china_alt_region_limitless_db_shard_group ,
216+ us_isob_east_region_cluster_read_only ,
217+ us_isob_east_region_instance ,
218+ us_isob_east_region_proxy ,
219+ us_isob_east_region_custom_domain ,
220+ us_isob_east_region_limitless_db_shard_group ,
156221])
157222def test_is_not_writer_cluster_dns (test_value ):
158223 target = RdsUtils ()
@@ -163,6 +228,7 @@ def test_is_not_writer_cluster_dns(test_value):
163228@pytest .mark .parametrize ("test_value" , [
164229 us_east_region_cluster_read_only ,
165230 china_region_cluster_read_only ,
231+ us_isob_east_region_cluster_read_only ,
166232])
167233def test_is_reader_cluster_dns (test_value ):
168234 target = RdsUtils ()
@@ -182,7 +248,14 @@ def test_is_reader_cluster_dns(test_value):
182248 china_region_cluster ,
183249 china_region_instance ,
184250 china_region_proxy ,
185- china_region_custom_domain
251+ china_region_custom_domain ,
252+ china_alt_region_limitless_db_shard_group ,
253+ us_isob_east_region_cluster ,
254+ us_isob_east_region_instance ,
255+ us_isob_east_region_proxy ,
256+ us_isob_east_region_custom_domain ,
257+ us_isob_east_region_limitless_db_shard_group ,
258+ us_gov_east_region_cluster ,
186259])
187260def test_is_not_reader_cluster_dns (test_value ):
188261 target = RdsUtils ()
0 commit comments