mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
Provide another high level example.
This commit is contained in:
@@ -1,15 +1,13 @@
|
|||||||
// Copyright 2019 The Kubernetes Authors.
|
// Copyright 2019 The Kubernetes Authors.
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package target_test
|
package krusty_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func writeMediumBase(th *kusttest_test.KustTestHarness) {
|
func writeMediumBase(th testingHarness) {
|
||||||
th.WriteK("/app/base", `
|
th.WriteK("/app/base", `
|
||||||
namePrefix: baseprefix-
|
namePrefix: baseprefix-
|
||||||
commonLabels:
|
commonLabels:
|
||||||
@@ -59,12 +57,9 @@ spec:
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMediumBase(t *testing.T) {
|
func TestMediumBase(t *testing.T) {
|
||||||
th := kusttest_test.NewKustTestHarness(t, "/app/base")
|
th := makeTestHarness(t)
|
||||||
writeMediumBase(th)
|
writeMediumBase(th)
|
||||||
m, err := th.MakeKustTarget().MakeCustomizedResMap()
|
m := th.Run("/app/base", th.MakeDefaultOptions())
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("Err: %v", err)
|
|
||||||
}
|
|
||||||
th.AssertActualEqualsExpected(m, `
|
th.AssertActualEqualsExpected(m, `
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
@@ -116,7 +111,7 @@ spec:
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMediumOverlay(t *testing.T) {
|
func TestMediumOverlay(t *testing.T) {
|
||||||
th := kusttest_test.NewKustTestHarness(t, "/app/overlay")
|
th := makeTestHarness(t)
|
||||||
writeMediumBase(th)
|
writeMediumBase(th)
|
||||||
th.WriteK("/app/overlay", `
|
th.WriteK("/app/overlay", `
|
||||||
namePrefix: test-infra-
|
namePrefix: test-infra-
|
||||||
@@ -193,10 +188,7 @@ spec:
|
|||||||
name: app-env
|
name: app-env
|
||||||
name: app-env
|
name: app-env
|
||||||
`)
|
`)
|
||||||
m, err := th.MakeKustTarget().MakeCustomizedResMap()
|
m := th.Run("/app/overlay", th.MakeDefaultOptions())
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("Err: %v", err)
|
|
||||||
}
|
|
||||||
th.AssertActualEqualsExpected(m, `
|
th.AssertActualEqualsExpected(m, `
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
Reference in New Issue
Block a user