Skip to content

Commit

Permalink
fix(test): add way for non-linux runners to download a freshly compil…
Browse files Browse the repository at this point in the history
…ed devpod binary as agent

Signed-off-by: Luca Di Maio <[email protected]>
  • Loading branch information
89luca89 committed Mar 22, 2024
1 parent 979c546 commit ddc57ef
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/e2e-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@ jobs:

- name: Build binary and copy to the E2E directory
run: |
go build -ldflags "-s -w" -o devpod-windows-amd64.exe
mkdir e2e\bin
cp devpod-windows-amd64.exe e2e\bin\
go build -ldflags "-s -w" -o e2e\bin\devpod-windows-amd64.exe
$Env:GOOS = "linux"; $Env:GOARCH = "amd64"; go build -ldflags "-s -w" -o e2e\bin\devpod-linux-amd64
- name: E2E test
working-directory: .\e2e
run: |
go run github.com/onsi/ginkgo/v2/ginkgo -r -p --timeout=3600s --label-filter=${{ matrix.label }}
go run github.com/onsi/ginkgo/v2/ginkgo -r --timeout=3600s --label-filter=${{ matrix.label }}
- name: Container cleanup
if: ${{ always() }}
Expand Down
16 changes: 16 additions & 0 deletions e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package e2e

Check failure on line 1 in e2e/e2e_suite_test.go

View workflow job for this annotation

GitHub Actions / lint

: # github.com/loft-sh/devpod/e2e [github.com/loft-sh/devpod/e2e.test]

import (
"os"
"runtime"
"testing"
"time"

"github.com/onsi/ginkgo/v2"

"github.com/onsi/gomega"

"github.com/loft-sh/devpod/e2e/framework"

// Register tests
_ "github.com/loft-sh/devpod/e2e/tests/build"
_ "github.com/loft-sh/devpod/e2e/tests/context"
Expand All @@ -26,6 +31,17 @@ import (
// generated in this directory, and cluster logs will also be saved.
// This function is called on each Ginkgo node in parallel mode.
func TestRunE2ETests(t *testing.T) {
if runtime.GOOS != "linux" {
go framework.ServeAgent()

Check failure on line 35 in e2e/e2e_suite_test.go

View workflow job for this annotation

GitHub Actions / lint

undefined: framework.ServeAgent (typecheck)

// wait for http server to be up and running
for {
time.Sleep(time.Second)
if os.Getenv("DEVPOD_AGENT_URL") != "" {
break
}
}
}
gomega.RegisterFailHandler(ginkgo.Fail)
ginkgo.RunSpecs(t, "DevPod e2e suite")
}
4 changes: 4 additions & 0 deletions pkg/agent/inject.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ func InjectAgentAndExecute(
versionCheck := fmt.Sprintf(`[ "$(%s version 2>/dev/null || echo 'false')" != "%s" ]`, remoteAgentPath, version.GetVersion())
if version.GetVersion() == version.DevVersion {
preferDownload = false

if runtime.GOOS != "linux" {
preferDownload = true
}
}

// install devpod into the target
Expand Down

0 comments on commit ddc57ef

Please sign in to comment.