Sink: Force JSON encoding for .json files

This commit is contained in:
Mattias Öhrn
2021-05-31 08:00:26 +02:00
parent d9435bd1b1
commit fa3e829eb6
2 changed files with 55 additions and 10 deletions

View File

@@ -26,7 +26,7 @@ func TestByteWriter(t *testing.T) {
testCases := []testCase{
//
//
// Test Case
//
{
name: "wrap_resource_list",
@@ -60,7 +60,7 @@ functionConfig:
},
//
//
// Test Case
//
{
name: "multiple_items",
@@ -189,6 +189,32 @@ metadata:
config.kubernetes.io/path: "a/b/a_test.yaml"
`,
},
//
// Test Case
//
{
name: "encode_valid_json",
items: []string{
`{
"a": "a long string that would certainly see a newline introduced by the YAML marshaller abcd123",
"metadata": {
"annotations": {
"config.kubernetes.io/path": "test.json"
}
}
}`,
},
expectedOutput: `{
"a": "a long string that would certainly see a newline introduced by the YAML marshaller abcd123",
"metadata": {
"annotations": {
"config.kubernetes.io/path": "test.json"
}
}
}`,
},
}
for i := range testCases {