-
Notifications
You must be signed in to change notification settings - Fork 147
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 snapshot parameter flag #236
Add snapshot parameter flag #236
Conversation
Hi @wnxn. Thanks for your PR. I'm waiting for a kubernetes-csi member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the 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. |
/assign @pohly PTAL |
/assign @pohly |
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.
Looks straight-forward, sorry for not getting to it earlier. Mostly looks good.
pkg/sanity/sanity.go
Outdated
} | ||
err = yaml.Unmarshal(yamlFile, &reqConfig.TestVolumeParameters) | ||
if err != nil { | ||
panic(fmt.Sprintf("error unmarshaling yaml: %v", err)) | ||
} | ||
} | ||
|
||
snapParamPath := reqConfig.TestSnapshotParametersFile | ||
if len(snapParamPath) != 0 { |
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.
Instead copying the unmarshaling code from the reqConfig.TestVolumeParametersFile
handling above, can you move it into a helper function?
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 for your review. I will amend my commit.
pkg/sanity/sanity.go
Outdated
TestVolumeExpandSize int64 | ||
TestVolumeParametersFile string | ||
TestVolumeParameters map[string]string | ||
TestSnapshotParametersFile 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.
Can you add the new fields in a separate block (i.e. don't mix with TestVolumeExpand*
) and add documentation? I know it's missing also for the other fields, but that's not a good example to follow 🤷♂️
6f14761
to
b1cb447
Compare
pkg/sanity/sanity.go
Outdated
@@ -357,6 +354,22 @@ func loadSecrets(path string) (*CSISecrets, error) { | |||
return &creds, nil | |||
} | |||
|
|||
// loadMap reads a map from given file path. | |||
func loadMap(path string) map[string]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.
I think you can make this more generic:
func loadFromFile(from string, to interface{}) {
if from != "" {
...
err = yaml.Unmarshal(yamlFile, to)
...
}
}
Then call it with:
loadFromFile(reqConfig.TestSnapshotParametersFile, &reqConfig.TestSnapshotParameters)
Untested, but I think it'll work, and then we have something that could also become useful for populating other data structures.
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.
OK, I will update and test it.
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.
Hi @pohly , The method is worked and I updated this PR. Would you please review again?
Signed-off-by: Xin Wang <wileywang@yunify.com>
b1cb447
to
e0947e1
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.
/lgtm
/approve
Thanks for taking the time to enhance csi-test!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pohly, wnxn 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:
Approvers can indicate their approval by writing |
…driver-host-path_version Bump csi-driver-host-path version up to v1.12.0
Signed-off-by: Xin Wang wileywang@yunify.com
What type of PR is this?
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #235
Special notes for your reviewer:
Does this PR introduce a user-facing change?: