Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
nkubala committed Jun 24, 2020
1 parent 2242480 commit 6fe50b2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
2 changes: 1 addition & 1 deletion integration/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func TestRun(t *testing.T) {
{
description: "kustomize",
dir: "examples/getting-started-kustomize",
deployments: []string{"skaffold-kustomize"},
deployments: []string{"skaffold-kustomize-dev"},
},
}
for _, test := range tests {
Expand Down
49 changes: 24 additions & 25 deletions pkg/skaffold/initializer/deploy/kustomize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,25 @@ resources:
- ../../base`
)

type overlay struct {
name string
deployment string
kustomization string
}

func TestGenerateKustomizePipeline(t *testing.T) {
tests := []struct {
description string
base string
baseKustomization string
overlays map[string]string
overlayKustomizations map[string]string
expectedConfig latest.SkaffoldConfig
description string
base string
baseKustomization string
overlays []overlay
expectedConfig latest.SkaffoldConfig
}{
{
description: "single overlay",
base: baseDeployment,
baseKustomization: baseKustomization,
overlays: map[string]string{"dev": overlayDeployment},
overlayKustomizations: map[string]string{"dev": overlayKustomization},
description: "single overlay",
base: baseDeployment,
baseKustomization: baseKustomization,
overlays: []overlay{{"dev", overlayDeployment, overlayKustomization}},
expectedConfig: latest.SkaffoldConfig{
Pipeline: latest.Pipeline{
Deploy: latest.DeployConfig{
Expand All @@ -90,15 +94,10 @@ func TestGenerateKustomizePipeline(t *testing.T) {
description: "three overlays",
base: baseDeployment,
baseKustomization: baseKustomization,
overlays: map[string]string{
"foo": overlayDeployment,
"bar": overlayDeployment,
"baz": overlayDeployment,
},
overlayKustomizations: map[string]string{
"foo": overlayKustomization,
"bar": overlayKustomization,
"baz": overlayKustomization,
overlays: []overlay{
{"foo", overlayDeployment, overlayKustomization},
{"bar", overlayDeployment, overlayKustomization},
{"baz", overlayDeployment, overlayKustomization},
},
expectedConfig: latest.SkaffoldConfig{
Pipeline: latest.Pipeline{
Expand Down Expand Up @@ -149,11 +148,11 @@ func TestGenerateKustomizePipeline(t *testing.T) {

tmpDir.Write(filepath.Join("base", "deployment.yaml"), test.base)
tmpDir.Write(filepath.Join("base", "kustomization.yaml"), test.baseKustomization)
for name, overlay := range test.overlays {
overlays = append(overlays, filepath.Join("overlays", name))
manifests = append(manifests, filepath.Join("overlays", name, "deployment.yaml"))
tmpDir.Write(filepath.Join("overlays", name, "deployment.yaml"), overlay)
tmpDir.Write(filepath.Join("overlays", name, "kustomization.yaml"), test.overlayKustomizations[name])
for _, o := range test.overlays {
overlays = append(overlays, filepath.Join("overlays", o.name))
manifests = append(manifests, filepath.Join("overlays", o.name, "deployment.yaml"))
tmpDir.Write(filepath.Join("overlays", o.name, "deployment.yaml"), o.deployment)
tmpDir.Write(filepath.Join("overlays", o.name, "kustomization.yaml"), o.kustomization)
}

k := newKustomizeInitializer("", []string{test.base}, overlays, manifests)
Expand Down

0 comments on commit 6fe50b2

Please sign in to comment.