-
Notifications
You must be signed in to change notification settings - Fork 105
Remote Labels Configuration #1402
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
Changes from 24 commits
ed33c6a
a8cb72b
204e19c
b5fb1ce
204c1e3
e708254
5479bcf
2eb0944
f52b495
ba7b248
1e8ef28
e72b755
44c7334
555b8e1
0283cce
be8f9be
87d4611
6f041e2
9cf316c
62dac85
7f8be83
c2ac5ab
99194db
544c3d6
e96fee0
e5e1ffa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,3 +70,45 @@ func TestConvertToStructs(t *testing.T) { | |
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestConvertToMaps(t *testing.T) { | ||
| tests := []struct { | ||
| name string | ||
| expected map[string]any | ||
| input []*structpb.Struct | ||
| }{ | ||
| { | ||
| name: "Test 1: Valid input with simple key-value pairs", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing cases for slices, and structs There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should there be a test for invalid values? Empty values, blank "" values and special characters. For valid scenario, should we include "config-sync-group" key?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tests for this function should be pretty generic, the exact strings we place in the tests shouldn't really matter
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function is only to covert to a map validation will be done elsewhere |
||
| expected: map[string]any{ | ||
| "key1": "value1", | ||
| "key2": 123, | ||
| "key3": true, | ||
| }, | ||
| input: []*structpb.Struct{ | ||
| { | ||
| Fields: map[string]*structpb.Value{ | ||
| "key1": structpb.NewStringValue("value1"), | ||
| }, | ||
| }, | ||
| { | ||
| Fields: map[string]*structpb.Value{ | ||
| "key2": structpb.NewNumberValue(123), | ||
| }, | ||
| }, | ||
| { | ||
| Fields: map[string]*structpb.Value{ | ||
| "key3": structpb.NewBoolValue(true), | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| } | ||
|
|
||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| got := ConvertToMap(tt.input) | ||
|
|
||
| assert.Equal(t, tt.expected, got) | ||
| }) | ||
| } | ||
| } | ||
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.