diff --git a/.github/workflows/e2e-deploy-changes.yaml b/.github/workflows/e2e-deploy-changes.yaml new file mode 100644 index 0000000000..83e1f805b4 --- /dev/null +++ b/.github/workflows/e2e-deploy-changes.yaml @@ -0,0 +1,246 @@ +name: E2E Deploy Changes CI + +on: + workflow_dispatch: + release: + types: [created] + pull_request: + branches: + - main + - v* + paths: + - "test/deploy_changes/**" + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + REPOSITORY_NAME: ghcr.io/${{ github.repository }}-ci + TAG_NAME: PR${{ github.event.number }} + VCLUSTER_SUFFIX: vcluster + VCLUSTER_NAME: vcluster + VCLUSTER_NAMESPACE: vcluster + +jobs: + build-and-push-syncer-image: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - run: git fetch --force --tags + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: "1.22" + - name: Setup Just + uses: extractions/setup-just@v2 + - name: Setup Syft + uses: anchore/sbom-action/download-syft@v0.17.0 + - name: Setup GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + install-only: true + version: latest + - name: Build and save syncer image + run: | + set -x + TELEMETRY_PRIVATE_KEY="" goreleaser build --single-target --snapshot --id vcluster --clean --output ./vcluster + docker build -t "${{ env.REPOSITORY_NAME }}:${{ env.TAG_NAME }}" -f Dockerfile.release --build-arg TARGETARCH=amd64 --build-arg TARGETOS=linux . + docker save -o vcluster_syncer "${{ env.REPOSITORY_NAME }}:${{ env.TAG_NAME }}" + - name: Upload syncer image to artifact + uses: actions/upload-artifact@v4 + with: + name: vcluster_syncer + path: ./vcluster_syncer + retention-days: 7 + + build-vcluster-cli: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - run: git fetch --force --tags + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: "1.22" + - name: Setup Just + uses: extractions/setup-just@v2 + - name: Setup Syft + uses: anchore/sbom-action/download-syft@v0.17.0 + - name: Setup GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + install-only: true + - name: Build vcluster cli + run: | + set -x + TELEMETRY_PRIVATE_KEY="" goreleaser build --single-target --snapshot --id vcluster-cli --clean --output ./vcluster + - name: Upload vcluster cli to artifact + uses: actions/upload-artifact@v4 + with: + name: vcluster + path: ./vcluster + retention-days: 7 + + build-tests: + name: Build tests binaries + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Configure git + run: git config --global url.https://$GH_ACCESS_TOKEN@github.com/.insteadOf https://github.com/ + env: + GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version-file: go.mod + + - name: Build e2e binary + run: | + cd ./test/deploy_changes + go run -mod=vendor github.com/onsi/ginkgo/v2/ginkgo build --require-suite -r --mod vendor $(ls *.test | jq -R . | jq -rcs '. | join(" \\\n")') + env: + GOWORK: off + + - name: Upload test binaries to artifacts + uses: actions/upload-artifact@v4 + with: + name: test-binaries + path: ./test/deploy_changes/*.test + retention-days: 7 + + deploy-tests: + name: Execute test suites + needs: + - build-and-push-syncer-image + - build-vcluster-cli + - build-tests + + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - uses: azure/setup-helm@v4 + name: Setup Helm + with: + version: "v3.11.0" + + - name: Set up kind k8s cluster + uses: engineerd/setup-kind@v0.5.0 + with: + version: "v0.20.0" + image: kindest/node:v1.30.0@sha256:047357ac0cfea04663786a612ba1eaba9702bef25227a794b52890dd8bcd692e + + - name: Testing kind cluster set-up + run: | + set -x + kubectl cluster-info + kubectl get pods -n kube-system + echo "kubectl config current-context:" $(kubectl config current-context) + echo "KUBECONFIG env var:" ${KUBECONFIG} + + - name: Download vcluster cli + uses: actions/download-artifact@v4 + with: + name: vcluster + + - name: Download syncer image + uses: actions/download-artifact@v4 + with: + name: vcluster_syncer + + - name: Download test binaries + uses: actions/download-artifact@v4 + with: + name: test-binaries + path: ./test/deploy_changes + + - name: Create vcluster + id: create-vcluster + run: | + set -x + + sudo apt-get install -y sed + + sed -i "s|REPLACE_REPOSITORY_NAME|${{ env.REPOSITORY_NAME }}|g" ./test/deploy_changes/commonValues.yaml + sed -i "s|REPLACE_TAG_NAME|${{ env.TAG_NAME }}|g" ./test/deploy_changes/commonValues.yaml + + kind load image-archive vcluster_syncer + + chmod +x vcluster && sudo mv vcluster /usr/bin + + vcluster create ${{ env.VCLUSTER_SUFFIX }} -n ${{ env.VCLUSTER_NAMESPACE }} \ + --create-namespace \ + --debug \ + --connect=false \ + --local-chart-dir ./chart \ + -f ./test/deploy_changes/commonValues.yaml + continue-on-error: true + + - name: Wait until vcluster is ready + id: wait-until-vcluster-is-ready + if: steps.create-vcluster.outcome == 'success' + run: | + set -x + + ./hack/wait-for-pod.sh -l app=${{ env.VCLUSTER_SUFFIX }} -n ${{ env.VCLUSTER_NAMESPACE }} + + continue-on-error: true + + - name: Collect deployment information in case vcluster fails to start + if: steps.wait-until-vcluster-is-ready.outcome != 'success' + run: | + set -x + kubectl get pods -o yaml -n ${{ env.VCLUSTER_NAMESPACE }} + echo "======================================================================================================================" + kubectl get events -n ${{ env.VCLUSTER_NAMESPACE }} --sort-by='.lastTimestamp' + echo "======================================================================================================================" + kubectl logs -l app=${{ env.VCLUSTER_SUFFIX }} -n ${{ env.VCLUSTER_NAMESPACE }} -c syncer --tail=-1 -p || kubectl logs -l app=${{ env.VCLUSTER_SUFFIX }} -n ${{ env.VCLUSTER_NAMESPACE }} -c syncer --tail=-1 + echo "======================================================================================================================" + kubectl describe pods -n ${{ env.VCLUSTER_NAMESPACE }} + exit 1 + + # Skips NetworkPolicy tests because they require network plugin with support (e.g. Calico) + - name: Execute tests + id: execute-tests + working-directory: ./test + run: | + set -x + + sudo chmod +x ./deploy_changes/*.test + + VCLUSTER_SUFFIX=${{ env.VCLUSTER_SUFFIX }} VCLUSTER_NAME=${{ env.VCLUSTER_NAME }} VCLUSTER_NAMESPACE=${{ env.VCLUSTER_NAMESPACE }} ./deploy_changes/*.test -test.v --ginkgo.v --ginkgo.skip='.*NetworkPolicy.*' --ginkgo.fail-fast + + if kubectl logs -l app=${{ env.VCLUSTER_SUFFIX }} -n ${{ env.VCLUSTER_NAMESPACE }} -c syncer --tail=-1 -p >/dev/null 2>/dev/null; then + echo "vCluster has restarted during testing, failing..." + exit 1 + fi + + continue-on-error: true + + - name: Print logs if tests fail + if: steps.execute-tests.outcome == 'failure' + run: | + set -x + kubectl get pods -o yaml -n ${{ env.VCLUSTER_NAMESPACE }} + echo "======================================================================================================================" + kubectl get events -n ${{ env.VCLUSTER_NAMESPACE }} --sort-by='.lastTimestamp' + echo "======================================================================================================================" + kubectl logs -l app=${{ env.VCLUSTER_SUFFIX }} -n ${{ env.VCLUSTER_NAMESPACE }} -c syncer --tail=-1 -p || kubectl logs -l app=${{ env.VCLUSTER_SUFFIX }} -n ${{ env.VCLUSTER_NAMESPACE }} -c syncer --tail=-1 + echo "======================================================================================================================" + kubectl describe pods -n ${{ env.VCLUSTER_NAMESPACE }} + exit 1 + diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index e0abf70bfc..a902a8ed85 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -10,7 +10,7 @@ on: paths: - "**.go" - "!**_test.go" # exclude test files to ignore unit test changes - - "test/**" # include test files in e2e again + - "test/functional_tests/**" # include test files in e2e again - "!**.md" - "Dockerfile.release" - ".github/workflows/e2e.yaml" @@ -104,7 +104,7 @@ jobs: run: | set -x sudo apt-get install -y jq - paths=$(ls -d ./test/e2e*) + paths=$(ls -d ./test/functional_tests/e2e*) echo "matrix=$(printf '%s\n' "${paths}" | jq -R . | jq -cs .)" >> "$GITHUB_OUTPUT" outputs: matrix: ${{ steps.set-paths-matrix.outputs.matrix }} @@ -129,7 +129,7 @@ jobs: - name: Build e2e binary run: | - go run -mod=vendor github.com/onsi/ginkgo/v2/ginkgo build --require-suite -r --mod vendor $(ls -d ./test/e2e* | jq -R . | jq -rcs '. | join(" \\\n")') + go run -mod=vendor github.com/onsi/ginkgo/v2/ginkgo build --require-suite -r --mod vendor $(ls -d ./test/functional_tests/e2e* | jq -R . | jq -rcs '. | join(" \\\n")') env: GOWORK: off @@ -137,7 +137,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: e2e-binaries - path: ./test/*/*.test + path: ./test/functional_tests/*/*.test retention-days: 7 vcluster-install-delete: @@ -287,14 +287,14 @@ jobs: chmod +x ./vcluster-dev/vcluster set -x - sed -i "s|REPLACE_REPOSITORY_NAME|${{ env.REPOSITORY_NAME }}|g" test/commonValues.yaml - sed -i "s|REPLACE_TAG_NAME|${{ env.TAG_NAME }}|g" test/commonValues.yaml + sed -i "s|REPLACE_REPOSITORY_NAME|${{ env.REPOSITORY_NAME }}|g" test/functional_tests/commonValues.yaml + sed -i "s|REPLACE_TAG_NAME|${{ env.TAG_NAME }}|g" test/functional_tests/commonValues.yaml ./vcluster-dev/vcluster create vcluster --distro=${{ matrix.distribution }} \ --connect=false \ --upgrade \ --local-chart-dir ./chart \ - -f ./test/commonValues.yaml + -f ./test/functional_tests/commonValues.yaml ./hack/wait-for-pod.sh -l app=${{ env.VCLUSTER_SUFFIX }} -n ${{ env.VCLUSTER_NAMESPACE }} @@ -317,15 +317,15 @@ jobs: include: - distribution: "k8s" ha: "true" - test-suite-path: "./test/e2e" + test-suite-path: "./test/functional_tests/e2e" multinamespace-mode: "false" - distribution: "k3s" ha: "true" - test-suite-path: "./test/e2e" + test-suite-path: "./test/functional_tests/e2e" multinamespace-mode: "false" - distribution: "k0s" ha: "true" - test-suite-path: "./test/e2e" + test-suite-path: "./test/functional_tests/e2e" multinamespace-mode: "false" exclude: - ha: "true" @@ -335,13 +335,13 @@ jobs: multinamespace-mode: "true" - distribution: "k3s" multinamespace-mode: "true" - test-suite-path: "./test/e2e_target_namespace" + test-suite-path: "./test/functional_tests/e2e_target_namespace" - distribution: "k3s" multinamespace-mode: "true" - test-suite-path: "./test/e2e_plugin" + test-suite-path: "./test/functional_tests/e2e_plugin" - distribution: "k3s" multinamespace-mode: "true" - test-suite-path: "./test/e2e_isolation_mode" + test-suite-path: "./test/functional_tests/e2e_isolation_mode" steps: - name: Checkout repository @@ -380,7 +380,7 @@ jobs: uses: actions/download-artifact@v4 with: name: e2e-binaries - path: ./test + path: ./test/functional_tests # - name: Setup upterm session for debugging # uses: lhotari/action-upterm@v1 @@ -392,18 +392,18 @@ jobs: extraArgs=() if [ ${{ matrix.multinamespace-mode }} == "true" ]; then - extraArgs+=( -f ./test/multins_values.yaml ) + extraArgs+=( -f ./test/functional_tests/multins_values.yaml ) fi - if [ ${{ matrix.test-suite-path }} == "./test/e2e_metrics_proxy" ]; then + if [ ${{ matrix.test-suite-path }} == "./test/functional_tests/e2e_metrics_proxy" ]; then helm repo add metrics-server https://kubernetes-sigs.github.io/metrics-server/ helm upgrade --install metrics-server metrics-server/metrics-server --set args={--kubelet-insecure-tls} --set containerPort=4443 -n kube-system fi if [ ${{ matrix.ha }} == "true" ]; then - haValues="-f ./test/values_ha.yaml" + haValues="-f ./test/functional_tests/values_ha.yaml" fi - if [ ${{ matrix.test-suite-path }} == "./test/e2e_target_namespace" ]; then + if [ ${{ matrix.test-suite-path }} == "./test/functional_tests/e2e_target_namespace" ]; then kubectl apply -f ${{ matrix.test-suite-path }}/role.yaml fi @@ -422,7 +422,7 @@ jobs: --connect=false \ --distro=${{ matrix.distribution }} \ --local-chart-dir ./chart \ - -f ./test/commonValues.yaml \ + -f ./test/functional_tests/commonValues.yaml \ $haValues \ -f ${{ matrix.test-suite-path }}/values.yaml \ "${extraArgs[@]}" @@ -448,7 +448,7 @@ jobs: echo "======================================================================================================================" kubectl logs -l app=${{ env.VCLUSTER_SUFFIX }} -n ${{ env.VCLUSTER_NAMESPACE }} -c syncer --tail=-1 -p || kubectl logs -l app=${{ env.VCLUSTER_SUFFIX }} -n ${{ env.VCLUSTER_NAMESPACE }} -c syncer --tail=-1 echo "======================================================================================================================" - if [[ "${{ matrix.test-suite-path }}" = "./test/e2e_plugin" ]]; then + if [[ "${{ matrix.test-suite-path }}" = "./test/functional_tests/e2e_plugin" ]]; then kubectl logs -l app=${{ env.VCLUSTER_SUFFIX }} -n ${{ env.VCLUSTER_NAMESPACE }} -c bootstrap-with-deployment --tail=-1 -p || kubectl logs -l app=${{ env.VCLUSTER_SUFFIX }} -n ${{ env.VCLUSTER_NAMESPACE }} -c bootstrap-with-deployment --tail=-1 echo "======================================================================================================================" fi @@ -462,9 +462,9 @@ jobs: run: | set -x - sudo chmod +x $(echo "${{ matrix.test-suite-path }}" | sed "s#./test/##g").test + sudo chmod +x $(echo "${{ matrix.test-suite-path }}" | sed "s#./test/functional_tests/##g").test - VCLUSTER_SUFFIX=${{ env.VCLUSTER_SUFFIX }} VCLUSTER_NAME=${{ env.VCLUSTER_NAME }} VCLUSTER_NAMESPACE=${{ env.VCLUSTER_NAMESPACE }} MULTINAMESPACE_MODE=${{ matrix.multinamespace-mode }} ./$(echo "${{ matrix.test-suite-path }}" | sed "s#./test/##g").test -test.v --ginkgo.v --ginkgo.skip='.*NetworkPolicy.*' --ginkgo.fail-fast + VCLUSTER_SUFFIX=${{ env.VCLUSTER_SUFFIX }} VCLUSTER_NAME=${{ env.VCLUSTER_NAME }} VCLUSTER_NAMESPACE=${{ env.VCLUSTER_NAMESPACE }} MULTINAMESPACE_MODE=${{ matrix.multinamespace-mode }} ./$(echo "${{ matrix.test-suite-path }}" | sed "s#./test/functional_tests/##g").test -test.v --ginkgo.v --ginkgo.skip='.*NetworkPolicy.*' --ginkgo.fail-fast if kubectl logs -l app=${{ env.VCLUSTER_SUFFIX }} -n ${{ env.VCLUSTER_NAMESPACE }} -c syncer --tail=-1 -p >/dev/null 2>/dev/null; then echo "vCluster has restarted during testing, failing..." exit 1 diff --git a/Justfile b/Justfile index 423c30d2f0..52ec91b989 100644 --- a/Justfile +++ b/Justfile @@ -84,7 +84,7 @@ embed-chart version="0.0.0": RELEASE_VERSION={{ version }} go generate -tags embed_chart ./... # Run e2e tests -e2e distribution="k3s" path="./test/e2e" multinamespace="false": create-kind && delete-kind +e2e distribution="k3s" path="./test/functional_tests/e2e" multinamespace="false": create-kind && delete-kind echo "Execute test suites ({{ distribution }}, {{ path }}, {{ multinamespace }})" TELEMETRY_PRIVATE_KEY="" goreleaser build --snapshot --clean @@ -113,7 +113,7 @@ e2e distribution="k3s" path="./test/e2e" multinamespace="false": create-kind && --local-chart-dir ./chart/ \ -f ./dist/commonValues.yaml \ -f {{ path }}/values.yaml \ - $([[ "{{ multinamespace }}" = "true" ]] && echo "-f ./test/multins_values.yaml" || echo "") + $([[ "{{ multinamespace }}" = "true" ]] && echo "-f ./test/functional_tests/multins_values.yaml" || echo "") kubectl wait --for=condition=ready pod -l app=vcluster -n vcluster --timeout=300s diff --git a/devspace.yaml b/devspace.yaml index ed8a590b87..c112f687ee 100644 --- a/devspace.yaml +++ b/devspace.yaml @@ -6,9 +6,9 @@ vars: # Make sure vcluster is the default namespace DEVSPACE_FLAGS: "-n vcluster" SYNCER_IMAGE: ghcr.io/loft-sh/loft-enterprise/dev-vcluster - COMMON_VALUES: ./test/commonValues.yaml - PRO_VALUES: ./test/proValues.yaml - VALUES_FILE: ./test/e2e/values.yaml + COMMON_VALUES: ./test/functional_tests/commonValues.yaml + PRO_VALUES: ./test/functional_tests/proValues.yaml + VALUES_FILE: ./test/functional_tests/e2e/values.yaml # Images DevSpace will build for vcluster images: @@ -218,7 +218,7 @@ profiles: commands: # e.g. devspace run test k3s - # e.g. devspace run test k3s --var VALUES_FILE=./test/e2e_node + # e.g. devspace run test k3s --var VALUES_FILE=./test/functional_tests/e2e_node test: |- devspace purge -n ${DEVSPACE_NAMESPACE} --debug devspace dev -n ${DEVSPACE_NAMESPACE} --profile test-$@ diff --git a/hack/vcluster-install-scripts/test-helm-install.sh b/hack/vcluster-install-scripts/test-helm-install.sh index 0a80e5a1bc..16013c017a 100755 --- a/hack/vcluster-install-scripts/test-helm-install.sh +++ b/hack/vcluster-install-scripts/test-helm-install.sh @@ -5,7 +5,7 @@ VCLUSTER_NAME="${VCLUSTER_NAME}" VCLUSTER_NAMESPACE="${VCLUSTER_NAMESPACE}" POLL_INTERVAL=10 MAX_WAIT_TIME=180 -PATH_TO_VALUES_FILE="./test/commonValues.yaml" +PATH_TO_VALUES_FILE="./test/functional_tests/commonValues.yaml" HELM_CHART_DIR="./chart" if [ -z "$VCLUSTER_NAME" ]; then diff --git a/hack/vcluster-install-scripts/test-kubectl-install.sh b/hack/vcluster-install-scripts/test-kubectl-install.sh index 819e8bc1da..ef65361729 100755 --- a/hack/vcluster-install-scripts/test-kubectl-install.sh +++ b/hack/vcluster-install-scripts/test-kubectl-install.sh @@ -6,7 +6,7 @@ VCLUSTER_NAMESPACE="${VCLUSTER_NAMESPACE}" POLL_INTERVAL=10 MAX_WAIT_TIME=180 MANIFEST_FILE="vcluster-manifest.yaml" -PATH_TO_VALUES_FILE="./test/commonValues.yaml" +PATH_TO_VALUES_FILE="./test/functional_tests/commonValues.yaml" HELM_CHART_DIR="./chart" if [ -z "$VCLUSTER_NAME" ]; then diff --git a/test/deploy_changes/commonValues.yaml b/test/deploy_changes/commonValues.yaml new file mode 100644 index 0000000000..d5c1922623 --- /dev/null +++ b/test/deploy_changes/commonValues.yaml @@ -0,0 +1,45 @@ +sync: + toHost: + pods: + useSecretsForSATokens: true + fromHost: + nodes: + enabled: true + selector: + labels: + kubernetes.io/hostname: "kind-control-plane" +controlPlane: + backingStore: + etcd: + deploy: + statefulSet: + resources: + requests: + cpu: "0" + statefulSet: + image: + registry: "" + repository: REPLACE_REPOSITORY_NAME + tag: REPLACE_TAG_NAME + env: + - name: DEBUG + value: "true" + resources: + requests: + cpu: "0" +# values for general test suite +networking: + replicateServices: + toHost: + - from: test/test + to: test + - from: test/nginx + to: nginx + fromHost: + - from: test/test + to: default/test + - from: test/nginx + to: default/nginx +experimental: + syncSettings: + setOwner: true diff --git a/test/deploy_changes/deploy_changes.go b/test/deploy_changes/deploy_changes.go new file mode 100644 index 0000000000..4691a97f2c --- /dev/null +++ b/test/deploy_changes/deploy_changes.go @@ -0,0 +1,118 @@ +package deploychanges + +import ( + "bytes" + "log" + "os" + "os/exec" + "path/filepath" + "strings" + "time" + + "github.com/loft-sh/vcluster/cmd/vclusterctl/cmd" + "github.com/loft-sh/vcluster/pkg/cli/flags" + "github.com/loft-sh/vcluster/test/framework" + "github.com/onsi/ginkgo/v2" + "github.com/onsi/gomega" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + pollingInterval = time.Second * 2 + pollingDurationLong = time.Minute * 2 + filePath = "./deploy_changes/commonValues.yaml" +) + +var _ = ginkgo.Describe("Deploy changes to vCluster", func() { + f := framework.DefaultFramework + ginkgo.It("SDeploys new changes to vCluster", func() { + + ginkgo.By("Check if no Resource Quota is available") + _, err := f.HostClient.CoreV1().ResourceQuotas(f.VclusterNamespace).Get(f.Context, "vc-vcluster", metav1.GetOptions{}) + framework.ExpectError(err) + + ginkgo.By("Check if no Limit Range is available") + _, err = f.HostClient.CoreV1().LimitRanges(f.VclusterNamespace).Get(f.Context, "vc-vcluster", metav1.GetOptions{}) + framework.ExpectError(err) + + ginkgo.By("Check if no network policy is available") + _, err = f.HostClient.NetworkingV1().NetworkPolicies(f.VclusterNamespace).Get(f.Context, "vc-work-vcluster", metav1.GetOptions{}) + framework.ExpectError(err) + + var isolationParameters = []string{ + ".policies.resourceQuota.enabled = true", + ".policies.limitRange.enabled = true", + ".policies.networkPolicy.enabled = true", + } + + ginkgo.By("edit yaml to enable isolated workloads") + for _, expr := range isolationParameters { + stdout := &bytes.Buffer{} + stderr := &bytes.Buffer{} + cmdExec := exec.Command("yq", "e", "-i", expr, filePath) + cmdExec.Stdout = stdout + cmdExec.Stderr = stderr + err = cmdExec.Run() + log.Println("Upgrade command output: ", stdout.String()) + log.Println("Upgrade command error output: ", stderr.String()) + log.Println("err: ", err) + framework.ExpectNoError(err) + } + + replaceCmd := exec.Command("sed", "-i", "s|REPLACE_REPOSITORY_NAME|"+os.Getenv("REPOSITORY_NAME")+"|g", filePath) + err = replaceCmd.Run() + framework.ExpectNoError(err) + replaceCmd = exec.Command("sed", "-i", "s|REPLACE_TAG_NAME|"+os.Getenv("TAG_NAME")+"|g", filePath) + err = replaceCmd.Run() + framework.ExpectNoError(err) + + cwd, err := os.Getwd() + framework.ExpectNoError(err) + baseDir := filepath.Dir(filepath.Dir(cwd)) + chartPath := filepath.Join(baseDir, "chart") + + ginkgo.By("Deploy Changes") + gomega.Eventually(func() bool { + stdout := &bytes.Buffer{} + stderr := &bytes.Buffer{} + checkCmd := exec.Command("vcluster", "create", "--upgrade", f.VclusterName, "--namespace", f.VclusterNamespace, "--local-chart-dir", chartPath, "-f", filePath) + checkCmd.Stdout = stdout + checkCmd.Stderr = stderr + err := checkCmd.Run() + log.Println("Upgrade command output: ", stdout.String()) + log.Println("Upgrade command error output: ", stderr.String()) + log.Println("err: ", err) + framework.ExpectNoError(err) + return err == nil && strings.Contains(stdout.String(), "Switched active kube context to") + }).WithPolling(pollingInterval).WithTimeout(pollingDurationLong).Should(gomega.BeTrue()) + + ginkgo.By("Disconnect from vcluster") + disconnectCmd := cmd.NewDisconnectCmd(&flags.GlobalFlags{}) + disconnectCmd.SetArgs([]string{}) + + err = disconnectCmd.Execute() + if err != nil && !strings.Contains(err.Error(), "not a virtual cluster context") { + framework.ExpectNoError(err) + } + + ginkgo.By("Verify cluster is active") + gomega.Eventually(func() bool { + checkCmd := exec.Command("vcluster", "list") + output, err := checkCmd.CombinedOutput() + framework.ExpectNoError(err) + return err == nil && strings.Contains(string(output), f.VclusterName) && strings.Contains(string(output), "Running") + }).WithPolling(pollingInterval).WithTimeout(pollingDurationLong).Should(gomega.BeTrue()) + + ginkgo.By("Check if Resource Quota is available") + _, err = f.HostClient.CoreV1().ResourceQuotas(f.VclusterNamespace).Get(f.Context, "vc-"+f.VclusterName, metav1.GetOptions{}) + framework.ExpectNoError(err) + + ginkgo.By("Check if Limit Range is available") + _, err = f.HostClient.CoreV1().LimitRanges(f.VclusterNamespace).Get(f.Context, "vc-"+f.VclusterName, metav1.GetOptions{}) + framework.ExpectNoError(err) + + ginkgo.By("Check if network policy is available") + _, err = f.HostClient.NetworkingV1().NetworkPolicies(f.VclusterNamespace).Get(f.Context, "vc-work-"+f.VclusterName, metav1.GetOptions{}) + framework.ExpectNoError(err) + }) +}) diff --git a/test/deploy_changes/deploy_changes_suite_test.go b/test/deploy_changes/deploy_changes_suite_test.go new file mode 100644 index 0000000000..5d46e77c5d --- /dev/null +++ b/test/deploy_changes/deploy_changes_suite_test.go @@ -0,0 +1,41 @@ +package deploychanges + +import ( + "context" + "testing" + + "github.com/loft-sh/log" + "github.com/loft-sh/vcluster/test/framework" + "github.com/onsi/ginkgo/v2" + "github.com/onsi/gomega" + "k8s.io/apimachinery/pkg/runtime" + clientgoscheme "k8s.io/client-go/kubernetes/scheme" + + // Enable cloud provider auth + _ "k8s.io/client-go/plugin/pkg/client/auth" +) + +var ( + scheme = runtime.NewScheme() +) + +func init() { + _ = clientgoscheme.AddToScheme(scheme) +} + +func TestRunDeployChangesTests(t *testing.T) { + gomega.RegisterFailHandler(ginkgo.Fail) + err := framework.CreateFramework(context.Background(), scheme) + if err != nil { + log.GetInstance().Fatalf("Error setting up framework: %v", err) + } + + var _ = ginkgo.AfterSuite(func() { + err = framework.DefaultFramework.Cleanup() + if err != nil { + log.GetInstance().Warnf("Error executing testsuite cleanup: %v", err) + } + }) + + ginkgo.RunSpecs(t, "Vcluster Deploy changes suite") +} diff --git a/test/README.md b/test/functional_tests/README.md similarity index 85% rename from test/README.md rename to test/functional_tests/README.md index 83c0fbc51c..50d1884245 100644 --- a/test/README.md +++ b/test/functional_tests/README.md @@ -3,13 +3,13 @@ 1. Start test environment: - Start the vcluster in test mode `devspace run test ` - - To run the test from the a general test suite i.e from `./test/e2e`. + - To run the test from the a general test suite i.e from `./test/functional_tests/e2e`. `devspace --namespace vcluster run test k3s` - To run tests from a specific test suite, you'll need to specify the values file path from that test suite. - `devspace --namespace vcluster run test k3s --var VALUES_FILE=./test/e2e_node/values.yaml` + `devspace --namespace vcluster run test k3s --var VALUES_FILE=./test/functional_tests/e2e_node/values.yaml` - Then run following command in the terminal to start vcluster syncer. - To run default test suite start syncer with following command @@ -17,11 +17,11 @@ go run -mod vendor cmd/vcluster/main.go start --sync 'networkpolicies' --name=vcluster --service-account=vc-workload-vcluster --kube-config-context-name=my-vcluster --leader-elect=false --sync=nodes --sync=-ingressclasses --node-selector=kubernetes.io/hostname=kind-control-plane '--map-host-service=test/test=default/test' '--map-virtual-service=test/test=test' ``` - - To run tests from other test suites you'll need to change the flags for `go run -mod vendor cmd/vcluster/main.go start` accordingly. You can check the list of syncer flags by running `helm template vcluster ./charts/k3s/ -f ./test/commonValues.yaml -f ./test//values.yaml` + - To run tests from other test suites you'll need to change the flags for `go run -mod vendor cmd/vcluster/main.go start` accordingly. You can check the list of syncer flags by running `helm template vcluster ./charts/k3s/ -f ./test/functional_tests/commonValues.yaml -f ./test/functional_tests//values.yaml` For e.g. ``` - helm template vcluster ./charts/k3s/ -f ./test/commonValues.yaml -f ./test/e2e_target_namespace/values.yaml + helm template vcluster ./charts/k3s/ -f ./test/functional_tests/commonValues.yaml -f ./test/functional_tests/e2e_target_namespace/values.yaml # Then look for `name: syncer` container diff --git a/test/commonValues.yaml b/test/functional_tests/commonValues.yaml similarity index 100% rename from test/commonValues.yaml rename to test/functional_tests/commonValues.yaml diff --git a/test/e2e/coredns/coredns.go b/test/functional_tests/e2e/coredns/coredns.go similarity index 100% rename from test/e2e/coredns/coredns.go rename to test/functional_tests/e2e/coredns/coredns.go diff --git a/test/e2e/e2e_suite_test.go b/test/functional_tests/e2e/e2e_suite_test.go similarity index 71% rename from test/e2e/e2e_suite_test.go rename to test/functional_tests/e2e/e2e_suite_test.go index 1823f051d0..7b7e18bdf9 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/functional_tests/e2e/e2e_suite_test.go @@ -19,16 +19,16 @@ import ( _ "k8s.io/client-go/plugin/pkg/client/auth" // Register tests - _ "github.com/loft-sh/vcluster/test/e2e/coredns" - _ "github.com/loft-sh/vcluster/test/e2e/k8sdefaultendpoint" - _ "github.com/loft-sh/vcluster/test/e2e/manifests" - _ "github.com/loft-sh/vcluster/test/e2e/node" - _ "github.com/loft-sh/vcluster/test/e2e/servicesync" - _ "github.com/loft-sh/vcluster/test/e2e/syncer/networkpolicies" - _ "github.com/loft-sh/vcluster/test/e2e/syncer/pods" - _ "github.com/loft-sh/vcluster/test/e2e/syncer/pvc" - _ "github.com/loft-sh/vcluster/test/e2e/syncer/services" - _ "github.com/loft-sh/vcluster/test/e2e/webhook" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/coredns" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/k8sdefaultendpoint" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/manifests" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/node" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/servicesync" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/syncer/networkpolicies" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/syncer/pods" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/syncer/pvc" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/syncer/services" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/webhook" ) var ( diff --git a/test/e2e/k8sdefaultendpoint/k8sdefaultendpoint.go b/test/functional_tests/e2e/k8sdefaultendpoint/k8sdefaultendpoint.go similarity index 100% rename from test/e2e/k8sdefaultendpoint/k8sdefaultendpoint.go rename to test/functional_tests/e2e/k8sdefaultendpoint/k8sdefaultendpoint.go diff --git a/test/e2e/manifests/chart.go b/test/functional_tests/e2e/manifests/chart.go similarity index 100% rename from test/e2e/manifests/chart.go rename to test/functional_tests/e2e/manifests/chart.go diff --git a/test/e2e/manifests/init.go b/test/functional_tests/e2e/manifests/init.go similarity index 100% rename from test/e2e/manifests/init.go rename to test/functional_tests/e2e/manifests/init.go diff --git a/test/e2e/node/node.go b/test/functional_tests/e2e/node/node.go similarity index 100% rename from test/e2e/node/node.go rename to test/functional_tests/e2e/node/node.go diff --git a/test/e2e/servicesync/servicesync.go b/test/functional_tests/e2e/servicesync/servicesync.go similarity index 100% rename from test/e2e/servicesync/servicesync.go rename to test/functional_tests/e2e/servicesync/servicesync.go diff --git a/test/e2e/syncer/networkpolicies/networkpolicies.go b/test/functional_tests/e2e/syncer/networkpolicies/networkpolicies.go similarity index 100% rename from test/e2e/syncer/networkpolicies/networkpolicies.go rename to test/functional_tests/e2e/syncer/networkpolicies/networkpolicies.go diff --git a/test/e2e/syncer/pods/pods.go b/test/functional_tests/e2e/syncer/pods/pods.go similarity index 100% rename from test/e2e/syncer/pods/pods.go rename to test/functional_tests/e2e/syncer/pods/pods.go diff --git a/test/e2e/syncer/pvc/pvc.go b/test/functional_tests/e2e/syncer/pvc/pvc.go similarity index 100% rename from test/e2e/syncer/pvc/pvc.go rename to test/functional_tests/e2e/syncer/pvc/pvc.go diff --git a/test/e2e/syncer/services/services.go b/test/functional_tests/e2e/syncer/services/services.go similarity index 100% rename from test/e2e/syncer/services/services.go rename to test/functional_tests/e2e/syncer/services/services.go diff --git a/test/e2e/values.yaml b/test/functional_tests/e2e/values.yaml similarity index 100% rename from test/e2e/values.yaml rename to test/functional_tests/e2e/values.yaml diff --git a/test/e2e/webhook/cert.go b/test/functional_tests/e2e/webhook/cert.go similarity index 100% rename from test/e2e/webhook/cert.go rename to test/functional_tests/e2e/webhook/cert.go diff --git a/test/e2e/webhook/utiils.go b/test/functional_tests/e2e/webhook/utiils.go similarity index 100% rename from test/e2e/webhook/utiils.go rename to test/functional_tests/e2e/webhook/utiils.go diff --git a/test/e2e/webhook/webhook.go b/test/functional_tests/e2e/webhook/webhook.go similarity index 100% rename from test/e2e/webhook/webhook.go rename to test/functional_tests/e2e/webhook/webhook.go diff --git a/test/e2e_cli/connect/connect.go b/test/functional_tests/e2e_cli/connect/connect.go similarity index 100% rename from test/e2e_cli/connect/connect.go rename to test/functional_tests/e2e_cli/connect/connect.go diff --git a/test/e2e_cli/e2e_cli_suite_test.go b/test/functional_tests/e2e_cli/e2e_cli_suite_test.go similarity index 92% rename from test/e2e_cli/e2e_cli_suite_test.go rename to test/functional_tests/e2e_cli/e2e_cli_suite_test.go index 1c4f6a7026..3a7719d3bb 100644 --- a/test/e2e_cli/e2e_cli_suite_test.go +++ b/test/functional_tests/e2e_cli/e2e_cli_suite_test.go @@ -15,7 +15,7 @@ import ( _ "k8s.io/client-go/plugin/pkg/client/auth" // Register tests - _ "github.com/loft-sh/vcluster/test/e2e_cli/connect" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e_cli/connect" ) var ( diff --git a/test/e2e_cli/values.yaml b/test/functional_tests/e2e_cli/values.yaml similarity index 100% rename from test/e2e_cli/values.yaml rename to test/functional_tests/e2e_cli/values.yaml diff --git a/test/e2e_generic/clusterscope/ingressclasses.go b/test/functional_tests/e2e_generic/clusterscope/ingressclasses.go similarity index 100% rename from test/e2e_generic/clusterscope/ingressclasses.go rename to test/functional_tests/e2e_generic/clusterscope/ingressclasses.go diff --git a/test/e2e_generic/e2e_generic_suite_test.go b/test/functional_tests/e2e_generic/e2e_generic_suite_test.go similarity index 91% rename from test/e2e_generic/e2e_generic_suite_test.go rename to test/functional_tests/e2e_generic/e2e_generic_suite_test.go index 640b9fdb46..b349021dca 100644 --- a/test/e2e_generic/e2e_generic_suite_test.go +++ b/test/functional_tests/e2e_generic/e2e_generic_suite_test.go @@ -15,7 +15,7 @@ import ( _ "k8s.io/client-go/plugin/pkg/client/auth" // Register tests - _ "github.com/loft-sh/vcluster/test/e2e_generic/clusterscope" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e_generic/clusterscope" ) var ( diff --git a/test/e2e_generic/values.yaml b/test/functional_tests/e2e_generic/values.yaml similarity index 100% rename from test/e2e_generic/values.yaml rename to test/functional_tests/e2e_generic/values.yaml diff --git a/test/e2e_isolation_mode/e2e_isolation_mode_test.go b/test/functional_tests/e2e_isolation_mode/e2e_isolation_mode_test.go similarity index 69% rename from test/e2e_isolation_mode/e2e_isolation_mode_test.go rename to test/functional_tests/e2e_isolation_mode/e2e_isolation_mode_test.go index 7bfc9e4796..103d2b3f08 100644 --- a/test/e2e_isolation_mode/e2e_isolation_mode_test.go +++ b/test/functional_tests/e2e_isolation_mode/e2e_isolation_mode_test.go @@ -19,17 +19,17 @@ import ( _ "k8s.io/client-go/plugin/pkg/client/auth" // Register tests - _ "github.com/loft-sh/vcluster/test/e2e/coredns" - _ "github.com/loft-sh/vcluster/test/e2e/k8sdefaultendpoint" - _ "github.com/loft-sh/vcluster/test/e2e/manifests" - _ "github.com/loft-sh/vcluster/test/e2e/node" - _ "github.com/loft-sh/vcluster/test/e2e/servicesync" - _ "github.com/loft-sh/vcluster/test/e2e/syncer/networkpolicies" - _ "github.com/loft-sh/vcluster/test/e2e/syncer/pods" - _ "github.com/loft-sh/vcluster/test/e2e/syncer/pvc" - _ "github.com/loft-sh/vcluster/test/e2e/syncer/services" - _ "github.com/loft-sh/vcluster/test/e2e/webhook" - _ "github.com/loft-sh/vcluster/test/e2e_isolation_mode/isolation" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/coredns" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/k8sdefaultendpoint" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/manifests" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/node" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/servicesync" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/syncer/networkpolicies" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/syncer/pods" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/syncer/pvc" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/syncer/services" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/webhook" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e_isolation_mode/isolation" ) var ( diff --git a/test/e2e_isolation_mode/isolation/isolated.go b/test/functional_tests/e2e_isolation_mode/isolation/isolated.go similarity index 100% rename from test/e2e_isolation_mode/isolation/isolated.go rename to test/functional_tests/e2e_isolation_mode/isolation/isolated.go diff --git a/test/e2e_isolation_mode/values.yaml b/test/functional_tests/e2e_isolation_mode/values.yaml similarity index 100% rename from test/e2e_isolation_mode/values.yaml rename to test/functional_tests/e2e_isolation_mode/values.yaml diff --git a/test/e2e_metrics_proxy/e2e_metrics_proxy_test.go b/test/functional_tests/e2e_metrics_proxy/e2e_metrics_proxy_test.go similarity index 95% rename from test/e2e_metrics_proxy/e2e_metrics_proxy_test.go rename to test/functional_tests/e2e_metrics_proxy/e2e_metrics_proxy_test.go index 99cfdcb554..272bcc34e5 100644 --- a/test/e2e_metrics_proxy/e2e_metrics_proxy_test.go +++ b/test/functional_tests/e2e_metrics_proxy/e2e_metrics_proxy_test.go @@ -19,7 +19,7 @@ import ( _ "k8s.io/client-go/plugin/pkg/client/auth" // Register tests - _ "github.com/loft-sh/vcluster/test/e2e_metrics_proxy/metricsproxy" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e_metrics_proxy/metricsproxy" ) var ( diff --git a/test/e2e_metrics_proxy/metricsproxy/metrics_proxy.go b/test/functional_tests/e2e_metrics_proxy/metricsproxy/metrics_proxy.go similarity index 100% rename from test/e2e_metrics_proxy/metricsproxy/metrics_proxy.go rename to test/functional_tests/e2e_metrics_proxy/metricsproxy/metrics_proxy.go diff --git a/test/e2e_metrics_proxy/values.yaml b/test/functional_tests/e2e_metrics_proxy/values.yaml similarity index 100% rename from test/e2e_metrics_proxy/values.yaml rename to test/functional_tests/e2e_metrics_proxy/values.yaml diff --git a/test/e2e_node/e2e_node_suite_test.go b/test/functional_tests/e2e_node/e2e_node_suite_test.go similarity index 71% rename from test/e2e_node/e2e_node_suite_test.go rename to test/functional_tests/e2e_node/e2e_node_suite_test.go index 3ffb0c9940..1529d1f830 100644 --- a/test/e2e_node/e2e_node_suite_test.go +++ b/test/functional_tests/e2e_node/e2e_node_suite_test.go @@ -19,16 +19,16 @@ import ( _ "k8s.io/client-go/plugin/pkg/client/auth" // Register tests - _ "github.com/loft-sh/vcluster/test/e2e/coredns" - _ "github.com/loft-sh/vcluster/test/e2e/k8sdefaultendpoint" - _ "github.com/loft-sh/vcluster/test/e2e/manifests" - _ "github.com/loft-sh/vcluster/test/e2e/servicesync" - _ "github.com/loft-sh/vcluster/test/e2e/syncer/networkpolicies" - _ "github.com/loft-sh/vcluster/test/e2e/syncer/pods" - _ "github.com/loft-sh/vcluster/test/e2e/syncer/pvc" - _ "github.com/loft-sh/vcluster/test/e2e/syncer/services" - _ "github.com/loft-sh/vcluster/test/e2e/webhook" - _ "github.com/loft-sh/vcluster/test/e2e_node/node" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/coredns" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/k8sdefaultendpoint" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/manifests" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/servicesync" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/syncer/networkpolicies" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/syncer/pods" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/syncer/pvc" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/syncer/services" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/webhook" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e_node/node" ) var ( diff --git a/test/e2e_node/node/node.go b/test/functional_tests/e2e_node/node/node.go similarity index 100% rename from test/e2e_node/node/node.go rename to test/functional_tests/e2e_node/node/node.go diff --git a/test/e2e_node/values.yaml b/test/functional_tests/e2e_node/values.yaml similarity index 100% rename from test/e2e_node/values.yaml rename to test/functional_tests/e2e_node/values.yaml diff --git a/test/e2e_pause_resume/e2e_pause_resume_vcluster_test.go b/test/functional_tests/e2e_pause_resume/e2e_pause_resume_vcluster_test.go similarity index 95% rename from test/e2e_pause_resume/e2e_pause_resume_vcluster_test.go rename to test/functional_tests/e2e_pause_resume/e2e_pause_resume_vcluster_test.go index db6eb3bf76..5fc91edf78 100644 --- a/test/e2e_pause_resume/e2e_pause_resume_vcluster_test.go +++ b/test/functional_tests/e2e_pause_resume/e2e_pause_resume_vcluster_test.go @@ -15,7 +15,7 @@ import ( _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" - _ "github.com/loft-sh/vcluster/test/e2e_pause_resume/pauseresume" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e_pause_resume/pauseresume" // Enable cloud provider auth _ "k8s.io/client-go/plugin/pkg/client/auth" diff --git a/test/e2e_pause_resume/pauseresume/vcluster.go b/test/functional_tests/e2e_pause_resume/pauseresume/vcluster.go similarity index 100% rename from test/e2e_pause_resume/pauseresume/vcluster.go rename to test/functional_tests/e2e_pause_resume/pauseresume/vcluster.go diff --git a/test/e2e_pause_resume/values.yaml b/test/functional_tests/e2e_pause_resume/values.yaml similarity index 100% rename from test/e2e_pause_resume/values.yaml rename to test/functional_tests/e2e_pause_resume/values.yaml diff --git a/test/e2e_plugin/e2e_plugin_suite_test.go b/test/functional_tests/e2e_plugin/e2e_plugin_suite_test.go similarity index 96% rename from test/e2e_plugin/e2e_plugin_suite_test.go rename to test/functional_tests/e2e_plugin/e2e_plugin_suite_test.go index e7bdf33c03..e9fb9d6134 100644 --- a/test/e2e_plugin/e2e_plugin_suite_test.go +++ b/test/functional_tests/e2e_plugin/e2e_plugin_suite_test.go @@ -15,7 +15,7 @@ import ( _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" - _ "github.com/loft-sh/vcluster/test/e2e_plugin/plugin" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e_plugin/plugin" // Enable cloud provider auth _ "k8s.io/client-go/plugin/pkg/client/auth" diff --git a/test/e2e_plugin/plugin/plugin.go b/test/functional_tests/e2e_plugin/plugin/plugin.go similarity index 100% rename from test/e2e_plugin/plugin/plugin.go rename to test/functional_tests/e2e_plugin/plugin/plugin.go diff --git a/test/e2e_plugin/values.yaml b/test/functional_tests/e2e_plugin/values.yaml similarity index 100% rename from test/e2e_plugin/values.yaml rename to test/functional_tests/e2e_plugin/values.yaml diff --git a/test/e2e_rootless/e2e_rootless_mode_suite_test.go b/test/functional_tests/e2e_rootless/e2e_rootless_mode_suite_test.go similarity index 69% rename from test/e2e_rootless/e2e_rootless_mode_suite_test.go rename to test/functional_tests/e2e_rootless/e2e_rootless_mode_suite_test.go index cf683775b7..903c0dbe39 100644 --- a/test/e2e_rootless/e2e_rootless_mode_suite_test.go +++ b/test/functional_tests/e2e_rootless/e2e_rootless_mode_suite_test.go @@ -19,17 +19,17 @@ import ( _ "k8s.io/client-go/plugin/pkg/client/auth" // Register tests - _ "github.com/loft-sh/vcluster/test/e2e/coredns" - _ "github.com/loft-sh/vcluster/test/e2e/k8sdefaultendpoint" - _ "github.com/loft-sh/vcluster/test/e2e/manifests" - _ "github.com/loft-sh/vcluster/test/e2e/node" - _ "github.com/loft-sh/vcluster/test/e2e/servicesync" - _ "github.com/loft-sh/vcluster/test/e2e/syncer/networkpolicies" - _ "github.com/loft-sh/vcluster/test/e2e/syncer/pods" - _ "github.com/loft-sh/vcluster/test/e2e/syncer/pvc" - _ "github.com/loft-sh/vcluster/test/e2e/syncer/services" - _ "github.com/loft-sh/vcluster/test/e2e/webhook" - _ "github.com/loft-sh/vcluster/test/e2e_rootless/rootless" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/coredns" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/k8sdefaultendpoint" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/manifests" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/node" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/servicesync" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/syncer/networkpolicies" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/syncer/pods" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/syncer/pvc" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/syncer/services" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/webhook" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e_rootless/rootless" ) var ( diff --git a/test/e2e_rootless/rootless/rootlessmode.go b/test/functional_tests/e2e_rootless/rootless/rootlessmode.go similarity index 100% rename from test/e2e_rootless/rootless/rootlessmode.go rename to test/functional_tests/e2e_rootless/rootless/rootlessmode.go diff --git a/test/e2e_rootless/values.yaml b/test/functional_tests/e2e_rootless/values.yaml similarity index 100% rename from test/e2e_rootless/values.yaml rename to test/functional_tests/e2e_rootless/values.yaml diff --git a/test/e2e_scheduler/e2e_scheduler_suite_test.go b/test/functional_tests/e2e_scheduler/e2e_scheduler_suite_test.go similarity index 71% rename from test/e2e_scheduler/e2e_scheduler_suite_test.go rename to test/functional_tests/e2e_scheduler/e2e_scheduler_suite_test.go index 16adb50396..7507c4100c 100644 --- a/test/e2e_scheduler/e2e_scheduler_suite_test.go +++ b/test/functional_tests/e2e_scheduler/e2e_scheduler_suite_test.go @@ -19,16 +19,16 @@ import ( _ "k8s.io/client-go/plugin/pkg/client/auth" // Register tests - _ "github.com/loft-sh/vcluster/test/e2e/coredns" - _ "github.com/loft-sh/vcluster/test/e2e/k8sdefaultendpoint" - _ "github.com/loft-sh/vcluster/test/e2e/manifests" - _ "github.com/loft-sh/vcluster/test/e2e/servicesync" - _ "github.com/loft-sh/vcluster/test/e2e/syncer/networkpolicies" - _ "github.com/loft-sh/vcluster/test/e2e/syncer/pods" - _ "github.com/loft-sh/vcluster/test/e2e/syncer/pvc" - _ "github.com/loft-sh/vcluster/test/e2e/syncer/services" - _ "github.com/loft-sh/vcluster/test/e2e/webhook" - _ "github.com/loft-sh/vcluster/test/e2e_scheduler/scheduler" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/coredns" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/k8sdefaultendpoint" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/manifests" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/servicesync" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/syncer/networkpolicies" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/syncer/pods" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/syncer/pvc" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/syncer/services" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e/webhook" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e_scheduler/scheduler" ) var ( diff --git a/test/e2e_scheduler/scheduler/scheduler.go b/test/functional_tests/e2e_scheduler/scheduler/scheduler.go similarity index 100% rename from test/e2e_scheduler/scheduler/scheduler.go rename to test/functional_tests/e2e_scheduler/scheduler/scheduler.go diff --git a/test/e2e_scheduler/scheduler/waitforfirstconsumer.go b/test/functional_tests/e2e_scheduler/scheduler/waitforfirstconsumer.go similarity index 100% rename from test/e2e_scheduler/scheduler/waitforfirstconsumer.go rename to test/functional_tests/e2e_scheduler/scheduler/waitforfirstconsumer.go diff --git a/test/e2e_scheduler/values.yaml b/test/functional_tests/e2e_scheduler/values.yaml similarity index 100% rename from test/e2e_scheduler/values.yaml rename to test/functional_tests/e2e_scheduler/values.yaml diff --git a/test/e2e_target_namespace/e2e_target_namespace_test.go b/test/functional_tests/e2e_target_namespace/e2e_target_namespace_test.go similarity index 95% rename from test/e2e_target_namespace/e2e_target_namespace_test.go rename to test/functional_tests/e2e_target_namespace/e2e_target_namespace_test.go index eb41b07caa..d1345035a4 100644 --- a/test/e2e_target_namespace/e2e_target_namespace_test.go +++ b/test/functional_tests/e2e_target_namespace/e2e_target_namespace_test.go @@ -16,7 +16,7 @@ import ( apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" // Enable cloud provider auth - _ "github.com/loft-sh/vcluster/test/e2e_target_namespace/targetnamespace" + _ "github.com/loft-sh/vcluster/test/functional_tests/e2e_target_namespace/targetnamespace" _ "k8s.io/client-go/plugin/pkg/client/auth" // Register tests ) diff --git a/test/e2e_target_namespace/role.yaml b/test/functional_tests/e2e_target_namespace/role.yaml similarity index 100% rename from test/e2e_target_namespace/role.yaml rename to test/functional_tests/e2e_target_namespace/role.yaml diff --git a/test/e2e_target_namespace/targetnamespace/target_namespace.go b/test/functional_tests/e2e_target_namespace/targetnamespace/target_namespace.go similarity index 100% rename from test/e2e_target_namespace/targetnamespace/target_namespace.go rename to test/functional_tests/e2e_target_namespace/targetnamespace/target_namespace.go diff --git a/test/e2e_target_namespace/values.yaml b/test/functional_tests/e2e_target_namespace/values.yaml similarity index 100% rename from test/e2e_target_namespace/values.yaml rename to test/functional_tests/e2e_target_namespace/values.yaml diff --git a/test/multins_values.yaml b/test/functional_tests/multins_values.yaml similarity index 100% rename from test/multins_values.yaml rename to test/functional_tests/multins_values.yaml diff --git a/test/proValues.yaml b/test/functional_tests/proValues.yaml similarity index 100% rename from test/proValues.yaml rename to test/functional_tests/proValues.yaml diff --git a/test/values_ha.yaml b/test/functional_tests/values_ha.yaml similarity index 100% rename from test/values_ha.yaml rename to test/functional_tests/values_ha.yaml