Skip to content

Commit 2b8e2c3

Browse files
committed
chore(test): fixes and workflow updates
1 parent 87a7f67 commit 2b8e2c3

File tree

11 files changed

+31
-81
lines changed

11 files changed

+31
-81
lines changed

.github/workflows/e2e.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
- "**.go"
3131
- "!**_test.go" # exclude test files to ignore unit test changes
3232
- "test/**" # include test files in e2e again
33+
- "e2e-next/**" #include e2e-next tests
3334
- "!**.md"
3435
- "Dockerfile.release"
3536
- ".github/workflows/e2e.yaml"

e2e-next/constants/cluster.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package constants
22

3-
var vclusterCluster string
3+
var hostCluster string
44

5-
func GetClusterName() string {
6-
if vclusterCluster == "" {
5+
func GetHostClusterName() string {
6+
if hostCluster == "" {
77
return "kind-cluster"
88
}
9-
return vclusterCluster
9+
return hostCluster
1010
}
1111

12-
func SetClusterName(name string) {
13-
vclusterCluster = name
12+
func SetHostClusterName(name string) {
13+
hostCluster = name
1414
}

e2e-next/constants/image.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,14 @@ import (
44
"strings"
55
)
66

7-
const (
8-
DefaultVclusterImage = "ghcr.io/loft-sh/vcluster:0.30.0"
9-
)
10-
117
var (
128
repository string
139
tag string
1410
)
1511

16-
func GetImage() string {
12+
func GetVclusterImage() string {
1713
if repository == "" && tag == "" {
18-
return DefaultVclusterImage
14+
return "ghcr.io/loft-sh/vcluster:dev-next"
1915
}
2016
if tag == "" {
2117
return repository
@@ -37,7 +33,7 @@ func GetTag() string {
3733
return tag
3834
}
3935

40-
func SetImage(image string) {
36+
func SetVclusterImage(image string) {
4137
if strings.Contains(image, "@") {
4238
// Handle digest format: repo@sha256:xxx
4339
parts := strings.SplitN(image, "@", 2)

e2e-next/e2e_suite_test.go

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88

99
"github.com/loft-sh/e2e-framework/pkg/e2e"
1010
cluster "github.com/loft-sh/e2e-framework/pkg/setup/cluster"
11-
"github.com/loft-sh/e2e-framework/pkg/setup/devspace"
1211
"github.com/peterbourgon/ff/v3"
1312

1413
"github.com/loft-sh/vcluster/e2e-next/constants"
@@ -34,8 +33,8 @@ var (
3433

3534
// Register your flags in an init function. This ensures they are registered _before_ `go test` calls flag.Parse().
3635
func handleFlags() {
37-
flag.StringVar(&vclusterImage, "vcluster-image", constants.DefaultVclusterImage, "vCluster image to test")
38-
flag.StringVar(&clusterName, "cluster-name", constants.GetClusterName(), "The kind cluster to run test against. Optional.")
36+
flag.StringVar(&vclusterImage, "vcluster-image", constants.GetVclusterImage(), "vCluster image to test")
37+
flag.StringVar(&clusterName, "cluster-name", constants.GetHostClusterName(), "The kind cluster to run test against. Optional.")
3938
flag.BoolVar(&setupOnly, "setup-only", false, "Skip tests and setup the environment")
4039
flag.BoolVar(&teardown, "teardown", true, "Disables [e2e.AfterSuite] [e2e.AfterAll] to leave environment in place.")
4140
flag.BoolVar(&teardownOnly, "teardown-only", false, "Skip tests and tear down the environment")
@@ -47,8 +46,8 @@ func handleFlags() {
4746
panic(err)
4847
}
4948

50-
constants.SetClusterName(clusterName)
51-
constants.SetImage(vclusterImage)
49+
constants.SetHostClusterName(clusterName)
50+
constants.SetVclusterImage(vclusterImage)
5251

5352
e2e.SetSetupOnly(setupOnly)
5453
e2e.SetTeardown(!setupOnly && teardown)
@@ -76,10 +75,10 @@ var _ = BeforeSuite(func(ctx context.Context) context.Context {
7675

7776
By("Creating kind cluster " + clusterName)
7877
clusterOptions := []cluster.Options{
79-
cluster.WithName(constants.GetClusterName()),
78+
cluster.WithName(constants.GetHostClusterName()),
8079
cluster.WithProvider(kind.NewProvider()),
8180
}
82-
if constants.GetClusterName() == "kind-cluster" {
81+
if constants.GetHostClusterName() == "kind-cluster" {
8382
clusterOptions = append(clusterOptions, cluster.WithConfigFile("e2e-kind.config.yaml"))
8483
}
8584

@@ -97,23 +96,14 @@ var _ = BeforeSuite(func(ctx context.Context) context.Context {
9796
ctx, err = cluster.UseCluster(clusterName)(ctx)
9897
Expect(err).NotTo(HaveOccurred())
9998

100-
if vclusterImage == "" {
101-
By("No vcluster image specified, using default")
102-
vclusterImage = constants.DefaultVclusterImage
103-
}
104-
if devspace.From(ctx) {
105-
By("Using DevSpace built image, skip loading image to kind cluster...")
106-
} else if vclusterImage != constants.DefaultVclusterImage {
107-
By("Loading image to kind cluster...")
108-
ctx, err = cluster.LoadImage(clusterName, vclusterImage)(ctx)
109-
Expect(err).NotTo(HaveOccurred())
110-
} else {
111-
By("Using stable image...")
112-
}
99+
By("Loading image to kind cluster...")
100+
ctx, err = cluster.LoadImage(clusterName, vclusterImage)(ctx)
101+
Expect(err).NotTo(HaveOccurred())
102+
113103
return ctx
114104
})
115105

116106
var _ = AfterSuite(func(ctx context.Context) {
117-
_, err := cluster.Destroy(constants.GetClusterName())(ctx)
107+
_, err := cluster.Destroy(constants.GetHostClusterName())(ctx)
118108
Expect(err).NotTo(HaveOccurred())
119109
})

e2e-next/test_core/sync/test_node.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ var _ = Describe("Node sync",
4949

5050
It("Sync nodes using label selector", func(ctx context.Context) {
5151

52-
hostname := constants.GetClusterName() + "-control-plane"
52+
hostname := constants.GetHostClusterName() + "-control-plane"
5353
if kindName, ok := os.LookupEnv("KIND_NAME"); ok && kindName != "" {
5454
hostname = kindName + "-control-plane"
5555
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ require (
2828
github.com/loft-sh/agentapi/v4 v4.5.0-alpha.10
2929
github.com/loft-sh/analytics-client v0.0.0-20240219162240-2f4c64b2494e
3030
github.com/loft-sh/api/v4 v4.5.0-alpha.10
31-
github.com/loft-sh/e2e-framework v0.0.0-20251106141448-bb8544c0c016
31+
github.com/loft-sh/e2e-framework v0.0.0-20251118151008-0a6143fe4ef5
3232
github.com/loft-sh/image v0.0.0-20250625154753-87447a6ad364
3333
github.com/loft-sh/utils v0.0.29
3434
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ github.com/loft-sh/e2e-framework v0.0.0-20251106021254-afe4626e9c36 h1:ikPWcAwxU
313313
github.com/loft-sh/e2e-framework v0.0.0-20251106021254-afe4626e9c36/go.mod h1:b4tZYkj8EobUU7RtUTHT7ih+eir/dpfVn6RYlkUks50=
314314
github.com/loft-sh/e2e-framework v0.0.0-20251106141448-bb8544c0c016 h1:3C27LFDtbo1MaAk/V8yr6J70oBgHXkoj2L31vW9/8xs=
315315
github.com/loft-sh/e2e-framework v0.0.0-20251106141448-bb8544c0c016/go.mod h1:b4tZYkj8EobUU7RtUTHT7ih+eir/dpfVn6RYlkUks50=
316+
github.com/loft-sh/e2e-framework v0.0.0-20251118151008-0a6143fe4ef5 h1:gY6w+pT85VPPUsjap9t5WscKBG63ZD4rADSD91QqAKM=
317+
github.com/loft-sh/e2e-framework v0.0.0-20251118151008-0a6143fe4ef5/go.mod h1:b4tZYkj8EobUU7RtUTHT7ih+eir/dpfVn6RYlkUks50=
316318
github.com/loft-sh/image v0.0.0-20250625154753-87447a6ad364 h1:vSuqHqh4w2zrG+WvnyH64JAUhX+Bou19n0gvCrPirOs=
317319
github.com/loft-sh/image v0.0.0-20250625154753-87447a6ad364/go.mod h1:niVPRwWFUSA8FihY9e5hGAp5IbKmbCdckGxJGSTKTUs=
318320
github.com/loft-sh/log v0.0.0-20240219160058-26d83ffb46ac h1:Gz/7Lb7WgdgIv+KJz87ORA1zvQW52tUqKPGyunlp4dQ=

vendor/github.com/loft-sh/e2e-framework/pkg/setup/cluster/current.go

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/loft-sh/e2e-framework/pkg/setup/cluster/list.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/loft-sh/e2e-framework/pkg/setup/devspace/devspace.go

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)