Skip to content

Commit 913cb1e

Browse files
committed
address regression with User code, fix RG deletion test
1 parent e0d2cb9 commit 913cb1e

File tree

3 files changed

+27
-14
lines changed

3 files changed

+27
-14
lines changed

pkg/resource/user/delta_util.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@ func filterDelta(
2323
) {
2424
// the returned AccessString can be different than the specified one; as long as the last requested AccessString
2525
// matches the currently desired one, remove this difference from the delta
26-
//TODO: revert this call to Spec.AccessString once we have a new implementation of it
27-
if delta.DifferentAt("AccessString") {
26+
if delta.DifferentAt("Spec.AccessString") {
2827
if *desired.ko.Spec.AccessString == *desired.ko.Status.LastRequestedAccessString {
2928

30-
//TODO: revert the call to Spec.AccessString once removeFromDelta implementation changes
31-
removeFromDelta(delta, "AccessString")
29+
removeFromDelta(delta, "Spec.AccessString")
3230
}
3331
}
3432
}
@@ -43,7 +41,7 @@ func removeFromDelta(
4341
differences := delta.Differences
4442

4543
// identify index of Difference to remove
46-
//TODO: change once we get a Path.Equals or similar method
44+
//TODO: this could require a stricter Path.Equals down the road
4745
var i *int = nil
4846
for j, diff := range differences {
4947
if diff.Path.Contains(subject) {

pkg/resource/user/post_build_request.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,11 @@ func (rm *resourceManager) populateUpdatePayload(
2626
r *resource,
2727
delta *ackcompare.Delta,
2828
) {
29-
//TODO: change all calls to DifferentAt to include full path once the implementation is clarified
30-
31-
if delta.DifferentAt("AccessString") && r.ko.Spec.AccessString != nil {
29+
if delta.DifferentAt("Spec.AccessString") && r.ko.Spec.AccessString != nil {
3230
input.AccessString = r.ko.Spec.AccessString
3331
}
3432

35-
if delta.DifferentAt("NoPasswordRequired") && r.ko.Spec.NoPasswordRequired != nil {
33+
if delta.DifferentAt("Spec.NoPasswordRequired") && r.ko.Spec.NoPasswordRequired != nil {
3634
input.NoPasswordRequired = r.ko.Spec.NoPasswordRequired
3735
}
3836

test/e2e/tests/test_replicationgroup.py

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,24 @@ def rg_cmd_update(rg_cmd_update_input, make_replication_group, rg_deletion_waite
154154
rg_deletion_waiter.wait(ReplicationGroupId=input_dict["RG_ID"])
155155

156156

157+
@pytest.fixture(scope="module")
158+
def rg_deletion_input(make_rg_name):
159+
return {
160+
"RG_ID": make_rg_name("rg-delete"),
161+
"ENGINE_VERSION": "6.x",
162+
"NUM_NODE_GROUPS": "1",
163+
"REPLICAS_PER_NODE_GROUP": "1"
164+
}
165+
166+
167+
@pytest.fixture(scope="module")
168+
def rg_deletion(rg_deletion_input, make_replication_group):
169+
input_dict = rg_deletion_input
170+
171+
(reference, resource) = make_replication_group("replicationgroup_cmd_update", input_dict, input_dict["RG_ID"])
172+
return (reference, resource) # no teardown, as the teardown is part of the actual test
173+
174+
157175
@service_marker
158176
class TestReplicationGroup:
159177

@@ -229,9 +247,8 @@ def test_rg_auth_token(self, rg_auth_token):
229247
k8s.patch_custom_resource(reference, updated_spec)
230248
assert k8s.wait_on_condition(reference, "ACK.ResourceSynced", "True", wait_periods=30)
231249

232-
def test_rg_delete(self, rg_cmd_update_input, rg_deletion_waiter):
233-
input_dict = rg_cmd_update_input
234-
(reference, _) = make_replication_group("replicationgroup_cmd_update", input_dict, input_dict["RG_ID"])
250+
def test_rg_deletion(self, rg_deletion_input, rg_deletion, rg_deletion_waiter):
251+
(reference, _) = rg_deletion
235252
assert k8s.wait_on_condition(reference, "ACK.ResourceSynced", "True", wait_periods=30)
236253

237254
# assertions after initial creation
@@ -244,7 +261,7 @@ def test_rg_delete(self, rg_cmd_update_input, rg_deletion_waiter):
244261

245262
resource = k8s.get_resource(reference)
246263
assert resource['metadata']['deletionTimestamp'] is not None
247-
# uncomment when reconciler->cleanup() invokes patchResource()
264+
# TODO: uncomment when reconciler->cleanup() invokes patchResource()
248265
# assert k8s.wait_on_condition(reference, "ACK.ResourceSynced", "False", wait_periods=1)
249266

250-
rg_deletion_waiter.wait(ReplicationGroupId=input_dict["RG_ID"])
267+
rg_deletion_waiter.wait(ReplicationGroupId=rg_deletion_input["RG_ID"])

0 commit comments

Comments
 (0)