mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-09-15 12:18:57 +00:00
style: linting
This commit is contained in:
@@ -4,20 +4,20 @@
|
|||||||
package krusty_test
|
package krusty_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
|
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
|
||||||
)
|
)
|
||||||
|
|
||||||
// test for https://github.com/kubernetes-sigs/kustomize/issues/4240
|
// test for https://github.com/kubernetes-sigs/kustomize/issues/4240
|
||||||
func TestSuffix5042(t *testing.T) {
|
func TestSuffix5042(t *testing.T) {
|
||||||
th := kusttest_test.MakeHarness(t)
|
th := kusttest_test.MakeHarness(t)
|
||||||
th.WriteK(".", `
|
th.WriteK(".", `
|
||||||
resources:
|
resources:
|
||||||
- resource.yaml
|
- resource.yaml
|
||||||
`)
|
`)
|
||||||
|
|
||||||
th.WriteF("resource.yaml", `
|
th.WriteF("resource.yaml", `
|
||||||
apiVersion: example.com/v1alpha1
|
apiVersion: example.com/v1alpha1
|
||||||
kind: MyResource
|
kind: MyResource
|
||||||
metadata:
|
metadata:
|
||||||
@@ -29,9 +29,9 @@ metadata:
|
|||||||
name: test
|
name: test
|
||||||
rules: []
|
rules: []
|
||||||
`)
|
`)
|
||||||
m := th.Run(".", th.MakeDefaultOptions())
|
m := th.Run(".", th.MakeDefaultOptions())
|
||||||
|
|
||||||
th.AssertActualEqualsExpected(m, `
|
th.AssertActualEqualsExpected(m, `
|
||||||
apiVersion: example.com/v1alpha1
|
apiVersion: example.com/v1alpha1
|
||||||
kind: MyResource
|
kind: MyResource
|
||||||
metadata:
|
metadata:
|
||||||
@@ -46,13 +46,13 @@ rules: []
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestListSuffix5042(t *testing.T) {
|
func TestListSuffix5042(t *testing.T) {
|
||||||
th := kusttest_test.MakeHarness(t)
|
th := kusttest_test.MakeHarness(t)
|
||||||
th.WriteK(".", `
|
th.WriteK(".", `
|
||||||
resources:
|
resources:
|
||||||
- resource.yaml
|
- resource.yaml
|
||||||
`)
|
`)
|
||||||
|
|
||||||
th.WriteF("resource.yaml", `
|
th.WriteF("resource.yaml", `
|
||||||
apiVersion: example.com/v1alpha1
|
apiVersion: example.com/v1alpha1
|
||||||
kind: MyResource
|
kind: MyResource
|
||||||
metadata:
|
metadata:
|
||||||
@@ -64,9 +64,9 @@ metadata:
|
|||||||
name: test
|
name: test
|
||||||
rules: []
|
rules: []
|
||||||
`)
|
`)
|
||||||
m := th.Run(".", th.MakeDefaultOptions())
|
m := th.Run(".", th.MakeDefaultOptions())
|
||||||
|
|
||||||
th.AssertActualEqualsExpected(m, `
|
th.AssertActualEqualsExpected(m, `
|
||||||
apiVersion: example.com/v1alpha1
|
apiVersion: example.com/v1alpha1
|
||||||
kind: MyResource
|
kind: MyResource
|
||||||
metadata:
|
metadata:
|
||||||
@@ -81,13 +81,13 @@ rules: []
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestListSuffix5485(t *testing.T) {
|
func TestListSuffix5485(t *testing.T) {
|
||||||
th := kusttest_test.MakeHarness(t)
|
th := kusttest_test.MakeHarness(t)
|
||||||
th.WriteK(".", `
|
th.WriteK(".", `
|
||||||
resources:
|
resources:
|
||||||
- resource.yaml
|
- resource.yaml
|
||||||
`)
|
`)
|
||||||
|
|
||||||
th.WriteF("resource.yaml", `
|
th.WriteF("resource.yaml", `
|
||||||
apiVersion: infra.protonbase.io/v1alpha1
|
apiVersion: infra.protonbase.io/v1alpha1
|
||||||
kind: AccessWhiteList
|
kind: AccessWhiteList
|
||||||
metadata:
|
metadata:
|
||||||
@@ -98,9 +98,9 @@ spec:
|
|||||||
- sourceIps: 0.0.0.0/16
|
- sourceIps: 0.0.0.0/16
|
||||||
`)
|
`)
|
||||||
|
|
||||||
m := th.Run(".", th.MakeDefaultOptions())
|
m := th.Run(".", th.MakeDefaultOptions())
|
||||||
|
|
||||||
th.AssertActualEqualsExpected(m, `
|
th.AssertActualEqualsExpected(m, `
|
||||||
apiVersion: infra.protonbase.io/v1alpha1
|
apiVersion: infra.protonbase.io/v1alpha1
|
||||||
kind: AccessWhiteList
|
kind: AccessWhiteList
|
||||||
metadata:
|
metadata:
|
||||||
@@ -110,17 +110,16 @@ spec:
|
|||||||
rules:
|
rules:
|
||||||
- sourceIps: 0.0.0.0/16
|
- sourceIps: 0.0.0.0/16
|
||||||
`)
|
`)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestListToIndividualResources(t *testing.T) {
|
func TestListToIndividualResources(t *testing.T) {
|
||||||
th := kusttest_test.MakeHarness(t)
|
th := kusttest_test.MakeHarness(t)
|
||||||
th.WriteK(".", `
|
th.WriteK(".", `
|
||||||
resources:
|
resources:
|
||||||
- list.yaml
|
- list.yaml
|
||||||
`)
|
`)
|
||||||
|
|
||||||
th.WriteF("list.yaml", `
|
th.WriteF("list.yaml", `
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: PodList
|
kind: PodList
|
||||||
items:
|
items:
|
||||||
@@ -165,10 +164,9 @@ items:
|
|||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
`)
|
`)
|
||||||
|
|
||||||
m := th.Run(".", th.MakeDefaultOptions())
|
m := th.Run(".", th.MakeDefaultOptions())
|
||||||
|
|
||||||
|
th.AssertActualEqualsExpected(m, `
|
||||||
th.AssertActualEqualsExpected(m, `
|
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Pod
|
kind: Pod
|
||||||
metadata:
|
metadata:
|
||||||
@@ -215,16 +213,16 @@ spec:
|
|||||||
|
|
||||||
// Empty list should result in no resources
|
// Empty list should result in no resources
|
||||||
func TestEmptyList(t *testing.T) {
|
func TestEmptyList(t *testing.T) {
|
||||||
th := kusttest_test.MakeHarness(t)
|
th := kusttest_test.MakeHarness(t)
|
||||||
th.WriteK(".", `
|
th.WriteK(".", `
|
||||||
resources:
|
resources:
|
||||||
- emptyList.yaml
|
- emptyList.yaml
|
||||||
`)
|
`)
|
||||||
th.WriteF("emptyList.yaml", `
|
th.WriteF("emptyList.yaml", `
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: PodList
|
kind: PodList
|
||||||
items: []
|
items: []
|
||||||
`)
|
`)
|
||||||
m := th.Run(".", th.MakeDefaultOptions())
|
m := th.Run(".", th.MakeDefaultOptions())
|
||||||
th.AssertActualEqualsExpected(m, "")
|
th.AssertActualEqualsExpected(m, "")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user