Skip to content

Commit

Permalink
Merge pull request #945 from FabianKramm/master
Browse files Browse the repository at this point in the history
helm render: add newline
  • Loading branch information
FabianKramm authored Feb 14, 2020
2 parents 1eacdc1 + 1d81683 commit 5a369be
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
3 changes: 3 additions & 0 deletions e2e/tests/render/expectedoutput/helm_v2
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

---
# Source: component-chart/templates/service.yaml

Expand Down Expand Up @@ -86,3 +87,5 @@ spec:

---
# Source: component-chart/templates/volumes.yaml


3 changes: 3 additions & 0 deletions e2e/tests/render/expectedoutput/helm_v3
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

---
# Source: component-chart/templates/service.yaml
apiVersion: v1
Expand Down Expand Up @@ -70,3 +71,5 @@ spec:
---
# Source: component-chart/templates/deployment.yaml
# Create headless service for StatefulSet


13 changes: 11 additions & 2 deletions e2e/tests/render/helm_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,23 @@ package render

import (
"io/ioutil"
"regexp"
"strings"

"github.com/devspace-cloud/devspace/cmd"
"github.com/devspace-cloud/devspace/cmd/flags"
"github.com/devspace-cloud/devspace/e2e/utils"
"github.com/devspace-cloud/devspace/pkg/devspace/deploy/deployer/helm"
"github.com/devspace-cloud/devspace/pkg/util/log"
"github.com/pkg/errors"
)

var chartRegEx = regexp.MustCompile(`component-chart-[^\"]+`)

func replaceComponentChart(in string) string {
return chartRegEx.ReplaceAllString(in, "component-chart-"+helm.DevSpaceChartConfig.Version)
}

func runHelmV2(f *customFactory, logger log.Logger) error {
logger.Info("Run sub test 'helm_v2' of test 'render'")
logger.StartWait("Run test...")
Expand Down Expand Up @@ -46,8 +54,9 @@ func runHelmV2(f *customFactory, logger log.Logger) error {
return err
}

if strings.Index(capturedOutput, string(expectedOutput)) == -1 {
return errors.Errorf("output does not match expected output")
expectedOutputStr := replaceComponentChart(string(expectedOutput))
if strings.Index(capturedOutput, expectedOutputStr) == -1 {
return errors.Errorf("output '%s' does not match expected output '%s'", capturedOutput, expectedOutputStr)
}

imagesExpected := 1
Expand Down
4 changes: 2 additions & 2 deletions e2e/tests/render/helm_v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ func runHelmV3(f *customFactory, logger log.Logger) error {
return err
}

if strings.Index(string(expectedOutput), capturedOutput) == -1 {
expectedOutputStr := replaceComponentChart(string(expectedOutput))
if strings.Index(expectedOutputStr, capturedOutput) == -1 {
return errors.Errorf("output does not match expected output")
}

Expand All @@ -57,6 +58,5 @@ func runHelmV3(f *customFactory, logger log.Logger) error {
}

f.builtImages = map[string]string{}

return nil
}
2 changes: 1 addition & 1 deletion pkg/devspace/deploy/deployer/helm/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func (d *DeployConfig) internalDeploy(cache *generated.CacheConfig, forceDeploy
return false, err
}

out.Write([]byte(str + "\n"))
out.Write([]byte("\n" + str + "\n"))
return true, nil
}

Expand Down

0 comments on commit 5a369be

Please sign in to comment.