Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 0 additions & 60 deletions test/e2e/tests/test_replicationgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,66 +271,6 @@ def test_rg_update(self, rg_update_input, rg_update):
# assert new tags
assert_spec_tags(rg_id, new_tags)

# test modifying properties related to tolerance: replica promotion, multi AZ, automatic failover
def test_rg_fault_tolerance(self, rg_fault_tolerance):
(reference, _) = rg_fault_tolerance
assert k8s.wait_on_condition(
reference, "Ready", "True", wait_periods=90)

# assert initial state
resource = k8s.get_resource(reference)
assert resource['status']['automaticFailover'] == "enabled"
assert resource['status']['multiAZ'] == "enabled"

# retrieve current names of primary (currently node1) and replica (currently node2)
members = resource['status']['nodeGroups'][0]['nodeGroupMembers']
assert len(members) == 2
node1 = None
node2 = None
for node in members:
if node['currentRole'] == 'primary':
node1 = node['cacheClusterID']
elif node['currentRole'] == 'replica':
node2 = node['cacheClusterID']
assert node1 is not None and node2 is not None

# disable both fields, wait for resource to sync
patch = {"spec": {"automaticFailoverEnabled": False,
"multiAZEnabled": False}}
_ = k8s.patch_custom_resource(reference, patch)
sleep(DEFAULT_WAIT_SECS)
assert k8s.wait_on_condition(
reference, "Ready", "True", wait_periods=90)

# assert new state
resource = k8s.get_resource(reference)
assert resource['status']['automaticFailover'] == "disabled"
assert resource['status']['multiAZ'] == "disabled"

# promote replica to primary, re-enable both multi AZ and AF
patch = {"spec": {"primaryClusterID": node2,
"automaticFailoverEnabled": True, "multiAZEnabled": True}}
_ = k8s.patch_custom_resource(reference, patch)
sleep(DEFAULT_WAIT_SECS)
assert k8s.wait_on_condition(
reference, "Ready", "True", wait_periods=90)

# assert roles
resource = k8s.get_resource(reference)
members = resource['status']['nodeGroups'][0]['nodeGroupMembers']
assert len(members) == 2
for node in members:
if node['cacheClusterID'] == node1:
assert node['currentRole'] == 'replica'
elif node['cacheClusterID'] == node2:
assert node['currentRole'] == 'primary'
else:
raise AssertionError(f"Unknown node {node['cacheClusterID']}")

# assert AF and multi AZ
assert resource['status']['automaticFailover'] == "enabled"
assert resource['status']['multiAZ'] == "enabled"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @gustavodiaz7722 !!

def test_rg_creation_deletion(self, make_rg_name, make_replication_group, rg_deletion_waiter):
input_dict = {
"RG_ID": make_rg_name("rg-delete"),
Expand Down