Skip to content

Commit 1d7b885

Browse files
authored
(testing): Update testdata generation and testing logic (#4)
Signed-off-by: Bryce Palmer <[email protected]>
1 parent ab43854 commit 1d7b885

File tree

167 files changed

+3190
-2041
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+3190
-2041
lines changed

Makefile

+8-26
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ SHELL = /bin/bash
66
# version is moved to a separate repo and release process.
77
export IMAGE_VERSION = v1.31.0
88
# Build-time variables to inject into binaries
9-
export SIMPLE_VERSION = $(shell (test "$(shell git describe --tags)" = "$(shell git describe --tags --abbrev=0)" && echo $(shell git describe --tags)) || echo $(shell git describe --tags --abbrev=0)+git)
10-
export GIT_VERSION = $(shell git describe --dirty --tags --always)
11-
export GIT_COMMIT = $(shell git rev-parse HEAD)
9+
# export SIMPLE_VERSION = $(shell (test "$(shell git describe --tags)" = "$(shell git describe --tags --abbrev=0)" && echo $(shell git describe --tags)) || echo $(shell git describe --tags --abbrev=0)+git)
10+
# export GIT_VERSION = $(shell git describe --dirty --tags --always)
11+
# export GIT_COMMIT = $(shell git rev-parse HEAD)
1212
export K8S_VERSION = 1.26.0
1313

14-
export OPERATOR_SDK_VERSION = $(IMAGE_VERSION)
15-
1614
# Build settings
1715
export TOOLS_DIR = tools/bin
1816
export SCRIPTS_DIR = tools/scripts
@@ -37,9 +35,9 @@ export PATH := $(PWD)/$(BUILD_DIR):$(PWD)/$(TOOLS_DIR):$(PATH)
3735
##@ Development
3836

3937
.PHONY: generate
40-
generate: operator-sdk build # Generate CLI docs and samples
38+
generate: build # Generate CLI docs and samples
4139
rm -rf testdata
42-
go run ./hack/generate/samples/generate_testdata.go --bin $(OPERATOR_SDK)
40+
go run ./hack/generate/samples/generate_testdata.go
4341
go generate ./...
4442

4543
.PHONY: fix
@@ -142,11 +140,12 @@ e2e_targets := test-e2e $(e2e_tests)
142140
export KIND_CLUSTER := osdk-test
143141

144142
KUBEBUILDER_ASSETS = $(PWD)/$(shell go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest && $(shell go env GOPATH)/bin/setup-envtest use $(K8S_VERSION) --bin-dir tools/bin/ -p path)
145-
test-e2e-setup:: operator-sdk build dev-install cluster-create
143+
test-e2e-setup:: build dev-install cluster-create
146144

147145
.PHONY: cluster-create
148146
cluster-create::
149147
[[ "`$(TOOLS_DIR)/kind get clusters`" =~ "$(KIND_CLUSTER)" ]] || $(TOOLS_DIR)/kind create cluster --image="kindest/node:v$(K8S_VERSION)" --name $(KIND_CLUSTER)
148+
$(TOOLS_DIR)/kind export kubeconfig --name $(KIND_CLUSTER)
150149

151150
.PHONY: dev-install
152151
dev-install::
@@ -164,29 +163,12 @@ test-e2e-teardown:
164163
$(e2e_targets):: test-e2e-setup
165164
test-e2e:: $(e2e_tests) ## Run e2e tests
166165

167-
test-e2e-ansible:: operator-sdk image/ansible-operator ## Run Ansible e2e tests
168-
go test -count=1 ./internal/ansible/proxy/...
166+
test-e2e-ansible:: image/ansible-operator ## Run Ansible e2e tests
169167
go test ./test/e2e/ansible -v -ginkgo.v
170168
test-e2e-ansible-molecule:: install dev-install image/ansible-operator ## Run molecule-based Ansible e2e tests
171169
go run ./hack/generate/samples/molecule/generate.go
172170
./hack/tests/e2e-ansible-molecule.sh
173171

174-
## Location to install dependencies to
175-
LOCALBIN ?= $(shell pwd)/bin
176-
$(LOCALBIN):
177-
mkdir -p $(LOCALBIN)
178-
179-
.PHONY: operator-sdk
180-
OPERATOR_SDK ?= $(LOCALBIN)/operator-sdk
181-
operator-sdk: ## Download operator-sdk locally if necessary.
182-
@{ \
183-
set -e ;\
184-
mkdir -p $(dir $(OPERATOR_SDK)) ;\
185-
OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
186-
curl -sSLo $(OPERATOR_SDK) https://github.com/operator-framework/operator-sdk/releases/download/$(OPERATOR_SDK_VERSION)/operator-sdk_$${OS}_$${ARCH} ;\
187-
chmod +x $(OPERATOR_SDK) ;\
188-
}
189-
190172
.DEFAULT_GOAL := help
191173
.PHONY: help
192174
help: ## Show this help screen.

go.mod

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ require (
88
github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2
99
github.com/onsi/ginkgo/v2 v2.7.0
1010
github.com/onsi/gomega v1.24.2
11-
github.com/operator-framework/api v0.17.4-0.20230223191600-0131a6301e42
1211
github.com/operator-framework/operator-lib v0.11.1-0.20230306195046-28cadc6b6055
1312
github.com/operator-framework/operator-registry v1.28.0
1413
github.com/prometheus/client_golang v1.14.0
@@ -31,6 +30,8 @@ require (
3130
sigs.k8s.io/yaml v1.3.0
3231
)
3332

33+
require github.com/operator-framework/api v0.17.4-0.20230223191600-0131a6301e42 // indirect
34+
3435
require (
3536
github.com/Microsoft/hcsshim v0.9.4 // indirect
3637
github.com/antlr/antlr4/runtime/Go/antlr v1.4.10 // indirect

0 commit comments

Comments
 (0)