mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-14 10:30:59 +00:00
Polishing helmV3 related changes
Enabled HelmV3 related test, Made sure HelmV2 and HelmV3 UT pass, Pinned Chart version as per TODO note Removed accomplished TODOs
This commit is contained in:
@@ -28,10 +28,6 @@
|
|||||||
# Example execution:
|
# Example execution:
|
||||||
# ./plugin/someteam.example.com/v1/ChartInflator configFile.yaml
|
# ./plugin/someteam.example.com/v1/ChartInflator configFile.yaml
|
||||||
|
|
||||||
# TODO: allow specification of a specific chart VERSION
|
|
||||||
# so this test doesn't break every time minecraft is upgraded :P
|
|
||||||
# See https://github.com/helm/helm/issues/4008
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Yaml parsing is a ridiculous thing to do in bash,
|
# Yaml parsing is a ridiculous thing to do in bash,
|
||||||
|
|||||||
@@ -8,13 +8,14 @@
|
|||||||
package main_test
|
package main_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"regexp"
|
"regexp"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
|
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
|
||||||
)
|
)
|
||||||
|
|
||||||
const expectedResources = `
|
const expectedResourcesTemplate = `
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
data:
|
data:
|
||||||
rcon-password: Q0hBTkdFTUUh
|
rcon-password: Q0hBTkdFTUUh
|
||||||
@@ -23,7 +24,7 @@ metadata:
|
|||||||
labels:
|
labels:
|
||||||
app: release-name-minecraft
|
app: release-name-minecraft
|
||||||
chart: minecraft-SOMEVERSION
|
chart: minecraft-SOMEVERSION
|
||||||
heritage: Tiller
|
heritage: %s
|
||||||
release: release-name
|
release: release-name
|
||||||
name: release-name-minecraft
|
name: release-name-minecraft
|
||||||
type: Opaque
|
type: Opaque
|
||||||
@@ -36,7 +37,7 @@ metadata:
|
|||||||
labels:
|
labels:
|
||||||
app: release-name-minecraft
|
app: release-name-minecraft
|
||||||
chart: minecraft-SOMEVERSION
|
chart: minecraft-SOMEVERSION
|
||||||
heritage: Tiller
|
heritage: %s
|
||||||
release: release-name
|
release: release-name
|
||||||
name: release-name-minecraft-datadir
|
name: release-name-minecraft-datadir
|
||||||
spec:
|
spec:
|
||||||
@@ -52,7 +53,7 @@ metadata:
|
|||||||
labels:
|
labels:
|
||||||
app: release-name-minecraft
|
app: release-name-minecraft
|
||||||
chart: minecraft-SOMEVERSION
|
chart: minecraft-SOMEVERSION
|
||||||
heritage: Tiller
|
heritage: %s
|
||||||
release: release-name
|
release: release-name
|
||||||
name: release-name-minecraft
|
name: release-name-minecraft
|
||||||
spec:
|
spec:
|
||||||
@@ -66,9 +67,13 @@ spec:
|
|||||||
type: LoadBalancer
|
type: LoadBalancer
|
||||||
`
|
`
|
||||||
|
|
||||||
|
func expectedResources(serviceName string) string {
|
||||||
|
return fmt.Sprintf(expectedResourcesTemplate, serviceName, serviceName, serviceName)
|
||||||
|
}
|
||||||
|
|
||||||
// This test requires having "helmV2" (presumably helm V2 series) on the PATH.
|
// This test requires having "helmV2" (presumably helm V2 series) on the PATH.
|
||||||
//
|
//
|
||||||
// TODO: Download and inflate the chart, and check that
|
// Download and inflate the chart, and check that
|
||||||
// in for the test.
|
// in for the test.
|
||||||
func TestHelmV2ChartInflator(t *testing.T) {
|
func TestHelmV2ChartInflator(t *testing.T) {
|
||||||
th := kusttest_test.MakeEnhancedHarness(t).
|
th := kusttest_test.MakeEnhancedHarness(t).
|
||||||
@@ -81,6 +86,7 @@ kind: ChartInflator
|
|||||||
metadata:
|
metadata:
|
||||||
name: notImportantHere
|
name: notImportantHere
|
||||||
chartName: minecraft
|
chartName: minecraft
|
||||||
|
chartVersion: 1.2.0
|
||||||
helmBin: helmV2
|
helmBin: helmV2
|
||||||
`)
|
`)
|
||||||
|
|
||||||
@@ -88,12 +94,12 @@ helmBin: helmV2
|
|||||||
th.AssertActualEqualsExpectedWithTweak(m,
|
th.AssertActualEqualsExpectedWithTweak(m,
|
||||||
func(x []byte) []byte {
|
func(x []byte) []byte {
|
||||||
return chartName.ReplaceAll(x, []byte("chart: minecraft-SOMEVERSION"))
|
return chartName.ReplaceAll(x, []byte("chart: minecraft-SOMEVERSION"))
|
||||||
}, expectedResources)
|
}, expectedResources("Tiller"))
|
||||||
}
|
}
|
||||||
|
|
||||||
// This test requires having "helmV3" (presumably helm V3 series) on the PATH.
|
// This test requires having "helmV3" (presumably helm V3 series) on the PATH.
|
||||||
//
|
//
|
||||||
func disabled_TestHelmV3ChartInflator(t *testing.T) {
|
func TestHelmV3ChartInflator(t *testing.T) {
|
||||||
th := kusttest_test.MakeEnhancedHarness(t).
|
th := kusttest_test.MakeEnhancedHarness(t).
|
||||||
PrepExecPlugin("someteam.example.com", "v1", "ChartInflator")
|
PrepExecPlugin("someteam.example.com", "v1", "ChartInflator")
|
||||||
defer th.Reset()
|
defer th.Reset()
|
||||||
@@ -105,6 +111,7 @@ metadata:
|
|||||||
name: notImportantHere
|
name: notImportantHere
|
||||||
chartRepo: https://kubernetes-charts.storage.googleapis.com/
|
chartRepo: https://kubernetes-charts.storage.googleapis.com/
|
||||||
chartName: minecraft
|
chartName: minecraft
|
||||||
|
chartVersion: 1.2.0
|
||||||
helmBin: helmV3
|
helmBin: helmV3
|
||||||
`)
|
`)
|
||||||
|
|
||||||
@@ -112,5 +119,5 @@ helmBin: helmV3
|
|||||||
th.AssertActualEqualsExpectedWithTweak(m,
|
th.AssertActualEqualsExpectedWithTweak(m,
|
||||||
func(x []byte) []byte {
|
func(x []byte) []byte {
|
||||||
return chartName.ReplaceAll(x, []byte("chart: minecraft-SOMEVERSION"))
|
return chartName.ReplaceAll(x, []byte("chart: minecraft-SOMEVERSION"))
|
||||||
}, expectedResources)
|
}, expectedResources("Helm"))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user