From 3eae520532e09b2dd60f0222722139200f9ee39f Mon Sep 17 00:00:00 2001 From: Mohd Bilal Date: Sun, 27 Feb 2022 08:11:42 +0000 Subject: [PATCH] test case added --- api/krusty/basic_io_test.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/api/krusty/basic_io_test.go b/api/krusty/basic_io_test.go index 6a2b9c302..5e6eef8fd 100644 --- a/api/krusty/basic_io_test.go +++ b/api/krusty/basic_io_test.go @@ -6,6 +6,7 @@ package krusty_test import ( "testing" + "sigs.k8s.io/kustomize/api/internal/kusterr" kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest" ) @@ -80,3 +81,35 @@ spec: clusterIP: None `) } + +//test for https://github.com/kubernetes-sigs/kustomize/issues/3812#issuecomment-862339267 +func TestBasicIO3812(t *testing.T) { + th := kusttest_test.MakeHarness(t) + th.WriteK(".", ` +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - service.yaml +`) + + th.WriteF("service.yaml", ` +apiVersion: v1 +kind: Service +metadata: + name: kapacitor + labels: + app.kubernetes.io/name: tick-kapacitor +spec: + selector: + app.kubernetes.io/name: tick-kapacitor + - name: http + port: 9092 + protocol: TCP + type: ClusterIP +`) + + err := th.RunWithErr(".", th.MakeDefaultOptions()) + if !kusterr.IsMalformedYAMLError(err) { + t.Fatalf("unexpected error: %q", err) + } +}