1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
// Copyright 2021 The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0
package main_test
import (
"testing"
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
)
func TestCalvinDuplicatorPlugin(t *testing.T) {
th := kusttest_test.MakeEnhancedHarness(t).
BuildGoPlugin("someteam.example.com", "v1", "CalvinDuplicator")
defer th.Reset()
m := th.LoadAndRunTransformer(`
apiVersion: someteam.example.com/v1
kind: CalvinDuplicator
metadata:
name: whatever
count: 3
name: calvin
`,
`apiVersion: apps/v1
kind: Deployment
metadata:
name: hobbes
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: calvin
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: susie
`)
th.AssertActualEqualsExpectedNoIdAnnotations(m, `
apiVersion: apps/v1
kind: Deployment
metadata:
name: hobbes
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: calvin-1
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: calvin-2
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: calvin-3
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: susie
`)
}
|