Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions e2e/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func NewDefaultFramework(path string) *Framework {
binName += "darwin-"
case "linux":
binName += "linux-"
case "windows":
case osWindows:
binName += "windows-"
}

Expand All @@ -27,7 +27,7 @@ func NewDefaultFramework(path string) *Framework {
binName += "arm64"
}

if runtime.GOOS == "windows" {
if runtime.GOOS == osWindows {
binName += ".exe"
}

Expand Down
23 changes: 23 additions & 0 deletions e2e/framework/platform.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package framework

import (
"runtime"

"github.com/onsi/ginkgo/v2"
)

const osWindows = "windows"

func SkipOnWindows(reason string) {
ginkgo.GinkgoHelper()
if runtime.GOOS == osWindows {
ginkgo.Skip(reason)
}
}

func SkipUnlessOS(goos, reason string) {
ginkgo.GinkgoHelper()
if runtime.GOOS != goos {
ginkgo.Skip(reason)
}
}
13 changes: 3 additions & 10 deletions e2e/tests/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (

const (
prebuildRepoName = "test-repo"
osWindows = "windows"
)

func prepareDockerfileContent(dockerfilePath string) (string, error) {
Expand Down Expand Up @@ -320,9 +319,7 @@ var _ = ginkgo.Describe("devsy build test suite", ginkgo.Label("build"), ginkgo.
ginkgo.It("build kubernetes dockerless",
ginkgo.SpecTimeout(framework.TimeoutShort()),
func(ctx context.Context) {
if runtime.GOOS == osWindows {
ginkgo.Skip("skipping on windows")
}
framework.SkipOnWindows("skipping on windows")

f := framework.NewDefaultFramework(initialDir + "/bin")
tempDir := framework.CopyTestdata("tests/build/testdata/kubernetes", initialDir)
Expand Down Expand Up @@ -378,9 +375,7 @@ var _ = ginkgo.Describe("devsy build test suite", ginkgo.Label("build"), ginkgo.
"kubernetes dockerless build cleans up .devsy-internal after streaming",
ginkgo.SpecTimeout(framework.TimeoutShort()),
func(ctx context.Context) {
if runtime.GOOS == osWindows {
ginkgo.Skip("skipping on windows")
}
framework.SkipOnWindows("skipping on windows")

f := framework.NewDefaultFramework(initialDir + "/bin")
tempDir := framework.CopyTestdata("tests/build/testdata/kubernetes", initialDir)
Expand Down Expand Up @@ -421,9 +416,7 @@ func validateKubernetesDeploymentWithoutDocker(
initialDir string,
action func(context.Context, *framework.Framework, string) error,
) {
if runtime.GOOS == osWindows {
ginkgo.Skip("skipping on Windows")
}
framework.SkipOnWindows("skipping on Windows")

f := framework.NewDefaultFramework(initialDir + "/bin")
tempDir := framework.CopyTestdata("tests/build/testdata/kubernetes", initialDir)
Expand Down
9 changes: 2 additions & 7 deletions e2e/tests/dockerbuildkit/docker_internal_buildkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"time"

Expand Down Expand Up @@ -143,9 +142,7 @@ var _ = ginkgo.Describe(
)

ginkgo.BeforeEach(func(ctx context.Context) {
if runtime.GOOS != "windows" {
ginkgo.Skip("Windows only")
}
framework.SkipUnlessOS("windows", "Windows only")
sshHost = requireEnv(sshHostEnv)
wslID = requireEnv(wslDaemonEnv)
envVars = providerEnv(sshHost)
Expand Down Expand Up @@ -340,9 +337,7 @@ var _ = ginkgo.Describe(
)

ginkgo.BeforeEach(func() {
if runtime.GOOS != "windows" {
ginkgo.Skip("Windows only")
}
framework.SkipUnlessOS("windows", "Windows only")
sshHost = requireEnv(sshHostEnv)
wslID = requireEnv(wslDaemonEnv)
configDir = ginkgo.GinkgoT().TempDir()
Expand Down
5 changes: 1 addition & 4 deletions e2e/tests/ide/browser_returns.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"net/url"
"os"
"path/filepath"
"runtime"
"strings"
"syscall"
"time"
Expand Down Expand Up @@ -240,9 +239,7 @@ var _ = ginkgo.Describe(
"passes --open-browser to the helper when --ide-launch=auto",
ginkgo.SpecTimeout(framework.TimeoutLong()),
func(ctx context.Context) {
if runtime.GOOS != "linux" {
ginkgo.Skip("/proc/<pid>/cmdline inspection requires Linux")
}
framework.SkipUnlessOS("linux", "/proc/<pid>/cmdline inspection requires Linux")
f, tempDir := setupBrowserIDE(ctx, initialDir)

err := f.DevsyUpWithIDE(ctx,
Expand Down
5 changes: 1 addition & 4 deletions e2e/tests/ssh/agent_forward.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -35,9 +34,7 @@ var _ = ginkgo.Describe(
)

ginkgo.BeforeAll(func(ctx ginkgo.SpecContext) {
if runtime.GOOS == osWindows {
ginkgo.Skip("UNIX sockets required; skipping on windows")
}
framework.SkipOnWindows("UNIX sockets required; skipping on windows")
var err error
initialDir, err = os.Getwd()
framework.ExpectNoError(err)
Expand Down
13 changes: 3 additions & 10 deletions e2e/tests/ssh/ports_attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strconv"
"sync"
"time"
Expand All @@ -30,9 +29,7 @@ var _ = ginkgo.Describe("devsy portsAttributes e2e",
"should forward port with onAutoForward=silent and skip port with onAutoForward=ignore",
ginkgo.SpecTimeout(framework.TimeoutShort()),
func(ctx context.Context) {
if runtime.GOOS == osWindows {
ginkgo.Skip("skipping on windows")
}
framework.SkipOnWindows("skipping on windows")

tempDir := framework.CopyTestdata("tests/ssh/testdata/ports-attributes", initialDir)

Expand Down Expand Up @@ -130,9 +127,7 @@ var _ = ginkgo.Describe("devsy portsAttributes e2e",
"should forward port with notify policy and apply label metadata",
ginkgo.SpecTimeout(framework.TimeoutShort()),
func(ctx context.Context) {
if runtime.GOOS == osWindows {
ginkgo.Skip("skipping on windows")
}
framework.SkipOnWindows("skipping on windows")

tempDir := framework.CopyTestdata("tests/ssh/testdata/ports-attributes", initialDir)

Expand Down Expand Up @@ -205,9 +200,7 @@ var _ = ginkgo.Describe("devsy portsAttributes e2e",
"should skip forwarding when requireLocalPort=true and host port is occupied",
ginkgo.SpecTimeout(framework.TimeoutShort()),
func(ctx context.Context) {
if runtime.GOOS == osWindows {
ginkgo.Skip("skipping on windows")
}
framework.SkipOnWindows("skipping on windows")

requirePort := 9503

Expand Down
5 changes: 1 addition & 4 deletions e2e/tests/ssh/proxy_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"time"

Expand All @@ -31,9 +30,7 @@ var _ = ginkgo.Describe(
"should launch a workspace through an executable path containing spaces",
ginkgo.SpecTimeout(framework.TimeoutLong()),
func(ctx context.Context) {
if runtime.GOOS != osWindows {
ginkgo.Skip("skipping on non-Windows")
}
framework.SkipUnlessOS("windows", "skipping on non-Windows")

tempDir := framework.CopyTestdata("tests/ssh/testdata/local-test", initialDir)

Expand Down
5 changes: 1 addition & 4 deletions e2e/tests/up/provider_docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"os/exec"
"path"
"path/filepath"
"runtime"
"strings"
"time"

Expand Down Expand Up @@ -269,9 +268,7 @@ var _ = ginkgo.Describe(
}, ginkgo.SpecTimeout(framework.TimeoutShort()))

ginkgo.It("custom image", func(ctx context.Context) {
if runtime.GOOS == "windows" {
ginkgo.Skip("skipping on windows")
}
framework.SkipOnWindows("skipping on windows")

tempDir, err := dtc.setupAndUp(
ctx,
Expand Down
8 changes: 4 additions & 4 deletions e2e/tests/up/provider_microsandbox_dockerless.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"time"

Expand Down Expand Up @@ -120,9 +119,10 @@ var _ = ginkgo.Describe("microsandbox Dockerless parity",
func newMicrosandboxDockerlessFixture(
ctx context.Context, providerName, providerSource string,
) *microsandboxDockerlessFixtureState {
if runtime.GOOS != osLinux {
ginkgo.Skip("Dockerless parity fixture currently targets the supported Linux KVM job")
}
framework.SkipUnlessOS(
"linux",
"Dockerless parity fixture currently targets the supported Linux KVM job",
)
skipIfNoMicrosandbox(ctx)
ginkgo.GinkgoT().Setenv("DEVSY_HOME", ginkgo.GinkgoT().TempDir())
ginkgo.GinkgoT().Setenv("DEVSY_CONFIG", "")
Expand Down
5 changes: 1 addition & 4 deletions e2e/tests/up/provider_microsandbox_prebuilds.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -69,9 +68,7 @@ func newMicrosandboxPrebuildFixture(
providerName, providerSource string,
) *microsandboxPrebuildTest {
// The test process and local Docker daemon must share host loopback.
if runtime.GOOS != "linux" {
ginkgo.Skip("requires the Linux CI host's local Docker daemon")
}
framework.SkipUnlessOS("linux", "requires the Linux CI host's local Docker daemon")
skipIfNoMicrosandbox(ctx)
ginkgo.GinkgoT().Setenv("DEVSY_HOME", ginkgo.GinkgoT().TempDir())
ginkgo.GinkgoT().Setenv("DEVSY_CONFIG", "")
Expand Down
9 changes: 2 additions & 7 deletions e2e/tests/up/up_behaviors.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"

"github.com/devsy-org/devsy/e2e/framework"
Expand Down Expand Up @@ -119,18 +118,14 @@ var _ = ginkgo.Describe("up command behaviors", ginkgo.Label("up-behaviors"), fu
)

ginkgo.It("should accept --update-remote-user-uid=on", func(ctx context.Context) {
if runtime.GOOS != osLinux {
ginkgo.Skip("updateRemoteUserUID only applies on Linux")
}
framework.SkipUnlessOS("linux", "updateRemoteUserUID only applies on Linux")
_, err := dtc.setupAndUp(ctx, "tests/up/testdata/docker",
names.Flag(names.UpdateRemoteUserUID), "on")
framework.ExpectNoError(err)
}, ginkgo.SpecTimeout(framework.TimeoutShort()))

ginkgo.It("should accept --update-remote-user-uid=off", func(ctx context.Context) {
if runtime.GOOS != osLinux {
ginkgo.Skip("updateRemoteUserUID only applies on Linux")
}
framework.SkipUnlessOS("linux", "updateRemoteUserUID only applies on Linux")
tempDir, err := dtc.setupAndUp(ctx, "tests/up/testdata/docker",
names.Flag(names.UpdateRemoteUserUID), "off")
framework.ExpectNoError(err)
Expand Down
Loading