...

Source file src/sigs.k8s.io/kustomize/api/krusty/keepemptyarray_test.go

Documentation: sigs.k8s.io/kustomize/api/krusty

     1  // Copyright 2022 The Kubernetes Authors.
     2  // SPDX-License-Identifier: Apache-2.0
     3  
     4  package krusty_test
     5  
     6  import (
     7  	"testing"
     8  
     9  	kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
    10  )
    11  
    12  func TestKeepEmptyArray(t *testing.T) {
    13  	th := kusttest_test.MakeHarness(t)
    14  	th.WriteF("resources.yaml", `
    15  apiVersion: apps/v1
    16  kind: Deployment
    17  metadata:
    18    name: testing123
    19  spec:
    20    replicas: 1
    21    selector: null
    22    template:
    23      spec:
    24        containers:
    25        - name: event
    26          image: testing123
    27          imagePullPolicy: IfNotPresent
    28        imagePullSecrets: []`)
    29  
    30  	th.WriteK(".", `
    31  resources:
    32  - resources.yaml`)
    33  
    34  	m := th.Run(".", th.MakeDefaultOptions())
    35  	th.AssertActualEqualsExpected(m, `
    36  apiVersion: apps/v1
    37  kind: Deployment
    38  metadata:
    39    name: testing123
    40  spec:
    41    replicas: 1
    42    selector: null
    43    template:
    44      spec:
    45        containers:
    46        - image: testing123
    47          imagePullPolicy: IfNotPresent
    48          name: event
    49        imagePullSecrets: []
    50  `)
    51  }
    52  

View as plain text