Skip to content

Commit 34895e5

Browse files
committed
Add test
1 parent 41ce8b8 commit 34895e5

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

pkg/apply/apply_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,27 @@ func TestApplyBasicUpdates(t *testing.T) {
8080
applier.topicConfig.Spec.ReplicationFactor = 3
8181
err = applier.Apply(ctx)
8282
require.NotNil(t, err)
83+
applier.topicConfig.Spec.ReplicationFactor = 2
84+
85+
// Settings are not deleted if AllowSettingsDeletion is false. They are
86+
// if it is true
87+
delete(applier.topicConfig.Spec.Settings, "cleanup.policy")
88+
err = applier.Apply(ctx)
89+
require.NoError(t, err)
90+
topicInfo, err = applier.adminClient.GetTopic(ctx, topicName, true)
91+
require.NoError(t, err)
92+
93+
assert.Equal(t, "delete", topicInfo.Config["cleanup.policy"])
94+
95+
applier.config.AllowSettingsDeletion = true
96+
err = applier.Apply(ctx)
97+
require.NoError(t, err)
98+
topicInfo, err = applier.adminClient.GetTopic(ctx, topicName, true)
99+
require.NoError(t, err)
100+
101+
_, present := topicInfo.Config["cleanup.policy"]
102+
assert.False(t, present)
103+
83104
}
84105

85106
func TestApplyPlacementUpdates(t *testing.T) {

0 commit comments

Comments
 (0)