Skip to content

Commit 0333027

Browse files
committed
test: DBInstance PerformanceInsightsRetentionPeriod
1 parent b56ab1b commit 0333027

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

pkg/resource/db_instance/delta.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/resource/db_instance/hooks.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,16 @@ func instanceDeleting(r *resource) bool {
174174
return dbis == StatusDeleting
175175
}
176176

177+
func customPreCompare(delta *ackcompare.Delta, a *resource, b *resource) {
178+
if a.ko.Spec.PerformanceInsightsKMSKeyID == nil {
179+
a.ko.Spec.PerformanceInsightsKMSKeyID = b.ko.Spec.PerformanceInsightsKMSKeyID
180+
}
181+
182+
if a.ko.Spec.PerformanceInsightsRetentionPeriod == nil {
183+
a.ko.Spec.PerformanceInsightsRetentionPeriod = b.ko.Spec.PerformanceInsightsRetentionPeriod
184+
}
185+
}
186+
177187
// function to create restoreDbInstanceFromDbSnapshot payload and call restoreDbInstanceFromDbSnapshot API
178188
func (rm *resourceManager) restoreDbInstanceFromDbSnapshot(
179189
ctx context.Context,

test/e2e/tests/test_db_instance.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,10 @@ def test_enable_pi_postgres14_t3_micro(
315315
assert latest is not None
316316
assert latest['PerformanceInsightsEnabled'] is True
317317

318-
# TODO: Ensure that the server side defaults
319-
# (PerformanceInsightsRetentionPeriod and PerformanceInsightsKMSKeyID)
320-
# are also persisted back into the spec. This currently does not work
318+
assert 'performanceInsightsRetentionPeriod' in cr['spec']
319+
assert 'performanceInsightsKMSKeyID' in cr['spec']
320+
assert latest['PerformanceInsightsRetentionPeriod'] == cr['spec']['performanceInsightsRetentionPeriod']
321+
assert latest['PerformanceInsightsKMSKeyId'] == cr['spec']['performanceInsightsKMSKeyID']
321322

322323
def test_state_field_flapping(
323324
self,

0 commit comments

Comments
 (0)