Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix s3 notificationConfiguration #917

Merged

Conversation

smcavallo
Copy link
Contributor

@smcavallo smcavallo commented Nov 9, 2021

Signed-off-by: smcavallo smcavallo@hotmail.com

fixes s3 notificationConfiguration continually being updated.

Description of your changes

Updates IsUpToDate comparisons for notificationConfiguration - most notably ignore the Id and ignore ordering when there are multiple configurations.

Adds additional unit tests.

Note: this excludes the Id properties during the comparison. This should be fine because the actual rules are being compared.
Per the docs https://docs.aws.amazon.com/cli/latest/reference/s3api/put-bucket-notification-configuration.html

Id -> (string)

An optional unique identifier for configurations in a notification configuration.  If you don't provide one, Amazon S3 will assign an ID.

Ignoring the Id in the comparison is workaround since these properties are not LateInitialized

Fixes #896

I have:

  • Read and followed Crossplane's contribution process.
  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

  • Unit testing
  • Reconcile a bucket and ensure the ID in the console has not changed
  • force an update to a bucket and ensure the ID in the console has not changed
  • Debug logging in the sdk to watch API calls

@smcavallo smcavallo marked this pull request as ready for review November 9, 2021 14:11
@smcavallo smcavallo changed the title WIP: fix s3 notificationConfiguration fix s3 notificationConfiguration Nov 9, 2021
@haarchri
Copy link
Member

haarchri commented Nov 14, 2021

@smcavallo can you squash commits for Clean history ?
ressource is now working as expected

@haarchri haarchri self-requested a review November 15, 2021 07:38
Signed-off-by: smcavallo <smcavallo@hotmail.com>
Copy link
Member

@negz negz left a comment

Choose a reason for hiding this comment

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

Thanks again @smcavallo!

}
return true
})
}
Copy link
Member

Choose a reason for hiding this comment

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

This is totally fine as is, but for future reference you could also pass in a couple ofcmpopts.SortSlices options, each with a less function for a slice of the relevant type of struct.

Comment on lines +604 to +606
g := NewGomegaWithT(t)
actual, err := IsNotificationConfigurationUpToDate(tc.args.cr, tc.args.b)
g.Expect(err).NotTo(HaveOccurred())
Copy link
Member

Choose a reason for hiding this comment

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

We try to avoid Gomega usage in our tests. I want to include this with the v0.21.1 release today so I plan to merge and quickly follow up to remove this.

@negz negz merged commit 117bd7b into crossplane-contrib:master Nov 19, 2021
@github-actions
Copy link

Successfully created backport PR #962 for release-0.21.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

S3 bucket would not reach Available condition when set notificationConfiguration
3 participants