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 Delta.DifferentAt behavior via changes to Path.Contains #20

Merged
merged 1 commit into from
Jun 8, 2021

Conversation

echen-98
Copy link
Contributor

@echen-98 echen-98 commented Jun 4, 2021

@ack-bot
Copy link
Collaborator

ack-bot commented Jun 4, 2021

Hi @echen-98. Thanks for your PR.

I'm waiting for a aws-controllers-k8s member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ack-bot ack-bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 4, 2021
@@ -51,14 +51,30 @@ func (p Path) Pop() {
}
}

// Contains returns true if the supplied string appears within the Path
// TODO: case sensitivity?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

should we keep case-sensitive comparison?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think so, yes. We expect case-sensitivity in all Go fields and I'd expect that these strings are reflections of Go fields.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, removed TODO comment

@RedbackThomson
Copy link
Contributor

/ok-to-test

@ack-bot ack-bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 4, 2021
Comment on lines +61 to +65
require.True(d.DifferentAt("Baz.Y"))
require.False(d.DifferentAt("Y")) // there is no diff for top-level field "Y"
require.False(d.DifferentAt("Bar")) // diff exists but it was not added to Delta
require.False(d.DifferentAt("Baz.Y.Z")) // subject length exceeds length of diff Path
require.False(d.DifferentAt("Baz.Z")) // matches Path top-level field but not sub-field
Copy link
Contributor

Choose a reason for hiding this comment

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

++ Super clear test cases! Love it!

Copy link
Collaborator

Choose a reason for hiding this comment

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

agreed, excellent clarity @echen-98

@@ -51,14 +51,30 @@ func (p Path) Pop() {
}
}

// Contains returns true if the supplied string appears within the Path
// TODO: case sensitivity?
Copy link
Contributor

Choose a reason for hiding this comment

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

I think so, yes. We expect case-sensitivity in all Go fields and I'd expect that these strings are reflections of Go fields.

@vijtrip2
Copy link
Contributor

vijtrip2 commented Jun 4, 2021

/approve

Copy link
Member

@a-hilaly a-hilaly left a comment

Choose a reason for hiding this comment

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

Very nice, thanks Eric!
I left one comment below

Comment on lines 54 to 62
/* Contains returns true if the supplied string, delimited on ".", matches
p.parts up to the length of the supplied string.
e.g. if the Path p represents "A.B":
subject "A" -> true
subject "A.B" -> true
subject "A.B.C" -> false
subject "B" -> false
subject "A.C" -> false
*/
Copy link
Member

Choose a reason for hiding this comment

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

Please use // not /** .. */ for muiltiline comments :)

Copy link
Member

Choose a reason for hiding this comment

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

You can also instruct godoc to generate testable examples in the package documentation: https://blog.golang.org/examples / https://blog.golang.org/godoc

Copy link
Collaborator

@jaypipes jaypipes left a comment

Choose a reason for hiding this comment

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

Great stuff @echen-98 :) Thank you!

Comment on lines +61 to +65
require.True(d.DifferentAt("Baz.Y"))
require.False(d.DifferentAt("Y")) // there is no diff for top-level field "Y"
require.False(d.DifferentAt("Bar")) // diff exists but it was not added to Delta
require.False(d.DifferentAt("Baz.Y.Z")) // subject length exceeds length of diff Path
require.False(d.DifferentAt("Baz.Z")) // matches Path top-level field but not sub-field
Copy link
Collaborator

Choose a reason for hiding this comment

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

agreed, excellent clarity @echen-98

Comment on lines +54 to +55
// Contains returns true if the supplied string, delimited on ".", matches
// p.parts up to the length of the supplied string.
Copy link
Collaborator

Choose a reason for hiding this comment

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

femto-nit: not sure if it's your IDE or editor changing the above, but comments should have a single space (not \t) after the // and before the first letter of the comment...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it, will keep in mind for next time

@jaypipes
Copy link
Collaborator

jaypipes commented Jun 8, 2021

/lgtm

@ack-bot ack-bot added the lgtm Indicates that a PR is ready to be merged. label Jun 8, 2021
@ack-bot
Copy link
Collaborator

ack-bot commented Jun 8, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: echen-98, jaypipes, RedbackThomson, vijtrip2

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [RedbackThomson,jaypipes,vijtrip2]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants