-
Notifications
You must be signed in to change notification settings - Fork 344
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 support repetitive arguments to operand #1434
Conversation
64367dd
to
7ceebc2
Compare
CI seems to be failing.
|
Codecov Report
@@ Coverage Diff @@
## master #1434 +/- ##
==========================================
+ Coverage 87.70% 87.73% +0.02%
==========================================
Files 93 93
Lines 5839 5868 +29
==========================================
+ Hits 5121 5148 +27
- Misses 552 553 +1
- Partials 166 167 +1
Continue to review full report at Codecov.
|
Let me know when this gets ready to be reviewed. |
This is ready for review |
@@ -5,6 +5,8 @@ import ( | |||
"sort" | |||
"testing" | |||
|
|||
"github.com/stretchr/testify/require" | |||
|
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.
Import order.
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 like this hasn't been fixed.
|
||
func TestStringMap(t *testing.T) { | ||
o := NewOptions(nil) | ||
err := o.UnmarshalJSON([]byte(`{"firstsarg":"v1", "additional-headers":["whatever:thing", "access-control-allow-origin:blerg"]}`)) |
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 an example with real values here? I'm failing to see why additional-headers should be removed instead of having something like --firstsarg=v1 --additional-headers="whatever:thing" --additional-headers="access-control-allow-origin:blerg"
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'll add some real examples,
This is testing a new method I introduced in this PR. StringMap
, this method only returns a map with strings (mimic the old behavior when we didn't support arrays) , it omits repeated arguments, I did in this way because this map is used in a lot of places, and I wand to preserve that behaviour for those places which is used, also I don't want to do type asserting each time the option map is used.
pkg/apis/jaegertracing/v1/options.go
Outdated
@@ -7,10 +7,28 @@ import ( | |||
"strings" | |||
) | |||
|
|||
// Values represent and string or a slice of 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.
This doesn't seem accurate. Perhaps you meant "Values hold a map, with string as the key and either a string or a slice of strings as the value"
In any case, the name for this struct isn't really telling what the struct is. Can you come up with a better name?
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.
Better comment :) I'll change it, and rename this to a better name
@@ -69,18 +86,24 @@ func (o Options) MarshalJSON() ([]byte, error) { | |||
} | |||
|
|||
func (o *Options) parse(entries map[string]interface{}) { | |||
o.opts = make(map[string]string) | |||
o.opts = make(map[string]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.
Don't we have a structure with this signature already?
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 can't find it, We have FreeForm
but that is a different structure with json *[]byte
@@ -5,6 +5,8 @@ import ( | |||
"sort" | |||
"testing" | |||
|
|||
"github.com/stretchr/testify/require" | |||
|
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 like this hasn't been fixed.
Signed-off-by: Ruben Vargas <[email protected]>
Signed-off-by: Ruben Vargas <[email protected]>
Signed-off-by: Ruben Vargas <[email protected]>
Signed-off-by: Ruben Vargas <[email protected]>
Signed-off-by: Ruben Vargas <[email protected]>
bc554aa
to
eae65f7
Compare
@pavolloffay Could you please review? Thank you! |
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, one test job is failing
Fixes #1415
Signed-off-by: Ruben Vargas [email protected]