Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for issue 3424 #3425

Merged
merged 1 commit into from
Jan 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions api/krusty/issue3424_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// Copyright 2020 The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0

package krusty_test

import (
"testing"

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

// Demonstrate unwanted quotes added to an integer by a strategic merge patch.
func TestIssue3424Basics(t *testing.T) {
th := kusttest_test.MakeHarness(t)
th.WriteF("pdb-patch.yaml", `
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: generic-pdb
spec:
maxUnavailable: 1
`)
th.WriteF("my_file.yaml", `
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: championships-api
labels:
faceit-pdb: default
spec:
maxUnavailable: 100%
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: championships-api-2
labels:
faceit-pdb: default
spec:
maxUnavailable: 100%
`)
th.WriteK(".", `
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
patches:
- path: pdb-patch.yaml
target:
kind: PodDisruptionBudget
labelSelector: faceit-pdb=default

resources:
- my_file.yaml
`)
m := th.Run(".", th.MakeDefaultOptions())
th.AssertActualEqualsExpected(m, `
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
faceit-pdb: default
name: championships-api
spec:
maxUnavailable: "1"
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
faceit-pdb: default
name: championships-api-2
spec:
maxUnavailable: "1"
`)
}