diff --git a/pkg/resource/json/canonical_test.go b/pkg/resource/json/canonical_test.go index 0f532a6f..6d215bc7 100644 --- a/pkg/resource/json/canonical_test.go +++ b/pkg/resource/json/canonical_test.go @@ -52,10 +52,10 @@ func TestCanonicalize(t *testing.T) { if err != nil { t.Fatalf("Failed to read expected the output file: %v", err) } - expectedOutput = strings.Join(strings.Split(strings.TrimSpace(string(output)), "\n")[3:], "\n") + expectedOutput = strings.TrimSpace(string(output)) } - inputJSON := strings.Join(strings.Split(strings.TrimSpace(string(input)), "\n")[3:], "\n") + inputJSON := strings.TrimSpace(string(input)) canonicalJSON, err := Canonicalize(inputJSON) if err != nil { if diff := cmp.Diff(tc.err, err, test.EquateErrors()); diff != "" { diff --git a/pkg/resource/json/testdata/array.json b/pkg/resource/json/testdata/array.json index f8f4c94a..bb298bad 100644 --- a/pkg/resource/json/testdata/array.json +++ b/pkg/resource/json/testdata/array.json @@ -1,6 +1,3 @@ -// SPDX-FileCopyrightText: 2024 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 [ { "Principal": [ diff --git a/pkg/resource/json/testdata/array.json.license b/pkg/resource/json/testdata/array.json.license new file mode 100644 index 00000000..b0dc8fc5 --- /dev/null +++ b/pkg/resource/json/testdata/array.json.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2024 The Crossplane Authors + +SPDX-License-Identifier: Apache-2.0 diff --git a/pkg/resource/json/testdata/array_canonical.json b/pkg/resource/json/testdata/array_canonical.json index 062903e9..123c05ec 100644 --- a/pkg/resource/json/testdata/array_canonical.json +++ b/pkg/resource/json/testdata/array_canonical.json @@ -1,4 +1 @@ -// SPDX-FileCopyrightText: 2024 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 [{"Principal":["arn:aws:iam::153891904029:user/official-provider-testing"],"Rules":[{"Permission":["aoss:*"],"Resource":["index/example-collection/*"],"ResourceType":"index"},{"Permission":["aoss:*"],"Resource":["collection/example-collection"],"ResourceType":"collection"}]}] diff --git a/pkg/resource/json/testdata/array_canonical.json.license b/pkg/resource/json/testdata/array_canonical.json.license new file mode 100644 index 00000000..b0dc8fc5 --- /dev/null +++ b/pkg/resource/json/testdata/array_canonical.json.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2024 The Crossplane Authors + +SPDX-License-Identifier: Apache-2.0 diff --git a/pkg/resource/json/testdata/invalid.json b/pkg/resource/json/testdata/invalid.json index 96caf6de..fe6f8adf 100644 --- a/pkg/resource/json/testdata/invalid.json +++ b/pkg/resource/json/testdata/invalid.json @@ -1,4 +1 @@ -// SPDX-FileCopyrightText: 2024 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 {"a": "b",} diff --git a/pkg/resource/json/testdata/invalid.json.license b/pkg/resource/json/testdata/invalid.json.license new file mode 100644 index 00000000..b0dc8fc5 --- /dev/null +++ b/pkg/resource/json/testdata/invalid.json.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2024 The Crossplane Authors + +SPDX-License-Identifier: Apache-2.0 diff --git a/pkg/resource/json/testdata/policy.json b/pkg/resource/json/testdata/policy.json index 980ca3e5..db9c1fb4 100644 --- a/pkg/resource/json/testdata/policy.json +++ b/pkg/resource/json/testdata/policy.json @@ -1,6 +1,3 @@ -// SPDX-FileCopyrightText: 2024 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 { "Rules": [ { diff --git a/pkg/resource/json/testdata/policy.json.license b/pkg/resource/json/testdata/policy.json.license new file mode 100644 index 00000000..b0dc8fc5 --- /dev/null +++ b/pkg/resource/json/testdata/policy.json.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2024 The Crossplane Authors + +SPDX-License-Identifier: Apache-2.0 diff --git a/pkg/resource/json/testdata/policy_canonical.json b/pkg/resource/json/testdata/policy_canonical.json index b45b9194..74435ab0 100644 --- a/pkg/resource/json/testdata/policy_canonical.json +++ b/pkg/resource/json/testdata/policy_canonical.json @@ -1,4 +1 @@ -// SPDX-FileCopyrightText: 2024 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 {"AWSOwnedKey":true,"Rules":[{"Resource":["collection/example-collection-2"],"ResourceType":"collection"}]} diff --git a/pkg/resource/json/testdata/policy_canonical.json.license b/pkg/resource/json/testdata/policy_canonical.json.license new file mode 100644 index 00000000..b0dc8fc5 --- /dev/null +++ b/pkg/resource/json/testdata/policy_canonical.json.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2024 The Crossplane Authors + +SPDX-License-Identifier: Apache-2.0