Skip to content

Commit 5320294

Browse files
committed
fix kind-cluster-config
1 parent 18c4704 commit 5320294

File tree

2 files changed

+14
-31
lines changed

2 files changed

+14
-31
lines changed

Makefile

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ VERSION ?= 0.1.0
99
IMG ?= cr.yandex/yc/ydb-operator:latest
1010
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
1111
ENVTEST_K8S_VERSION = 1.26
12+
# Image URL which uses in tests
13+
YDB_IMAGE ?= $(shell grep "anchor_for_fetching_image_from_workflow" ./tests/**/*.go | grep -o -E '"cr\.yandex.*"' | tr -d '"')
1214

1315
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
1416
ifeq (,$(shell go env GOBIN))
@@ -66,32 +68,28 @@ vet: ## Run go vet against code.
6668
kind-init:
6769
if kind get clusters | grep "kind-ydb-operator"; then exit 0; fi; \
6870
kind create cluster \
69-
--config e2e/kind-cluster-config.yaml \
71+
--config tests/cfg/kind-cluster-config.yaml \
7072
--image=kindest/node:v1.31.2@sha256:18fbefc20a7113353c7b75b5c869d7145a6abd6269154825872dc59c1329912e \
71-
--name kind-ydb-operator; \
72-
docker pull k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0; \
73-
kind load docker-image k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0 --nodes kind-worker,kind-worker2,kind-worker3 --name kind-ydb-operator; \
74-
YDB_IMAGE=$(grep "anchor_for_fetching_image_from_workflow" ./tests/**/*.go | grep -o -E '"cr\.yandex.*"'); \
75-
YDB_IMAGE=${YDB_IMAGE:1:-1}; \
76-
docker pull ${YDB_IMAGE}; \
77-
kind load docker-image ${YDB_IMAGE} --nodes kind-worker,kind-worker2,kind-worker3 --name kind-ydb-operator;
73+
--name kind-ydb-operator
74+
docker pull k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0
75+
kind load docker-image k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0 --name kind-ydb-operator
76+
docker pull ${YDB_IMAGE}
77+
kind load docker-image ${YDB_IMAGE} --name kind-ydb-operator
7878

7979
kind-load:
80-
docker tag cr.yandex/yc/ydb-operator:latest kind/ydb-operator:current
81-
kind load docker-image kind/ydb-operator:current --nodes kind-worker,kind-worker2,kind-worker3 --name kind-ydb-operator
80+
docker tag ${IMG} kind/ydb-operator:current
81+
kind load docker-image kind/ydb-operator:current --name kind-ydb-operator
8282

8383
opts ?= ''
8484

8585
.PHONY: unit-test
86-
unit-test: manifests generate fmt vet gotestsum envtest ## Run unit tests
86+
unit-test: manifests generate fmt vet envtest ## Run unit tests
8787
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use --arch=amd64 $(ENVTEST_K8S_VERSION) -p path)" \
88-
$(GOTESTSUM) --format testname --jsonfile log.json -- -v -timeout 900s -p 1 ./internal/... -ginkgo.vv -coverprofile cover.out $(opts)
89-
jq -r '.Output| gsub("[\\n]"; "")' log.json 2>/dev/null 1>log.txt || true
88+
go test -v -timeout 900s -p 1 ./internal/... -ginkgo.vv -coverprofile cover.out $(opts)
9089

9190
.PHONY: e2e-test
92-
e2e-test: manifests generate fmt vet gotestsum docker-build kind-init kind-load ## Run e2e tests
93-
$(GOTESTSUM) --format testname --jsonfile log.json -- -v -timeout 3600s -p 1 ./tests/e2e/... -ginkgo.vv $(opts)
94-
jq -r '.Output| gsub("[\\n]"; "")' log.json 2>/dev/null 1>log.txt || true
91+
e2e-test: manifests generate fmt vet docker-build kind-init kind-load ## Run e2e tests
92+
go test -v -timeout 3600s -p 1 ./tests/e2e/... -ginkgo.vv $(opts)
9593

9694
.PHONY: test
9795
test: unit-test e2e-test ## Run all tests
@@ -124,11 +122,6 @@ ENVTEST_VERSION ?= release-0.17
124122
envtest: ## Download envtest-setup locally if necessary.
125123
$(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@$(ENVTEST_VERSION))
126124

127-
GOTESTSUM = $(shell pwd)/bin/gotestsum
128-
GOTESTSUM_VERSION ?= v1.12.0
129-
gotestsum: ## Download gotestsum locally if necessary.
130-
$(call go-get-tool,$(ENVTEST),gotest.tools/gotestsum@$(GOTESTSUM_VERSION))
131-
132125
# go-get-tool will 'go install' any package $2 and install it to $1.
133126
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
134127
define go-get-tool

tests/cfg/kind-cluster-config.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,11 @@ nodes:
1414
worker: true
1515

1616
- role: worker
17-
extraPortMappings:
18-
- containerPort: 30001
19-
hostPort: 2135
20-
listenAddress: "127.0.0.1"
21-
protocol: tcp
2217
labels:
2318
topology.kubernetes.io/zone: az-2
2419
worker: true
2520

2621
- role: worker
27-
extraPortMappings:
28-
- containerPort: 30001
29-
hostPort: 2135
30-
listenAddress: "127.0.0.1"
31-
protocol: tcp
3222
labels:
3323
topology.kubernetes.io/zone: az-3
3424
worker: true

0 commit comments

Comments
 (0)