Skip to content

Commit

Permalink
test: add lock around download helm binary
Browse files Browse the repository at this point in the history
Signed-off-by: Russell Centanni <russell.centanni@gmail.com>
  • Loading branch information
lizardruss committed Jan 12, 2024
1 parent 26edf30 commit b079f1b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion e2e/tests/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ var _ = DevSpaceDescribe("ssh", func() {
framework.ExpectNoError(err)
})

ginkgo.It("devspace dev should NOT start an SSH service when disabled with a variable", ginkgo.FlakeAttempts(3), func(ctx context.Context) {
ginkgo.It("devspace dev should NOT start an SSH service when disabled with a variable", func(ctx context.Context) {
tempDir, err := framework.CopyToTempDir("tests/ssh/testdata/ssh-variable")
framework.ExpectNoError(err)
ginkgo.DeferCleanup(framework.CleanupTempDir, initialDir, tempDir)
Expand Down
11 changes: 8 additions & 3 deletions pkg/devspace/helm/generic/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"os"
"strings"
"sync"

"github.com/loft-sh/devspace/pkg/devspace/config/constants"
devspacecontext "github.com/loft-sh/devspace/pkg/devspace/context"
Expand Down Expand Up @@ -39,9 +40,10 @@ func NewGenericClient(command commands.Command, log log.Logger) Client {
}

type client struct {
log log.Logger
extract extract.Extract
downloader downloader.Downloader
log log.Logger
extract extract.Extract
downloader downloader.Downloader
downloaderLock sync.Mutex

helmPath string
}
Expand Down Expand Up @@ -89,6 +91,9 @@ func (c *client) Exec(ctx devspacecontext.Context, args []string) ([]byte, error
}

func (c *client) ensureHelmBinary(ctx context.Context) error {
c.downloaderLock.Lock()
defer c.downloaderLock.Unlock()

if c.helmPath != "" {
return nil
}
Expand Down

0 comments on commit b079f1b

Please sign in to comment.