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

Relax diff on maintenance_policy.daily_maintenance_window.start_time #726

Conversation

michaelbannister
Copy link
Contributor

Fixes #719.
Add a DiffSuppressFunc to start_time.

I can't see if there's a useful way to test this in the unit test and I can't see how I'd trigger this condition through an acceptance test case. Ideas & advice welcome!

If the maintenance window has been set outside of Terraform to a time with a
single-digit hour (such as 1:00), and the terraform definition is set to the
same hour but with a leading zero as per validation (i.e. 01:00), do not
consider the time to be changed (as we currently don't support update on this
property).

Fixes hashicorp#719
@rosbo rosbo self-requested a review November 13, 2017 17:43
Copy link
Contributor

@rosbo rosbo left a comment

Choose a reason for hiding this comment

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

Thank you for improving this resource. I only have one small suggestion around testing.

func TestRfc3339TimeDiffSuppress(t *testing.T) {
old := "2:00"
new := "02:00"
if rfc3339TimeDiffSuppress("time", old, new, nil) == false {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add also a test case to make sure it doesn't suppress a diff for the following cases:
2:00 and 3:00
02:00 and 3:00
2:00 and 03:00

I suggest you use a table driven test approach like TestIpCidrRangeDiffSuppress in this file.

@michaelbannister
Copy link
Contributor Author

Added more test cases as requested. I've removed my assumption that the 'new' value will always have a two-digit hour, in case that validation restriction gets lifted (or used somewhere else where it's not enforced).

@rosbo
Copy link
Contributor

rosbo commented Nov 13, 2017

Thanks Michael!

@rosbo rosbo merged commit ee641e0 into hashicorp:master Nov 13, 2017
@michaelbannister michaelbannister deleted the maintenance-window-relax-time-format-diff branch November 13, 2017 19:31
@ghost
Copy link

ghost commented Mar 30, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants