-
Notifications
You must be signed in to change notification settings - Fork 524
algocfg: Fix algocfg get for non-string parameters. #3907
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
Conversation
71eb62c to
681bd65
Compare
cce
left a comment
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, there is a partitiontest linter warning though
brianolson
left a comment
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 the unit test would be more interesting if it incorporated getObjectProperty. Maybe getObjectProperty changes to encompass Sprintf("%v",...) and return the property stringified, then that function is fully unit testable.
cmd/algocfg/getCommand_test.go
Outdated
|
|
||
| func TestPrint(t *testing.T) { | ||
| testcases := []struct { | ||
| input interface{} |
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 this "Input" ...
cmd/algocfg/getCommand_test.go
Outdated
| } | ||
| for i, tc := range testcases { | ||
| t.Run(fmt.Sprintf("test %d", i), func(t *testing.T) { | ||
| var buf bytes.Buffer |
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.
and around here val, err := getObjectProperty(tc, "Input")
Then Fprintf or Sprintf("%v", val)
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.
Using the test case as an input to the test function is genius.
brianolson
left a comment
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.
One last tweak then good to go
Codecov Report
@@ Coverage Diff @@
## master #3907 +/- ##
==========================================
- Coverage 50.09% 49.96% -0.13%
==========================================
Files 394 400 +6
Lines 68456 68618 +162
==========================================
- Hits 34294 34286 -8
- Misses 30465 30630 +165
- Partials 3697 3702 +5
Continue to review full report at Codecov.
|
Summary
algocfg was returning values like
%!s(uint64=16)and%!s(bool=true), with this change those are fixed to return16andtrue.Test Plan
Seemed silly to unit test a built in function, but I went ahead and did it anyway.