-
Notifications
You must be signed in to change notification settings - Fork 458
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
API refactor: add attested nodes query tests #1690
API refactor: add attested nodes query tests #1690
Conversation
Signed-off-by: Marcos Yacob <marcos@scytale.io>
func TestListAttestedNodesQuery(t *testing.T) { | ||
for _, tt := range []struct { | ||
dialect string | ||
paged string |
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.
maybe having paged
defined as a type is a better fit for this?
type paged int
const (
no paged = iota
withToken
withNoToken
)
expiresBefore := time.Now().Unix() | ||
t.Run(name, func(t *testing.T) { | ||
req := new(datastore.ListAttestedNodesRequest) | ||
switch tt.paged { |
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.
I think that this switch could be more clear if it's done through a custom type.
Token: "2", | ||
} | ||
default: | ||
require.FailNow(t, "unsupported page case: %q", tt.paged) |
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.
FailNowf
should be used when using format strings.
req.FetchSelectors = true | ||
|
||
default: | ||
require.FailNow(t, "unsupported by case: %q", by) |
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.
FailNowf
should be used when using format strings.
Token: "2", | ||
} | ||
default: | ||
require.FailNow(t, "unsupported page case: %q", tt.paged) |
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: unsupported paged case
Signed-off-by: Marcos Yacob <marcos.yacob@hpe.com>
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.
Thanks @MarcosDY!
CI/CD and DCO passed but it looks like there was a hiccup with notifications. Merging anyway. |
Add unit tests to validate attested nodes query