Skip to content

Commit

Permalink
[chore] Add more e2e tests (#10607)
Browse files Browse the repository at this point in the history
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Adds more e2e tests to match main's current behavior. Some of these are
weird, and could be used to justify
#10603

<!-- Issue number if applicable -->
#### Link to tracking issue
Related to
#10603
  • Loading branch information
TylerHelmuth authored Jul 15, 2024
1 parent 6fcebdb commit b3699f2
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions confmap/internal/e2e/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,26 @@ func TestTypeCasting(t *testing.T) {
targetField: TargetFieldInlineString,
expected: "inline field with 0123 expansion",
},
{
value: "'!!str 0123'",
targetField: TargetFieldString,
expected: "!!str 0123",
},
{
value: "\"!!str 0123\"",
targetField: TargetFieldInlineString,
expected: "inline field with !!str 0123 expansion",
},
{
value: "''",
targetField: TargetFieldString,
expected: "",
},
{
value: "\"\"",
targetField: TargetFieldInlineString,
expected: "inline field with expansion",
},
{
value: "t",
targetField: TargetFieldBool,
Expand All @@ -130,6 +150,26 @@ func TestTypeCasting(t *testing.T) {
targetField: TargetFieldBool,
expected: true,
},
{
value: "foo\nbar",
targetField: TargetFieldString,
expected: "foo bar",
},
{
value: "foo\nbar",
targetField: TargetFieldInlineString,
expected: "inline field with foo bar expansion",
},
{
value: "\"1111:1111:1111:1111:1111::\"",
targetField: TargetFieldString,
expected: "1111:1111:1111:1111:1111::",
},
{
value: "\"1111:1111:1111:1111:1111::\"",
targetField: TargetFieldInlineString,
expected: "inline field with 1111:1111:1111:1111:1111:: expansion",
},
}

previousValue := featuregates.StrictlyTypedInputGate.IsEnabled()
Expand Down Expand Up @@ -265,6 +305,16 @@ func TestStrictTypeCasting(t *testing.T) {
targetField: TargetFieldInlineString,
resolveErr: "retrieved value does not have unambiguous string representation",
},
{
value: "1111:1111:1111:1111:1111::",
targetField: TargetFieldInlineString,
resolveErr: "retrieved value does not have unambiguous string representation",
},
{
value: "1111:1111:1111:1111:1111::",
targetField: TargetFieldString,
unmarshalErr: "'field' expected type 'string', got unconvertible type 'map[string]interface {}', value: 'map[1111:1111:1111:1111:1111::<nil>]'",
},
}

previousValue := featuregates.StrictlyTypedInputGate.IsEnabled()
Expand Down

0 comments on commit b3699f2

Please sign in to comment.