-
Notifications
You must be signed in to change notification settings - Fork 98
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
Refactored kestest
integration tests
#368
Conversation
e24921d
to
3ff71e0
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.
Minor tweaks. Also consider a descriptive commit message as suggested by the contributing doc.
Ref: https://github.com/minio/kes/blob/master/CONTRIBUTING.md#commit-message
kestest/gateway_test.go
Outdated
@@ -633,3 +626,28 @@ func mustDecodeB64(s string) []byte { | |||
} | |||
return b | |||
} | |||
|
|||
func clean(ctx context.Context, client *kes.Client, pattern string, t *testing.T) { |
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.
You can omit the pattern here and use the match all pattern *
in ListKeys
.
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.
You can omit the pattern here and use the match all pattern
*
inListKeys
.
Ok, makes sense. Will do the changes.
Signed-off-by: Shubhendu Ram Tripathi <[email protected]>
343ea85
to
2e4fa01
Compare
defer iter.Close() | ||
|
||
names := []string{} | ||
keysInfo, err := iter.Values(-1) |
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.
iter.Values(-1)
already collects all KeyInfo
objects into one slice. You don't need to clone this slice again.
You can simply remove:
for _, keyInfo := range keysInfo {
names = append(names, keyInfo.Name)
}
An just do one for loop:
for _, info := range keyInfos {
if err = client.DeleteKey(ctx, info.Name); err != nil {
t.Errorf("Cleanup: failed to delete '%s': %v", name, err)
}
}
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.
Done
Signed-off-by: Shubhendu Ram Tripathi <[email protected]>
2e4fa01
to
6d6b57b
Compare
This PR adds a cleanup method to make sure each test works in its entirety and there are no left outs.
Also all tests use the same common functions for scenarios like
create
,import
,generate
,encrypt
anddecrypt
etc.Different kind of tests can be executed using
go test -v -run="<test>"
command.e.g.
go test -v -run="TestGatewayMem"
orgo test -v -fs.path=./keys -run="TestGatewayFS"