diff --git a/confmap/internal/e2e/types_test.go b/confmap/internal/e2e/types_test.go index e57d3f8af53..7385ce1cde3 100644 --- a/confmap/internal/e2e/types_test.go +++ b/confmap/internal/e2e/types_test.go @@ -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, @@ -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() @@ -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::]'", + }, } previousValue := featuregates.StrictlyTypedInputGate.IsEnabled()