Skip to content

Commit

Permalink
test simple generateName metadata behavior
Browse files Browse the repository at this point in the history
fix issue number
  • Loading branch information
julian7 committed Oct 28, 2022
1 parent af19b2a commit 5f84e6a
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions api/krusty/generatename_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Copyright 2019 The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0

package krusty_test

import (
"testing"

kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
)

// Coverage for issue #641
func TestGenerateName(t *testing.T) {
th := kusttest_test.MakeHarness(t)

th.WriteK(".", `
resources:
- job.yaml
namePrefix: pre-
nameSuffix: -post
`)
th.WriteF("job.yaml", `
apiVersion: batch/v1
kind: Job
metadata:
generateName: job-
spec:
template:
spec:
containers:
- name: job
image: run/job:1.0
command:
- echo
- done
`)

m := th.Run(".", th.MakeDefaultOptions())
th.AssertActualEqualsExpected(m, `
apiVersion: batch/v1
kind: Job
metadata:
generateName: job-
spec:
template:
spec:
containers:
- command:
- echo
- done
image: run/job:1.0
name: job
`)
}

0 comments on commit 5f84e6a

Please sign in to comment.