Skip to content

Commit

Permalink
initial testing changes for passing e2e
Browse files Browse the repository at this point in the history
Signed-off-by: Bryce Palmer <bpalmer@redhat.com>
  • Loading branch information
everettraven committed Aug 4, 2023
1 parent ab43854 commit 6e08e9a
Show file tree
Hide file tree
Showing 168 changed files with 3,707 additions and 1,960 deletions.
34 changes: 8 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ SHELL = /bin/bash
# version is moved to a separate repo and release process.
export IMAGE_VERSION = v1.31.0
# Build-time variables to inject into binaries
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)
export GIT_VERSION = $(shell git describe --dirty --tags --always)
export GIT_COMMIT = $(shell git rev-parse HEAD)
# 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)
# export GIT_VERSION = $(shell git describe --dirty --tags --always)
# export GIT_COMMIT = $(shell git rev-parse HEAD)
export K8S_VERSION = 1.26.0

export OPERATOR_SDK_VERSION = $(IMAGE_VERSION)

# Build settings
export TOOLS_DIR = tools/bin
export SCRIPTS_DIR = tools/scripts
Expand All @@ -37,9 +35,9 @@ export PATH := $(PWD)/$(BUILD_DIR):$(PWD)/$(TOOLS_DIR):$(PATH)
##@ Development

.PHONY: generate
generate: operator-sdk build # Generate CLI docs and samples
generate: build # Generate CLI docs and samples
rm -rf testdata
go run ./hack/generate/samples/generate_testdata.go --bin $(OPERATOR_SDK)
go run ./hack/generate/samples/generate_testdata.go
go generate ./...

.PHONY: fix
Expand Down Expand Up @@ -142,11 +140,12 @@ e2e_targets := test-e2e $(e2e_tests)
export KIND_CLUSTER := osdk-test

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)
test-e2e-setup:: operator-sdk build dev-install cluster-create
test-e2e-setup:: build dev-install cluster-create

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

.PHONY: dev-install
dev-install::
Expand All @@ -164,29 +163,12 @@ test-e2e-teardown:
$(e2e_targets):: test-e2e-setup
test-e2e:: $(e2e_tests) ## Run e2e tests

test-e2e-ansible:: operator-sdk image/ansible-operator ## Run Ansible e2e tests
go test -count=1 ./internal/ansible/proxy/...
test-e2e-ansible:: image/ansible-operator ## Run Ansible e2e tests
go test ./test/e2e/ansible -v -ginkgo.v
test-e2e-ansible-molecule:: install dev-install image/ansible-operator ## Run molecule-based Ansible e2e tests
go run ./hack/generate/samples/molecule/generate.go
./hack/tests/e2e-ansible-molecule.sh

## Location to install dependencies to
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)

.PHONY: operator-sdk
OPERATOR_SDK ?= $(LOCALBIN)/operator-sdk
operator-sdk: ## Download operator-sdk locally if necessary.
@{ \
set -e ;\
mkdir -p $(dir $(OPERATOR_SDK)) ;\
OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
curl -sSLo $(OPERATOR_SDK) https://github.com/operator-framework/operator-sdk/releases/download/$(OPERATOR_SDK_VERSION)/operator-sdk_$${OS}_$${ARCH} ;\
chmod +x $(OPERATOR_SDK) ;\
}

.DEFAULT_GOAL := help
.PHONY: help
help: ## Show this help screen.
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ require (
github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2
github.com/onsi/ginkgo/v2 v2.7.0
github.com/onsi/gomega v1.24.2
github.com/operator-framework/api v0.17.4-0.20230223191600-0131a6301e42
github.com/operator-framework/operator-lib v0.11.1-0.20230306195046-28cadc6b6055
github.com/operator-framework/operator-registry v1.28.0
github.com/prometheus/client_golang v1.14.0
Expand All @@ -31,6 +30,8 @@ require (
sigs.k8s.io/yaml v1.3.0
)

require github.com/operator-framework/api v0.17.4-0.20230223191600-0131a6301e42 // indirect

require (
github.com/Microsoft/hcsshim v0.9.4 // indirect
github.com/antlr/antlr4/runtime/Go/antlr v1.4.10 // indirect
Expand Down
Loading

0 comments on commit 6e08e9a

Please sign in to comment.