mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-13 01:50:55 +00:00
Move more examples up.
This commit is contained in:
@@ -1,17 +1,16 @@
|
||||
// Copyright 2019 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package target_test
|
||||
package krusty_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
. "sigs.k8s.io/kustomize/api/internal/target"
|
||||
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
|
||||
)
|
||||
|
||||
func TestTargetMustHaveKustomizationFile(t *testing.T) {
|
||||
th := kusttest_test.NewKustTestHarness(t, "/app")
|
||||
th := makeTestHarness(t)
|
||||
th.WriteF("/app/service.yaml", `
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
@@ -24,7 +23,7 @@ kind: Service
|
||||
metadata:
|
||||
name: anotherService
|
||||
`)
|
||||
_, err := th.MakeKustTargetOrErr()
|
||||
err := th.RunWithErr("/app", th.MakeDefaultOptions())
|
||||
if err == nil {
|
||||
t.Fatalf("expected an error")
|
||||
}
|
||||
@@ -33,8 +32,8 @@ metadata:
|
||||
}
|
||||
}
|
||||
|
||||
func TestResourceDirectoryMustHaveKustomizationFile(t *testing.T) {
|
||||
th := kusttest_test.NewKustTestHarness(t, "/app")
|
||||
func TestBaseMustHaveKustomizationFile(t *testing.T) {
|
||||
th := makeTestHarness(t)
|
||||
th.WriteK("/app", `
|
||||
resources:
|
||||
- base
|
||||
@@ -50,7 +49,7 @@ spec:
|
||||
ports:
|
||||
- port: 7002
|
||||
`)
|
||||
_, err := th.MakeKustTarget().MakeCustomizedResMap()
|
||||
err := th.RunWithErr("/app", th.MakeDefaultOptions())
|
||||
if err == nil {
|
||||
t.Fatalf("expected an error")
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
// Disabled on travis, because don't want to install helm on travis.
|
||||
|
||||
package target_test
|
||||
package krusty_test
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
@@ -34,7 +34,7 @@ func TestChartInflatorPlugin(t *testing.T) {
|
||||
tc.PrepExecPlugin(
|
||||
"someteam.example.com", "v1", "ChartInflator")
|
||||
|
||||
th := kusttest_test.NewKustTestHarnessAllowPlugins(t, "/app")
|
||||
th := makeTestHarness(t)
|
||||
th.WriteK("/app", `
|
||||
generators:
|
||||
- chartInflator.yaml
|
||||
@@ -49,10 +49,7 @@ metadata:
|
||||
chartName: minecraft
|
||||
`)
|
||||
|
||||
m, err := th.MakeKustTarget().MakeCustomizedResMap()
|
||||
if err != nil {
|
||||
t.Fatalf("Err: %v", err)
|
||||
}
|
||||
m := th.Run("/app", th.MakeOptionsPluginsEnabled())
|
||||
chartName := regexp.MustCompile("chart: minecraft-[0-9.]+")
|
||||
th.AssertActualEqualsExpectedWithTweak(m,
|
||||
func(x []byte) []byte {
|
||||
Reference in New Issue
Block a user