Skip to content

Commit 39fe5a8

Browse files
committed
test fixes
Signed-off-by: Ryan Swanson <ryan.swanson@loft.sh>
1 parent 46a2f0a commit 39fe5a8

5 files changed

Lines changed: 32 additions & 25 deletions

File tree

.github/workflows/unit-tests.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ jobs:
3434
- name: Check out code into the Go module directory
3535
uses: actions/checkout@v1
3636

37+
- name: Uninstall Helm 3.x
38+
run: |
39+
sudo rm -rf $(which helm) || true
40+
3741
- name: Test
3842
shell: bash
3943
run: |

e2e/tests/render/render.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,36 @@ import (
66
"path/filepath"
77
"strings"
88
"sync"
9-
9+
1010
"github.com/onsi/ginkgo/v2"
11-
11+
1212
"github.com/loft-sh/devspace/cmd"
1313
"github.com/loft-sh/devspace/cmd/flags"
1414
"github.com/loft-sh/devspace/e2e/framework"
1515
"github.com/loft-sh/devspace/pkg/util/factory"
1616
)
1717

1818
var _ = DevSpaceDescribe("build", func() {
19-
19+
2020
initialDir, err := os.Getwd()
2121
if err != nil {
2222
panic(err)
2323
}
24-
24+
2525
// create a new factory
2626
var f factory.Factory
27-
27+
2828
ginkgo.BeforeEach(func() {
2929
f = framework.NewDefaultFactory()
3030
})
31-
31+
3232
// Test cases:
33-
33+
3434
ginkgo.It("should render helm charts", func() {
3535
tempDir, err := framework.CopyToTempDir("tests/render/testdata/helm")
3636
framework.ExpectNoError(err)
3737
defer framework.CleanupTempDir(initialDir, tempDir)
38-
38+
3939
stdout := &Buffer{}
4040
// create build command
4141
renderCmd := &cmd.RunPipelineCmd{
@@ -50,18 +50,18 @@ var _ = DevSpaceDescribe("build", func() {
5050
err = renderCmd.RunDefault(f)
5151
framework.ExpectNoError(err)
5252
content := strings.TrimSpace(stdout.String()) + "\n"
53-
53+
5454
framework.ExpectLocalFileContentsImmediately(
5555
filepath.Join(tempDir, "rendered.txt"),
5656
content,
5757
)
5858
})
59-
59+
6060
ginkgo.It("should render kubectl deployments", func() {
6161
tempDir, err := framework.CopyToTempDir("tests/render/testdata/kubectl")
6262
framework.ExpectNoError(err)
6363
defer framework.CleanupTempDir(initialDir, tempDir)
64-
64+
6565
stdout := &Buffer{}
6666
// create build command
6767
renderCmd := &cmd.RunPipelineCmd{

e2e/tests/render/testdata/helm/rendered.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ metadata:
99
"app.kubernetes.io/component": "test"
1010
"app.kubernetes.io/managed-by": "Helm"
1111
annotations:
12-
"helm.sh/chart": "component-chart-0.9.1"
12+
"helm.sh/chart": "component-chart-0.9.2"
1313
spec:
1414
replicas: 1
1515
strategy:
@@ -26,7 +26,7 @@ spec:
2626
"app.kubernetes.io/component": "test"
2727
"app.kubernetes.io/managed-by": "Helm"
2828
annotations:
29-
"helm.sh/chart": "component-chart-0.9.1"
29+
"helm.sh/chart": "component-chart-0.9.2"
3030
spec:
3131
imagePullSecrets:
3232
nodeSelector:
@@ -78,7 +78,6 @@ spec:
7878
volumeMounts:
7979
initContainers:
8080
volumes:
81-
volumeClaimTemplates:
8281
---
8382
# Source: component-chart/templates/deployment.yaml
8483
# Create headless service for StatefulSet

pkg/devspace/deploy/deployer/helm/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const ComponentChartFolder = "component-chart"
2323
// DevSpaceChartConfig is the config that holds the devspace chart information
2424
var DevSpaceChartConfig = &latest.ChartConfig{
2525
Name: "component-chart",
26-
Version: "0.9.1",
26+
Version: "0.9.2",
2727
RepoURL: "https://charts.devspace.sh",
2828
}
2929

pkg/devspace/pipeline/engine/engine_test.go

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ package engine
33
import (
44
"bytes"
55
"context"
6-
"mvdan.cc/sh/v3/expand"
6+
"fmt"
77
"os"
88
"path/filepath"
99
"strings"
1010
"testing"
11-
11+
1212
"gotest.tools/assert"
13+
"mvdan.cc/sh/v3/expand"
1314
)
1415

1516
type testCaseShell struct {
@@ -23,11 +24,11 @@ func TestShellCat(t *testing.T) {
2324
t.Fatal(err)
2425
}
2526
defer os.Remove(file.Name())
26-
27+
2728
if _, err = file.WriteString("Hello DevSpace!"); err != nil {
2829
t.Fatalf("Unable to write to temporary file %v", err)
2930
}
30-
31+
3132
testCases := []testCaseShell{
3233
{
3334
command: "cat " + filepath.ToSlash(file.Name()),
@@ -38,7 +39,7 @@ func TestShellCat(t *testing.T) {
3839
expectedOutput: "123\n",
3940
},
4041
}
41-
42+
4243
for _, testCase := range testCases {
4344
stdout := &bytes.Buffer{}
4445
err := ExecuteSimpleShellCommand(context.Background(), ".", expand.ListEnviron(os.Environ()...), stdout, nil, nil, testCase.command)
@@ -56,7 +57,7 @@ func TestShellCatError(t *testing.T) {
5657
expectedOutput: "cat: noFile.txt: No such file or directory\n",
5758
},
5859
}
59-
60+
6061
for _, testCase := range testCases {
6162
stderr := &bytes.Buffer{}
6263
err := ExecuteSimpleShellCommand(context.Background(), ".", expand.ListEnviron(os.Environ()...), stderr, stderr, nil, testCase.command)
@@ -69,7 +70,7 @@ func TestShellCatError(t *testing.T) {
6970
} else {
7071
t.Fatal("FAIL: TestShellCatError")
7172
}
72-
73+
7374
}
7475
}
7576

@@ -80,11 +81,11 @@ func TestShellCatEnforce(t *testing.T) {
8081
t.Fatal(err)
8182
}
8283
defer os.Remove(file.Name())
83-
84+
8485
if _, err = file.WriteString("Hello DevSpace!"); err != nil {
8586
t.Fatalf("Unable to write to temporary file %v", err)
8687
}
87-
88+
8889
testCases := []testCaseShell{
8990
{
9091
command: "cat " + filepath.ToSlash(file.Name()),
@@ -95,7 +96,7 @@ func TestShellCatEnforce(t *testing.T) {
9596
expectedOutput: "123\n",
9697
},
9798
}
98-
99+
99100
for _, testCase := range testCases {
100101
stdout := &bytes.Buffer{}
101102
err := ExecuteSimpleShellCommand(context.Background(), ".", expand.ListEnviron(os.Environ()...), stdout, nil, nil, testCase.command)
@@ -132,5 +133,8 @@ func TestHelmDownload(t *testing.T) {
132133
if err != nil {
133134
t.Fatal(err)
134135
}
136+
137+
fmt.Println("👉:", stdout1.String())
138+
135139
assert.Assert(t, strings.Contains(stdout1.String(), `Version:"v4`))
136140
}

0 commit comments

Comments
 (0)