From 1d70cbfecc722d48e16fc2890f8910962b2e5fa3 Mon Sep 17 00:00:00 2001 From: Andrew Wilkins Date: Wed, 27 Nov 2019 14:46:59 +0800 Subject: [PATCH] fix-approvals --- .../test_approved_system/transform_empty.approved.json | 1 + .../test_approved_system/transform_empty_ip.approved.json | 1 + .../transform_k8s_namespace.approved.json | 1 + .../test_approved_system/transform_k8s_podUID.approved.json | 1 + .../test_approved_system/transform_k8s_podname.approved.json | 1 + tests/approvals/approvals.go | 4 +--- 6 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 model/metadata/test_approved_system/transform_empty.approved.json create mode 100644 model/metadata/test_approved_system/transform_empty_ip.approved.json create mode 100644 model/metadata/test_approved_system/transform_k8s_namespace.approved.json create mode 100644 model/metadata/test_approved_system/transform_k8s_podUID.approved.json create mode 100644 model/metadata/test_approved_system/transform_k8s_podname.approved.json diff --git a/model/metadata/test_approved_system/transform_empty.approved.json b/model/metadata/test_approved_system/transform_empty.approved.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/model/metadata/test_approved_system/transform_empty.approved.json @@ -0,0 +1 @@ +{} diff --git a/model/metadata/test_approved_system/transform_empty_ip.approved.json b/model/metadata/test_approved_system/transform_empty_ip.approved.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/model/metadata/test_approved_system/transform_empty_ip.approved.json @@ -0,0 +1 @@ +{} diff --git a/model/metadata/test_approved_system/transform_k8s_namespace.approved.json b/model/metadata/test_approved_system/transform_k8s_namespace.approved.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/model/metadata/test_approved_system/transform_k8s_namespace.approved.json @@ -0,0 +1 @@ +{} diff --git a/model/metadata/test_approved_system/transform_k8s_podUID.approved.json b/model/metadata/test_approved_system/transform_k8s_podUID.approved.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/model/metadata/test_approved_system/transform_k8s_podUID.approved.json @@ -0,0 +1 @@ +{} diff --git a/model/metadata/test_approved_system/transform_k8s_podname.approved.json b/model/metadata/test_approved_system/transform_k8s_podname.approved.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/model/metadata/test_approved_system/transform_k8s_podname.approved.json @@ -0,0 +1 @@ +{} diff --git a/tests/approvals/approvals.go b/tests/approvals/approvals.go index d2bb8928d1a..cb83f0ba19b 100644 --- a/tests/approvals/approvals.go +++ b/tests/approvals/approvals.go @@ -108,9 +108,7 @@ func Compare(path string, ignoredFields ...string) (map[string]interface{}, map[ var approved map[string]interface{} approvedf, err := os.Open(path + ApprovedSuffix) - if err != nil { - approved = map[string]interface{}{} - } else { + if err == nil { defer approvedf.Close() if err := json.NewDecoder(approvedf).Decode(&approved); err != nil { fmt.Println("Cannot unmarshal approved file ", path, err)