From cf853bb7ae5f9a926313f42ccc7820c7c18e16af Mon Sep 17 00:00:00 2001 From: Yeray Borges Date: Thu, 25 Apr 2024 13:26:21 +0100 Subject: [PATCH] Test github actions --- .github/workflows/go.yml | 2 +- Makefile | 4 ++-- config/manager/kustomization.yaml | 2 +- test/e2e/suite_test.go | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 3caf94318..c0dedcfe1 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -35,7 +35,7 @@ jobs: minikube image load --pull=true quay.io/wildfly-quickstarts/wildfly-operator-quickstart:bootable-21.0 minikube image load --pull=true quay.io/wildfly-quickstarts/clusterbench:latest - name: Containerized End-to-End Tests - run: eval $(minikube -p minikube docker-env) && make test-e2e-minikube + run: minikube addons enable registry && make test-e2e-minikube - name: Docker Login to Quay.io (main only) uses: docker/login-action@v3.0.0 if: github.ref == 'refs/heads/main' diff --git a/Makefile b/Makefile index 6309850b7..9def3ef01 100644 --- a/Makefile +++ b/Makefile @@ -130,7 +130,7 @@ test-e2e: prepare-test-e2e run-test-e2e ## Run E2E tests running the Operator as ## Run E2E tests running the Operator as a Deployment inside a local minikube cluster installation. .PHONY: test-e2e-minikube test-e2e-minikube: prepare-test-e2e - docker run -d -p 5000:5000 --restart=always --name image-registry registry || true + docker run --rm -it --network=host alpine ash -c "apk add socat && socat TCP-LISTEN:5000,reuseaddr,fork TCP:$(minikube ip):5000" IMG="localhost:5000/wildfly-operator:latest" make docker-build docker-push run-test-e2e .PHONY: prepare-test-e2e @@ -142,7 +142,7 @@ run-test-e2e: $(KUSTOMIZE) build config/rbac | kubectl apply -f - mkdir -p dry-run $(KUSTOMIZE) build config/tests > dry-run/test-resources.yaml - LOCAL_MANAGER=0 go test -timeout 20m -v ./test/e2e/... -coverprofile cover.out + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" LOCAL_MANAGER=0 go test -timeout 20m -v ./test/e2e/... -coverprofile cover.out $(KUSTOMIZE) build config/rbac | kubectl delete --ignore-not-found=true -f - .PHONY: clean diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 88fed04c0..1c2d9c0d1 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -12,5 +12,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization images: - name: controller - newName: quay.io/wildfly/wildfly-operator + newName: localhost:5000/wildfly-operator newTag: latest diff --git a/test/e2e/suite_test.go b/test/e2e/suite_test.go index 1fb9eedb7..960984bc5 100644 --- a/test/e2e/suite_test.go +++ b/test/e2e/suite_test.go @@ -27,7 +27,6 @@ import ( wildflyv1alpha1 "github.com/wildfly/wildfly-operator/api/v1alpha1" "github.com/wildfly/wildfly-operator/controllers" "io" - "io/ioutil" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" rbacv1 "k8s.io/api/rbac/v1" @@ -38,6 +37,7 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" "k8s.io/utils/pointer" + "k8s.io/utils/ptr" "log" "os" "path/filepath" @@ -94,7 +94,7 @@ var _ = BeforeSuite(func() { log.Printf("Start testing deploying the Operator") testEnv = &envtest.Environment{ - UseExistingCluster: pointer.BoolPtr(true), + UseExistingCluster: ptr.To(true), CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")}, CRDInstallOptions: envtest.CRDInstallOptions{CleanUpAfterUse: true}, ErrorIfCRDPathMissing: true, @@ -104,7 +104,7 @@ var _ = BeforeSuite(func() { cfg, k8sClient = initialSetup() // load resources for tests generated by kustomize - data, err := ioutil.ReadFile("../../dry-run/test-resources.yaml") + data, err := os.ReadFile("../../dry-run/test-resources.yaml") if err != nil { log.Fatal(err) }