diff --git a/tests/aws-alb-ingress-controller-overlays-application_test.go b/tests/aws-alb-ingress-controller-overlays-application_test.go index c6e9fceeffd..3f4cad595b3 100644 --- a/tests/aws-alb-ingress-controller-overlays-application_test.go +++ b/tests/aws-alb-ingress-controller-overlays-application_test.go @@ -1,20 +1,20 @@ package tests_test import ( - "sigs.k8s.io/kustomize/v3/k8sdeps/kunstruct" - "sigs.k8s.io/kustomize/v3/k8sdeps/transformer" - "sigs.k8s.io/kustomize/v3/pkg/fs" - "sigs.k8s.io/kustomize/v3/pkg/loader" - "sigs.k8s.io/kustomize/v3/pkg/plugins" - "sigs.k8s.io/kustomize/v3/pkg/resmap" - "sigs.k8s.io/kustomize/v3/pkg/resource" - "sigs.k8s.io/kustomize/v3/pkg/target" - "sigs.k8s.io/kustomize/v3/pkg/validators" - "testing" + "sigs.k8s.io/kustomize/v3/k8sdeps/kunstruct" + "sigs.k8s.io/kustomize/v3/k8sdeps/transformer" + "sigs.k8s.io/kustomize/v3/pkg/fs" + "sigs.k8s.io/kustomize/v3/pkg/loader" + "sigs.k8s.io/kustomize/v3/pkg/plugins" + "sigs.k8s.io/kustomize/v3/pkg/resmap" + "sigs.k8s.io/kustomize/v3/pkg/resource" + "sigs.k8s.io/kustomize/v3/pkg/target" + "sigs.k8s.io/kustomize/v3/pkg/validators" + "testing" ) func writeAwsAlbIngressControllerOverlaysApplication(th *KustTestHarness) { - th.writeF("/manifests/aws/aws-alb-ingress-controller/overlays/application/application.yaml", ` + th.writeF("/manifests/aws/aws-alb-ingress-controller/overlays/application/application.yaml", ` apiVersion: app.k8s.io/v1beta1 kind: Application metadata: @@ -50,7 +50,7 @@ spec: addOwnerRef: true `) - th.writeK("/manifests/aws/aws-alb-ingress-controller/overlays/application", ` + th.writeK("/manifests/aws/aws-alb-ingress-controller/overlays/application", ` apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization bases: @@ -66,7 +66,7 @@ commonLabels: app.kubernetes.io/version: v0.6.2 `) - th.writeF("/manifests/aws/aws-alb-ingress-controller/base/cluster-role.yaml", ` + th.writeF("/manifests/aws/aws-alb-ingress-controller/base/cluster-role.yaml", ` apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: @@ -104,7 +104,7 @@ rules: - list - watch `) - th.writeF("/manifests/aws/aws-alb-ingress-controller/base/cluster-role-binding.yaml", ` + th.writeF("/manifests/aws/aws-alb-ingress-controller/base/cluster-role-binding.yaml", ` apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: @@ -117,7 +117,7 @@ subjects: - kind: ServiceAccount name: alb-ingress-controller `) - th.writeF("/manifests/aws/aws-alb-ingress-controller/base/deployment.yaml", ` + th.writeF("/manifests/aws/aws-alb-ingress-controller/base/deployment.yaml", ` # Application Load Balancer (ALB) Ingress Controller Deployment Manifest. # This manifest details sensible defaults for deploying an ALB Ingress Controller. # GitHub: https://github.com/kubernetes-sigs/aws-alb-ingress-controller @@ -170,16 +170,16 @@ spec: imagePullPolicy: Always serviceAccountName: alb-ingress-controller `) - th.writeF("/manifests/aws/aws-alb-ingress-controller/base/service-account.yaml", ` + th.writeF("/manifests/aws/aws-alb-ingress-controller/base/service-account.yaml", ` apiVersion: v1 kind: ServiceAccount metadata: name: alb-ingress-controller `) - th.writeF("/manifests/aws/aws-alb-ingress-controller/base/params.env", ` + th.writeF("/manifests/aws/aws-alb-ingress-controller/base/params.env", ` clusterName= `) - th.writeK("/manifests/aws/aws-alb-ingress-controller/base", ` + th.writeK("/manifests/aws/aws-alb-ingress-controller/base", ` apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization namespace: kubeflow @@ -211,32 +211,32 @@ vars: } func TestAwsAlbIngressControllerOverlaysApplication(t *testing.T) { - th := NewKustTestHarness(t, "/manifests/aws/aws-alb-ingress-controller/overlays/application") - writeAwsAlbIngressControllerOverlaysApplication(th) - m, err := th.makeKustTarget().MakeCustomizedResMap() - if err != nil { - t.Fatalf("Err: %v", err) - } - expected, err := m.AsYaml() - if err != nil { - t.Fatalf("Err: %v", err) - } - targetPath := "../aws/aws-alb-ingress-controller/overlays/application" - fsys := fs.MakeRealFS() - lrc := loader.RestrictionRootOnly - _loader, loaderErr := loader.NewLoader(lrc, validators.MakeFakeValidator(), targetPath, fsys) - if loaderErr != nil { - t.Fatalf("could not load kustomize loader: %v", loaderErr) - } - rf := resmap.NewFactory(resource.NewFactory(kunstruct.NewKunstructuredFactoryImpl()), transformer.NewFactoryImpl()) - pc := plugins.DefaultPluginConfig() - kt, err := target.NewKustTarget(_loader, rf, transformer.NewFactoryImpl(), plugins.NewLoader(pc, rf)) - if err != nil { - th.t.Fatalf("Unexpected construction error %v", err) - } - actual, err := kt.MakeCustomizedResMap() - if err != nil { - t.Fatalf("Err: %v", err) - } - th.assertActualEqualsExpected(actual, string(expected)) + th := NewKustTestHarness(t, "/manifests/aws/aws-alb-ingress-controller/overlays/application") + writeAwsAlbIngressControllerOverlaysApplication(th) + m, err := th.makeKustTarget().MakeCustomizedResMap() + if err != nil { + t.Fatalf("Err: %v", err) + } + expected, err := m.AsYaml() + if err != nil { + t.Fatalf("Err: %v", err) + } + targetPath := "../aws/aws-alb-ingress-controller/overlays/application" + fsys := fs.MakeRealFS() + lrc := loader.RestrictionRootOnly + _loader, loaderErr := loader.NewLoader(lrc, validators.MakeFakeValidator(), targetPath, fsys) + if loaderErr != nil { + t.Fatalf("could not load kustomize loader: %v", loaderErr) + } + rf := resmap.NewFactory(resource.NewFactory(kunstruct.NewKunstructuredFactoryImpl()), transformer.NewFactoryImpl()) + pc := plugins.DefaultPluginConfig() + kt, err := target.NewKustTarget(_loader, rf, transformer.NewFactoryImpl(), plugins.NewLoader(pc, rf)) + if err != nil { + th.t.Fatalf("Unexpected construction error %v", err) + } + actual, err := kt.MakeCustomizedResMap() + if err != nil { + t.Fatalf("Err: %v", err) + } + th.assertActualEqualsExpected(actual, string(expected)) } diff --git a/tests/aws-alb-ingress-controller-overlays-vpc_test.go b/tests/aws-alb-ingress-controller-overlays-vpc_test.go index e09150ad877..84e75e14203 100644 --- a/tests/aws-alb-ingress-controller-overlays-vpc_test.go +++ b/tests/aws-alb-ingress-controller-overlays-vpc_test.go @@ -1,20 +1,20 @@ package tests_test import ( - "sigs.k8s.io/kustomize/v3/k8sdeps/kunstruct" - "sigs.k8s.io/kustomize/v3/k8sdeps/transformer" - "sigs.k8s.io/kustomize/v3/pkg/fs" - "sigs.k8s.io/kustomize/v3/pkg/loader" - "sigs.k8s.io/kustomize/v3/pkg/plugins" - "sigs.k8s.io/kustomize/v3/pkg/resmap" - "sigs.k8s.io/kustomize/v3/pkg/resource" - "sigs.k8s.io/kustomize/v3/pkg/target" - "sigs.k8s.io/kustomize/v3/pkg/validators" - "testing" + "sigs.k8s.io/kustomize/v3/k8sdeps/kunstruct" + "sigs.k8s.io/kustomize/v3/k8sdeps/transformer" + "sigs.k8s.io/kustomize/v3/pkg/fs" + "sigs.k8s.io/kustomize/v3/pkg/loader" + "sigs.k8s.io/kustomize/v3/pkg/plugins" + "sigs.k8s.io/kustomize/v3/pkg/resmap" + "sigs.k8s.io/kustomize/v3/pkg/resource" + "sigs.k8s.io/kustomize/v3/pkg/target" + "sigs.k8s.io/kustomize/v3/pkg/validators" + "testing" ) func writeAwsAlbIngressControllerOverlaysVpc(th *KustTestHarness) { - th.writeF("/manifests/aws/aws-alb-ingress-controller/overlays/vpc/vpc.yaml", ` + th.writeF("/manifests/aws/aws-alb-ingress-controller/overlays/vpc/vpc.yaml", ` apiVersion: apps/v1 kind: Deployment metadata: @@ -42,11 +42,11 @@ spec: # List of regions: http://docs.aws.amazon.com/general/latest/gr/rande.html#vpc_region - --aws-region=$(REGION) `) - th.writeF("/manifests/aws/aws-alb-ingress-controller/overlays/vpc/params.env", ` + th.writeF("/manifests/aws/aws-alb-ingress-controller/overlays/vpc/params.env", ` vpcId= region=us-west-2 `) - th.writeK("/manifests/aws/aws-alb-ingress-controller/overlays/vpc", ` + th.writeK("/manifests/aws/aws-alb-ingress-controller/overlays/vpc", ` apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization bases: @@ -72,7 +72,7 @@ vars: fieldref: fieldpath: data.region `) - th.writeF("/manifests/aws/aws-alb-ingress-controller/base/cluster-role.yaml", ` + th.writeF("/manifests/aws/aws-alb-ingress-controller/base/cluster-role.yaml", ` apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: @@ -110,7 +110,7 @@ rules: - list - watch `) - th.writeF("/manifests/aws/aws-alb-ingress-controller/base/cluster-role-binding.yaml", ` + th.writeF("/manifests/aws/aws-alb-ingress-controller/base/cluster-role-binding.yaml", ` apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: @@ -123,7 +123,7 @@ subjects: - kind: ServiceAccount name: alb-ingress-controller `) - th.writeF("/manifests/aws/aws-alb-ingress-controller/base/deployment.yaml", ` + th.writeF("/manifests/aws/aws-alb-ingress-controller/base/deployment.yaml", ` # Application Load Balancer (ALB) Ingress Controller Deployment Manifest. # This manifest details sensible defaults for deploying an ALB Ingress Controller. # GitHub: https://github.com/kubernetes-sigs/aws-alb-ingress-controller @@ -176,16 +176,16 @@ spec: imagePullPolicy: Always serviceAccountName: alb-ingress-controller `) - th.writeF("/manifests/aws/aws-alb-ingress-controller/base/service-account.yaml", ` + th.writeF("/manifests/aws/aws-alb-ingress-controller/base/service-account.yaml", ` apiVersion: v1 kind: ServiceAccount metadata: name: alb-ingress-controller `) - th.writeF("/manifests/aws/aws-alb-ingress-controller/base/params.env", ` + th.writeF("/manifests/aws/aws-alb-ingress-controller/base/params.env", ` clusterName= `) - th.writeK("/manifests/aws/aws-alb-ingress-controller/base", ` + th.writeK("/manifests/aws/aws-alb-ingress-controller/base", ` apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization namespace: kubeflow @@ -217,32 +217,32 @@ vars: } func TestAwsAlbIngressControllerOverlaysVpc(t *testing.T) { - th := NewKustTestHarness(t, "/manifests/aws/aws-alb-ingress-controller/overlays/vpc") - writeAwsAlbIngressControllerOverlaysVpc(th) - m, err := th.makeKustTarget().MakeCustomizedResMap() - if err != nil { - t.Fatalf("Err: %v", err) - } - expected, err := m.AsYaml() - if err != nil { - t.Fatalf("Err: %v", err) - } - targetPath := "../aws/aws-alb-ingress-controller/overlays/vpc" - fsys := fs.MakeRealFS() - lrc := loader.RestrictionRootOnly - _loader, loaderErr := loader.NewLoader(lrc, validators.MakeFakeValidator(), targetPath, fsys) - if loaderErr != nil { - t.Fatalf("could not load kustomize loader: %v", loaderErr) - } - rf := resmap.NewFactory(resource.NewFactory(kunstruct.NewKunstructuredFactoryImpl()), transformer.NewFactoryImpl()) - pc := plugins.DefaultPluginConfig() - kt, err := target.NewKustTarget(_loader, rf, transformer.NewFactoryImpl(), plugins.NewLoader(pc, rf)) - if err != nil { - th.t.Fatalf("Unexpected construction error %v", err) - } - actual, err := kt.MakeCustomizedResMap() - if err != nil { - t.Fatalf("Err: %v", err) - } - th.assertActualEqualsExpected(actual, string(expected)) + th := NewKustTestHarness(t, "/manifests/aws/aws-alb-ingress-controller/overlays/vpc") + writeAwsAlbIngressControllerOverlaysVpc(th) + m, err := th.makeKustTarget().MakeCustomizedResMap() + if err != nil { + t.Fatalf("Err: %v", err) + } + expected, err := m.AsYaml() + if err != nil { + t.Fatalf("Err: %v", err) + } + targetPath := "../aws/aws-alb-ingress-controller/overlays/vpc" + fsys := fs.MakeRealFS() + lrc := loader.RestrictionRootOnly + _loader, loaderErr := loader.NewLoader(lrc, validators.MakeFakeValidator(), targetPath, fsys) + if loaderErr != nil { + t.Fatalf("could not load kustomize loader: %v", loaderErr) + } + rf := resmap.NewFactory(resource.NewFactory(kunstruct.NewKunstructuredFactoryImpl()), transformer.NewFactoryImpl()) + pc := plugins.DefaultPluginConfig() + kt, err := target.NewKustTarget(_loader, rf, transformer.NewFactoryImpl(), plugins.NewLoader(pc, rf)) + if err != nil { + th.t.Fatalf("Unexpected construction error %v", err) + } + actual, err := kt.MakeCustomizedResMap() + if err != nil { + t.Fatalf("Err: %v", err) + } + th.assertActualEqualsExpected(actual, string(expected)) } diff --git a/tests/nvidia-device-plugin-overlays-application_test.go b/tests/nvidia-device-plugin-overlays-application_test.go index d480a114081..af32e26ee58 100644 --- a/tests/nvidia-device-plugin-overlays-application_test.go +++ b/tests/nvidia-device-plugin-overlays-application_test.go @@ -1,20 +1,20 @@ package tests_test import ( - "sigs.k8s.io/kustomize/v3/k8sdeps/kunstruct" - "sigs.k8s.io/kustomize/v3/k8sdeps/transformer" - "sigs.k8s.io/kustomize/v3/pkg/fs" - "sigs.k8s.io/kustomize/v3/pkg/loader" - "sigs.k8s.io/kustomize/v3/pkg/plugins" - "sigs.k8s.io/kustomize/v3/pkg/resmap" - "sigs.k8s.io/kustomize/v3/pkg/resource" - "sigs.k8s.io/kustomize/v3/pkg/target" - "sigs.k8s.io/kustomize/v3/pkg/validators" - "testing" + "sigs.k8s.io/kustomize/v3/k8sdeps/kunstruct" + "sigs.k8s.io/kustomize/v3/k8sdeps/transformer" + "sigs.k8s.io/kustomize/v3/pkg/fs" + "sigs.k8s.io/kustomize/v3/pkg/loader" + "sigs.k8s.io/kustomize/v3/pkg/plugins" + "sigs.k8s.io/kustomize/v3/pkg/resmap" + "sigs.k8s.io/kustomize/v3/pkg/resource" + "sigs.k8s.io/kustomize/v3/pkg/target" + "sigs.k8s.io/kustomize/v3/pkg/validators" + "testing" ) func writeNvidiaDevicePluginOverlaysApplication(th *KustTestHarness) { - th.writeF("/manifests/aws/nvidia-device-plugin/overlays/application/application.yaml", ` + th.writeF("/manifests/aws/nvidia-device-plugin/overlays/application/application.yaml", ` apiVersion: app.k8s.io/v1beta1 kind: Application metadata: @@ -49,7 +49,7 @@ spec: addOwnerRef: true `) - th.writeK("/manifests/aws/nvidia-device-plugin/overlays/application", ` + th.writeK("/manifests/aws/nvidia-device-plugin/overlays/application", ` apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization bases: @@ -64,7 +64,7 @@ commonLabels: app.kubernetes.io/part-of: kubeflow app.kubernetes.io/version: v1.0.0-beta `) - th.writeF("/manifests/aws/nvidia-device-plugin/base/daemonset.yaml", ` + th.writeF("/manifests/aws/nvidia-device-plugin/base/daemonset.yaml", ` apiVersion: apps/v1 kind: DaemonSet metadata: @@ -103,7 +103,7 @@ spec: hostPath: path: /var/lib/kubelet/device-plugins `) - th.writeK("/manifests/aws/nvidia-device-plugin/base", ` + th.writeK("/manifests/aws/nvidia-device-plugin/base", ` apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization namespace: kube-system @@ -119,32 +119,32 @@ images: } func TestNvidiaDevicePluginOverlaysApplication(t *testing.T) { - th := NewKustTestHarness(t, "/manifests/aws/nvidia-device-plugin/overlays/application") - writeNvidiaDevicePluginOverlaysApplication(th) - m, err := th.makeKustTarget().MakeCustomizedResMap() - if err != nil { - t.Fatalf("Err: %v", err) - } - expected, err := m.AsYaml() - if err != nil { - t.Fatalf("Err: %v", err) - } - targetPath := "../aws/nvidia-device-plugin/overlays/application" - fsys := fs.MakeRealFS() - lrc := loader.RestrictionRootOnly - _loader, loaderErr := loader.NewLoader(lrc, validators.MakeFakeValidator(), targetPath, fsys) - if loaderErr != nil { - t.Fatalf("could not load kustomize loader: %v", loaderErr) - } - rf := resmap.NewFactory(resource.NewFactory(kunstruct.NewKunstructuredFactoryImpl()), transformer.NewFactoryImpl()) - pc := plugins.DefaultPluginConfig() - kt, err := target.NewKustTarget(_loader, rf, transformer.NewFactoryImpl(), plugins.NewLoader(pc, rf)) - if err != nil { - th.t.Fatalf("Unexpected construction error %v", err) - } - actual, err := kt.MakeCustomizedResMap() - if err != nil { - t.Fatalf("Err: %v", err) - } - th.assertActualEqualsExpected(actual, string(expected)) + th := NewKustTestHarness(t, "/manifests/aws/nvidia-device-plugin/overlays/application") + writeNvidiaDevicePluginOverlaysApplication(th) + m, err := th.makeKustTarget().MakeCustomizedResMap() + if err != nil { + t.Fatalf("Err: %v", err) + } + expected, err := m.AsYaml() + if err != nil { + t.Fatalf("Err: %v", err) + } + targetPath := "../aws/nvidia-device-plugin/overlays/application" + fsys := fs.MakeRealFS() + lrc := loader.RestrictionRootOnly + _loader, loaderErr := loader.NewLoader(lrc, validators.MakeFakeValidator(), targetPath, fsys) + if loaderErr != nil { + t.Fatalf("could not load kustomize loader: %v", loaderErr) + } + rf := resmap.NewFactory(resource.NewFactory(kunstruct.NewKunstructuredFactoryImpl()), transformer.NewFactoryImpl()) + pc := plugins.DefaultPluginConfig() + kt, err := target.NewKustTarget(_loader, rf, transformer.NewFactoryImpl(), plugins.NewLoader(pc, rf)) + if err != nil { + th.t.Fatalf("Unexpected construction error %v", err) + } + actual, err := kt.MakeCustomizedResMap() + if err != nil { + t.Fatalf("Err: %v", err) + } + th.assertActualEqualsExpected(actual, string(expected)) }