Skip to content

Commit

Permalink
chore(e2e): refactor to use vcluster cli pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesfrey committed Jul 15, 2024
1 parent 3c326ae commit fe8e74e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ jobs:
kubectl wait --for=condition=ready vcluster -n vcluster-k3s vcluster-k3s --timeout=100s
- name: Run E2E Tests K3S
run: NAMESPACE=vcluster-k3s LOCAL_PORT=14550 go test -mod=vendor ./test/e2e -v
run: CLUSTER_NAME=vcluster-k3s NAMESPACE=vcluster-k3s LOCAL_PORT=14550 go test -mod=vendor ./test/e2e -v

- name: Create Vcluster Custom Resource K0S
run: |
Expand All @@ -140,7 +140,7 @@ jobs:
kubectl wait --for=condition=ready vcluster -n vcluster-k0s vcluster-k0s --timeout=100s
- name: Run E2E Tests K0S
run: NAMESPACE=vcluster-k0s LOCAL_PORT=14551 go test -mod=vendor ./test/e2e -v
run: CLUSTER_NAME=vcluster-k0s NAMESPACE=vcluster-k0s LOCAL_PORT=14551 go test -mod=vendor ./test/e2e -v

- name: Create Vcluster Custom Resource K8S
run: |
Expand All @@ -157,7 +157,7 @@ jobs:
kubectl wait --for=condition=ready vcluster -n vcluster-k8s vcluster-k8s --timeout=100s
- name: Run E2E Tests K8S
run: NAMESPACE=vcluster-k8s LOCAL_PORT=14552 go test -mod=vendor ./test/e2e -v
run: CLUSTER_NAME=vcluster-k8s NAMESPACE=vcluster-k8s LOCAL_PORT=14552 go test -mod=vendor ./test/e2e -v

- name: Create Vcluster Custom Resource EKS
run: |
Expand All @@ -174,4 +174,4 @@ jobs:
kubectl wait --for=condition=ready vcluster -n vcluster-eks vcluster-eks --timeout=100s
- name: Run E2E Tests EKS
run: NAMESPACE=vcluster-eks LOCAL_PORT=14553 go test -mod=vendor ./test/e2e -v
run: CLUSTER_NAME=vcluster-eks NAMESPACE=vcluster-eks LOCAL_PORT=14553 go test -mod=vendor ./test/e2e -v
13 changes: 9 additions & 4 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import (

"github.com/loft-sh/log"
"github.com/loft-sh/vcluster/cmd/vclusterctl/cmd"
"github.com/loft-sh/vcluster/cmd/vclusterctl/flags"
"github.com/loft-sh/vcluster/pkg/cli"
"github.com/loft-sh/vcluster/pkg/cli/flags"
logutil "github.com/loft-sh/vcluster/pkg/util/log"
"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
Expand Down Expand Up @@ -52,6 +53,7 @@ var _ = ginkgo.Describe("e2e test", func() {
gomega.Expect(err).NotTo(gomega.HaveOccurred())

namespace := os.Getenv("NAMESPACE")
name := os.Getenv("CLUSTER_NAME")
localPort, err := strconv.Atoi(os.Getenv("LOCAL_PORT"))
gomega.Expect(err).NotTo(gomega.HaveOccurred())
connectCmd := cmd.ConnectCmd{
Expand All @@ -60,10 +62,13 @@ var _ = ginkgo.Describe("e2e test", func() {
Namespace: namespace,
Debug: true,
},
KubeConfig: vKubeconfigFile.Name(),
LocalPort: localPort, // choosing a port that usually should be unused
ConnectOptions: cli.ConnectOptions{
UpdateCurrent: false,
KubeConfig: vKubeconfigFile.Name(),
LocalPort: localPort, // choosing a port that usually should be unused
},
}
err = connectCmd.Connect(ctx, nil, namespace, nil)
err = cli.ConnectHelm(ctx, &connectCmd.ConnectOptions, connectCmd.GlobalFlags, name, nil, connectCmd.Log)
gomega.Expect(err).NotTo(gomega.HaveOccurred())

err = wait.PollUntilContextTimeout(ctx, time.Second, time.Minute, false, func(ctx context.Context) (bool, error) {
Expand Down

0 comments on commit fe8e74e

Please sign in to comment.