From ae276a4d2fcd636727294ee2c2ba34e1ccb906af Mon Sep 17 00:00:00 2001 From: Oleksandr Andriienko Date: Wed, 28 Jul 2021 16:34:44 +0300 Subject: [PATCH] build: Remove redundant check. Pass tests on image build. Remove test execution on make file image build. (#970) * Remove redudant check. Pass tests on image build. Remove test execution on make file image build. Signed-off-by: Oleksandr Andriienko --- Dockerfile | 4 ++++ Makefile | 2 +- controllers/che/checluster_controller_test.go | 23 ------------------- 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/Dockerfile b/Dockerfile index ad77e9027..02c0bb31c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,9 +39,13 @@ COPY controllers/ controllers/ COPY templates/ templates/ COPY pkg/ pkg/ COPY vendor/ vendor/ +COPY mocks/ mocks/ +COPY config/ config/ # build operator RUN export ARCH="$(uname -m)" && if [[ ${ARCH} == "x86_64" ]]; then export ARCH="amd64"; elif [[ ${ARCH} == "aarch64" ]]; then export ARCH="arm64"; fi && \ + export MOCK_API=true && \ + go test -mod=vendor -v ./... && \ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -mod=vendor -a -o che-operator main.go RUN unzip /tmp/asset-devworkspace-operator.zip */deploy/deployment/* -d /tmp && \ diff --git a/Makefile b/Makefile index fadafb66e..a196baed3 100644 --- a/Makefile +++ b/Makefile @@ -284,7 +284,7 @@ run: manifests generate fmt vet ## Run a controller from your host. IMAGE_TOOL=docker -docker-build: test ## Build docker image with the manager. +docker-build: ## Build docker image with the manager. ${IMAGE_TOOL} build -t ${IMG} . docker-push: ## Push docker image with the manager. diff --git a/controllers/che/checluster_controller_test.go b/controllers/che/checluster_controller_test.go index acbf97287..4604372bd 100644 --- a/controllers/che/checluster_controller_test.go +++ b/controllers/che/checluster_controller_test.go @@ -110,19 +110,6 @@ var ( Package: "kubernetes-imagepuller-operator", }, } - wrongSubscription = &operatorsv1alpha1.Subscription{ - ObjectMeta: metav1.ObjectMeta{ - Name: "kubernetes-imagepuller-operator", - Namespace: namespace, - }, - Spec: &operatorsv1alpha1.SubscriptionSpec{ - CatalogSource: "community-operators", - Channel: "beta", - CatalogSourceNamespace: "olm", - InstallPlanApproval: operatorsv1alpha1.ApprovalAutomatic, - Package: "kubernetes-imagepuller-operator", - }, - } valueTrue = true clusterServiceVersion = &operatorsv1alpha1.ClusterServiceVersion{ ObjectMeta: metav1.ObjectMeta{ @@ -654,16 +641,6 @@ func TestImagePullerConfiguration(t *testing.T) { }, expectedSubscription: subscription, }, - { - name: "image puller enabled, subscription created but has changed, should update subscription, this shouldn't happen", - initCR: InitCheCRWithImagePullerEnabled(), - initObjects: []runtime.Object{ - packageManifest, - operatorGroup, - wrongSubscription, - }, - expectedSubscription: subscription, - }, { name: "image puller enabled, subscription created, should add finalizer", initCR: InitCheCRWithImagePullerEnabled(),