diff --git a/e2e/tests/render/expectedoutput/helm_v2 b/e2e/tests/render/expectedoutput/helm_v2 index e723a28ad8..9f9c1c6298 100644 --- a/e2e/tests/render/expectedoutput/helm_v2 +++ b/e2e/tests/render/expectedoutput/helm_v2 @@ -1,3 +1,4 @@ + --- # Source: component-chart/templates/service.yaml @@ -86,3 +87,5 @@ spec: --- # Source: component-chart/templates/volumes.yaml + + diff --git a/e2e/tests/render/expectedoutput/helm_v3 b/e2e/tests/render/expectedoutput/helm_v3 index 5aac4589f6..90d82d4ace 100644 --- a/e2e/tests/render/expectedoutput/helm_v3 +++ b/e2e/tests/render/expectedoutput/helm_v3 @@ -1,3 +1,4 @@ + --- # Source: component-chart/templates/service.yaml apiVersion: v1 @@ -70,3 +71,5 @@ spec: --- # Source: component-chart/templates/deployment.yaml # Create headless service for StatefulSet + + diff --git a/e2e/tests/render/helm_v2.go b/e2e/tests/render/helm_v2.go index 8926c522e3..0d2dfde1c4 100644 --- a/e2e/tests/render/helm_v2.go +++ b/e2e/tests/render/helm_v2.go @@ -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...") @@ -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 diff --git a/e2e/tests/render/helm_v3.go b/e2e/tests/render/helm_v3.go index 7707fe7dcc..2e221fc8f5 100644 --- a/e2e/tests/render/helm_v3.go +++ b/e2e/tests/render/helm_v3.go @@ -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") } @@ -57,6 +58,5 @@ func runHelmV3(f *customFactory, logger log.Logger) error { } f.builtImages = map[string]string{} - return nil } diff --git a/pkg/devspace/deploy/deployer/helm/deploy.go b/pkg/devspace/deploy/deployer/helm/deploy.go index dba9087f0e..45efd380e3 100644 --- a/pkg/devspace/deploy/deployer/helm/deploy.go +++ b/pkg/devspace/deploy/deployer/helm/deploy.go @@ -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 }