mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-30 01:46:23 +00:00
Simplify some of the plugin testing code.
This commit is contained in:
@@ -1,27 +1,13 @@
|
||||
/*
|
||||
Copyright 2019 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
// Copyright 2019 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package target_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/internal/plugintest"
|
||||
"sigs.k8s.io/kustomize/k8sdeps/kv/plugin"
|
||||
"sigs.k8s.io/kustomize/pkg/kusttest"
|
||||
"sigs.k8s.io/kustomize/plugin"
|
||||
)
|
||||
|
||||
func writeDeployment(th *kusttest_test.KustTestHarness, path string) {
|
||||
@@ -61,7 +47,7 @@ metadata:
|
||||
}
|
||||
|
||||
func TestOrderedTransformers(t *testing.T) {
|
||||
tc := plugintest_test.NewPluginTestEnv(t).Set()
|
||||
tc := plugin.NewPluginTestEnv(t).Set()
|
||||
defer tc.Reset()
|
||||
|
||||
tc.BuildGoPlugin(
|
||||
@@ -70,8 +56,7 @@ func TestOrderedTransformers(t *testing.T) {
|
||||
tc.BuildGoPlugin(
|
||||
"someteam.example.com", "v1", "DatePrefixer")
|
||||
|
||||
th := kusttest_test.NewKustTestHarnessWithPluginConfig(
|
||||
t, "/app", plugin.ActivePluginConfig())
|
||||
th := kusttest_test.NewKustTestPluginHarness(t, "/app")
|
||||
th.WriteK("/app", `
|
||||
resources:
|
||||
- deployment.yaml
|
||||
@@ -107,14 +92,13 @@ spec:
|
||||
}
|
||||
|
||||
func TestSedTransformer(t *testing.T) {
|
||||
tc := plugintest_test.NewPluginTestEnv(t).Set()
|
||||
tc := plugin.NewPluginTestEnv(t).Set()
|
||||
defer tc.Reset()
|
||||
|
||||
tc.BuildExecPlugin(
|
||||
"someteam.example.com", "v1", "SedTransformer")
|
||||
|
||||
th := kusttest_test.NewKustTestHarnessWithPluginConfig(
|
||||
t, "/app", plugin.ActivePluginConfig())
|
||||
th := kusttest_test.NewKustTestPluginHarness(t, "/app")
|
||||
th.WriteK("/app", `
|
||||
resources:
|
||||
- configmap.yaml
|
||||
@@ -177,7 +161,7 @@ metadata:
|
||||
}
|
||||
|
||||
func TestTransformedTransformers(t *testing.T) {
|
||||
tc := plugintest_test.NewPluginTestEnv(t).Set()
|
||||
tc := plugin.NewPluginTestEnv(t).Set()
|
||||
defer tc.Reset()
|
||||
|
||||
tc.BuildGoPlugin(
|
||||
@@ -186,8 +170,7 @@ func TestTransformedTransformers(t *testing.T) {
|
||||
tc.BuildGoPlugin(
|
||||
"someteam.example.com", "v1", "DatePrefixer")
|
||||
|
||||
th := kusttest_test.NewKustTestHarnessWithPluginConfig(
|
||||
t, "/app/overlay", plugin.ActivePluginConfig())
|
||||
th := kusttest_test.NewKustTestPluginHarness(t, "/app/overlay")
|
||||
|
||||
th.WriteK("/app/base", `
|
||||
resources:
|
||||
|
||||
Reference in New Issue
Block a user