Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding kuttl test stage #178

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .tekton/frontend-operator-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,49 @@ spec:

cd ${FEO_PATH}
make test
- name: run-kuttl-tests
description: run kuttl tests
params:
- name: SNAPSHOT
value: $(params.SNAPSHOT)
- name: NAMESPACE
value: $(params.NAMESPACE)
- name: EXPECTED_OUTPUT
value: $(params.EXPECTED_OUTPUT)
runAfter:
- clone-repository
workspaces:
- name: output
workspace: workspace
- name: basic-auth
workspace: git-auth
taskSpec:
params:
- name: SNAPSHOT
- name: NAMESPACE
- name: EXPECTED_OUTPUT
results:
- name: TEST_OUTPUT
description: Test output
steps:
- image: quay.io/mknop_console_dot/konflux-go-kubectl:latest
env:
- name: SNAPSHOT
value: $(params.SNAPSHOT)
- name: NAMESPACE
value: $(params.NAMESPACE)
- name: EXPECTED_OUTPUT
value: $(params.EXPECTED_OUTPUT)
- name: GOFLAGS
value: -buildvcs=false
script: |
#!/bin/bash
set -ex

FEO_PATH="/workspace/output/source"

cd ${FEO_PATH}
make kuttl
- name: prefetch-dependencies
params:
- name: input
Expand Down
18 changes: 17 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,22 @@ junit: gotestsum manifests envtest generate fmt vet

# entry point for testing kuttl with kind
kuttl: manifests envtest generate fmt vet
# Install krew for kubectl
set -x; cd "$(mktemp -d)" && \
OS="$(uname | tr '[:upper:]' '[:lower:]')" && \
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" && \
KREW="krew-${OS}_${ARCH}" && \
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" && \
tar zxvf "${KREW}.tar.gz" && \
./"${KREW}" install krew

export PATH="${KREW_ROOT:-${HOME}/.krew}/bin:${PATH}"
export PATH="/bins:${PATH}"
export PATH="/.local/bin:${PATH}"

# Install kuttl with krew
kubectl krew install kuttl

KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" kubectl kuttl test --config kuttl-config.yml ./tests/e2e

##@ Build
Expand Down Expand Up @@ -166,7 +182,7 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi

CONTROLLER_GEN = $(shell pwd)/testbin/bin/controller-gen
controller-gen: ## Download controller-gen locally if necessary.
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.8.0)
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0)

KUSTOMIZE = $(shell pwd)/testbin/bin/kustomize
kustomize: ## Download kustomize locally if necessary.
Expand Down
1 change: 1 addition & 0 deletions kuttl_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set -exv
tar zxvf "${KREW}.tar.gz" &&
./"${KREW}" install krew
)

export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
export PATH="/bins:$PATH"

Expand Down
Loading