-
Notifications
You must be signed in to change notification settings - Fork 28
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
core: make rook version more readable #121
core: make rook version more readable #121
Conversation
16bad81
to
d696d1f
Compare
earlier
now
|
cmd/commands/root.go
Outdated
@@ -106,7 +107,11 @@ func PreValidationCheck(ctx context.Context, k8sclientset *k8sutil.Clientsets, o | |||
} | |||
|
|||
rookVersion := exec.RunCommandInOperatorPod(ctx, k8sclientset, "rook", []string{"version"}, operatorNamespace, cephClusterNamespace, true, false) | |||
re := regexp.MustCompile("(?m)[\r\n]+^.*go: go.*$") // remove the go version from the output | |||
rookVersion = re.ReplaceAllString(rookVersion, "") |
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.
How about factoring out this string replacement to a small helper method, then add a unit test for it? Whenever there is a regular expression, a unit test is always helpful.
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.
added.
I want to add unit tests for all the methods but seems like that will take more time to release and require my bandwidth. XD
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.
Unit tests for now can avoid the high level commands since they are covered by the integration tests, but for small things like this, unit tests will be perfect.
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.
make sense
there was extra `fmt.Print()` in method `RunCommandInOperatorPod` due to which command output was printed two times. fixes: rook#118 Signed-off-by: subhamkrai <[email protected]>
during pre-validation check, rook version was printed in multiple lines with golang version which was making it difficult to read. Now, it prints in one single like with the golang version. Also, adding unit test for the regular expression. Signed-off-by: subhamkrai <[email protected]>
b9a1cea
to
8c63fee
Compare
core: make rook version more readable
during pre-validation check, rook version was
printed in multiple lines with golang version
which was making it difficult to read. Now, it
prints in one single like with the golang version.
core: print version info only once
there was extra
fmt.Print()
in methodRunCommandInOperatorPod
due to which command output was printed two times.
fixes: #118
Signed-off-by: subhamkrai [email protected]