-
Notifications
You must be signed in to change notification settings - Fork 437
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
Add unit tests for xds package #8419
Conversation
d041582
to
a21e5af
Compare
Issues linked to changelog: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new tests look good to me. I don't have enough context to know whether there are additional tests that we should add.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
a21e5af
to
8553bfe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for future reference github/bulldozer will automatically squash changes and it's more readable to leave the commit history intact until then
projects/gloo/pkg/xds/cache_test.go
Outdated
nodeRoleHasher := xds.NewNodeRoleHasher() | ||
node := &envoy_config_core_v3.Node{} | ||
// Ensure it returns the fallback key if the role field in the node metadata is not present | ||
Expect(nodeRoleHasher.ID(node)).To(Equal(xds.FallbackNodeCacheKey)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I've tried to lean away from comments above assertions, and instead use the "optional desscription" (https://onsi.github.io/gomega/#annotating-assertions) field of an assertion to perform that documentation. That way if the assertion fails, it shows that relevant details.
Not a blocker, just wanted to share this pattern
projects/gloo/pkg/xds/cache_test.go
Outdated
nodeRoleHasher := xds.NewNodeRoleHasher() | ||
node := &envoy_config_core_v3.Node{} | ||
Expect(nodeRoleHasher.ID(node)).To(Equal(xds.FallbackNodeCacheKey), | ||
fmt.Sprintf("Should return %s if the role field in the node metadata is not present", xds.FallbackNodeCacheKey)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: https://onsi.github.io/gomega/#annotating-assertions you don't need to call fmt.Sprintf
, that will be handled by Gomega directly. You can just pass the format and the parameters (example in the docs that I linked)
Visit the preview URL for this PR (updated for commit 8c248d5): https://gloo-edge--pr8419-add-xds-tests-2bxskvli.web.app (expires Mon, 03 Jul 2023 16:42:00 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 77c2b86e287749579b7ff9cadb81e099042ef677 |
Description
Adds additional tests to the xds package
Context
https://github.com/solo-io/solo-projects/issues/5113
Checklist:
make -B install-go-tools generated-code
to ensure there will be no code diffBOT NOTES:
resolves https://github.com/solo-io/solo-projects/issues/5113