Skip to content

Conversation

@winder
Copy link
Contributor

@winder winder commented Apr 22, 2022

Summary

algocfg was returning values like %!s(uint64=16) and %!s(bool=true), with this change those are fixed to return 16 and true.

Test Plan

Seemed silly to unit test a built in function, but I went ahead and did it anyway.

@winder winder self-assigned this Apr 22, 2022
@winder winder force-pushed the will/fix-algocfg branch from 71eb62c to 681bd65 Compare April 22, 2022 13:31
@winder winder requested review from cce and removed request for algobolson April 22, 2022 16:20
@winder winder changed the title Fix algocfg get for non-string parameters. algocfg: Fix algocfg get for non-string parameters. Apr 22, 2022
@winder winder added bug Something isn't working Team Lamprey labels Apr 22, 2022
cce
cce previously approved these changes Apr 22, 2022
Copy link
Contributor

@cce cce left a 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

Copy link
Contributor

@brianolson brianolson left a 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.


func TestPrint(t *testing.T) {
testcases := []struct {
input interface{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this "Input" ...

}
for i, tc := range testcases {
t.Run(fmt.Sprintf("test %d", i), func(t *testing.T) {
var buf bytes.Buffer
Copy link
Contributor

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)

Copy link
Contributor Author

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.

@winder winder added Bug-Fix and removed bug Something isn't working labels Apr 22, 2022
Copy link
Contributor

@brianolson brianolson left a 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

@winder winder requested a review from cce April 22, 2022 21:16
@codecov-commenter
Copy link

codecov-commenter commented Apr 23, 2022

Codecov Report

Merging #3907 (8a95280) into master (12ded27) will decrease coverage by 0.12%.
The diff coverage is 25.00%.

@@            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     
Impacted Files Coverage Δ
cmd/algocfg/getCommand.go 28.00% <25.00%> (ø)
network/wsPeer.go 65.83% <0.00%> (-5.84%) ⬇️
catchup/service.go 68.64% <0.00%> (-0.99%) ⬇️
network/wsNetwork.go 62.79% <0.00%> (-0.20%) ⬇️
cmd/algocfg/datadir.go 0.00% <0.00%> (ø)
cmd/algocfg/setCommand.go 8.19% <0.00%> (ø)
cmd/algocfg/main.go 25.00% <0.00%> (ø)
cmd/algocfg/report.go 0.00% <0.00%> (ø)
cmd/algocfg/resetCommand.go 8.33% <0.00%> (ø)
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 12ded27...8a95280. Read the comment docs.

@winder winder merged commit cfe6e57 into algorand:master Apr 24, 2022
@winder winder deleted the will/fix-algocfg branch April 24, 2022 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants