Skip to content

Commit 324bf71

Browse files
authored
Fix dbcluster CloudWatchLogExport flaky e2e tests (#178)
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 9ae116b commit 324bf71

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

test/e2e/tests/test_db_cluster.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,12 @@
1717
import time
1818

1919
import pytest
20-
2120
from acktest.k8s import resource as k8s
2221
from acktest.resources import random_suffix_name
23-
from e2e import service_marker, CRD_GROUP, CRD_VERSION, load_rds_resource
24-
from e2e.replacement_values import REPLACEMENT_VALUES
25-
from e2e import condition
26-
from e2e import db_cluster
22+
from e2e import (CRD_GROUP, CRD_VERSION, condition, db_cluster,
23+
load_rds_resource, service_marker, tag)
2724
from e2e.fixtures import k8s_secret
28-
from e2e import tag
25+
from e2e.replacement_values import REPLACEMENT_VALUES
2926

3027
RESOURCE_PLURAL = 'dbclusters'
3128

@@ -301,7 +298,7 @@ def test_flip_enable_iam_db_authn(
301298
assert latest["IAMDatabaseAuthenticationEnabled"] == True
302299

303300
def test_enable_cloudwatch_logs_exports(
304-
self, aurora_postgres_cluster,
301+
self, aurora_postgres_cluster,
305302
):
306303
ref, _, db_cluster_id, _ = aurora_postgres_cluster
307304
db_cluster.wait_until(
@@ -328,7 +325,7 @@ def test_enable_cloudwatch_logs_exports(
328325
assert latest["EnabledCloudwatchLogsExports"] == ["postgresql"]
329326

330327
def test_disable_cloudwatch_logs_exports(
331-
self, aurora_postgres_cluster_log_exports,
328+
self, aurora_postgres_cluster_log_exports,
332329
):
333330
ref, _, db_cluster_id = aurora_postgres_cluster_log_exports
334331
db_cluster.wait_until(
@@ -338,21 +335,27 @@ def test_disable_cloudwatch_logs_exports(
338335

339336
current = db_cluster.get(db_cluster_id)
340337
assert current is not None
341-
enabledCloudwatchLogsExports = current.get("EnabledCloudwatchLogsExports",None)
338+
339+
enabledCloudwatchLogsExports = current.get("EnabledCloudwatchLogsExports", None)
342340
assert enabledCloudwatchLogsExports is not None
341+
assert enabledCloudwatchLogsExports == ["postgresql"]
342+
343343
k8s.patch_custom_resource(
344344
ref,
345-
{"spec": {"enableCloudwatchLogsExports": None}},
345+
{"spec": {"enableCloudwatchLogsExports": []}},
346346
)
347347

348348
db_cluster.wait_until(
349349
db_cluster_id,
350350
db_cluster.status_matches("available"),
351351
)
352352

353+
time.sleep(MODIFY_WAIT_AFTER_SECONDS)
354+
353355
latest = db_cluster.get(db_cluster_id)
354356
assert latest is not None
355-
enabledCloudwatchLogsExportsLatest = latest.get("EnabledCloudwatchLogsExports",None)
357+
358+
enabledCloudwatchLogsExportsLatest = latest.get("EnabledCloudwatchLogsExports", None)
356359
assert enabledCloudwatchLogsExportsLatest is None
357360

358361
def test_update_dbcluster_password(

0 commit comments

Comments
 (0)