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

Add integration–test code base to rhobs/config #566

Merged
merged 2 commits into from
Aug 9, 2023
Merged
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
2 changes: 1 addition & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2010,4 +2010,4 @@ sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
2 changes: 1 addition & 1 deletion tests/integration_tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ RUN microdnf update -y &&\
COPY ./tests/integration_tests/runtest.sh /tests/runtest.sh

WORKDIR /tests
ENTRYPOINT ["/bin/sh", "runtest.sh"]
ENTRYPOINT ["/bin/sh", "runtest.sh"]
13 changes: 13 additions & 0 deletions tests/integration_tests/framework/.bingo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

# Ignore everything
*

# But not these files:
!.gitignore
!*.mod
!*.sum
!README.md
!Variables.mk
!variables.env

*tmp.mod
14 changes: 14 additions & 0 deletions tests/integration_tests/framework/.bingo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Project Development Dependencies.

This is directory which stores Go modules with pinned buildable package that is used within this repository, managed by https://github.com/bwplotka/bingo.

* Run `bingo get` to install all tools having each own module file in this directory.
* Run `bingo get <tool>` to install <tool> that have own module file in this directory.
* For Makefile: Make sure to put `include .bingo/Variables.mk` in your Makefile, then use $(<upper case tool name>) variable where <tool> is the .bingo/<tool>.mod.
* For shell: Run `source .bingo/variables.env` to source all environment variable for each tool.
* For go: Import `.bingo/variables.go` to for variable names.
* See https://github.com/bwplotka/bingo or -h on how to add, remove or change binaries dependencies.

## Requirements

* Go 1.14+
43 changes: 43 additions & 0 deletions tests/integration_tests/framework/.bingo/Variables.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.8. DO NOT EDIT.
# All tools are designed to be build inside $GOBIN.
BINGO_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
GOPATH ?= $(shell go env GOPATH)
GOBIN ?= $(firstword $(subst :, ,${GOPATH}))/bin
GO ?= $(shell which go)

# Below generated variables ensure that every time a tool under each variable is invoked, the correct version
# will be used; reinstalling only if needed.
# For example for gojsontoyaml variable:
#
# In your main Makefile (for non array binaries):
#
#include .bingo/Variables.mk # Assuming -dir was set to .bingo .
#
#command: $(GOJSONTOYAML)
# @echo "Running gojsontoyaml"
# @$(GOJSONTOYAML) <flags/args..>
#
GOJSONTOYAML := $(GOBIN)/gojsontoyaml-v0.1.0
$(GOJSONTOYAML): $(BINGO_DIR)/gojsontoyaml.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/gojsontoyaml-v0.1.0"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=gojsontoyaml.mod -o=$(GOBIN)/gojsontoyaml-v0.1.0 "github.com/brancz/gojsontoyaml"

JSONNET_LINT := $(GOBIN)/jsonnet-lint-v0.20.0
$(JSONNET_LINT): $(BINGO_DIR)/jsonnet-lint.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/jsonnet-lint-v0.20.0"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=jsonnet-lint.mod -o=$(GOBIN)/jsonnet-lint-v0.20.0 "github.com/google/go-jsonnet/cmd/jsonnet-lint"

JSONNET := $(GOBIN)/jsonnet-v0.20.0
$(JSONNET): $(BINGO_DIR)/jsonnet.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/jsonnet-v0.20.0"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=jsonnet.mod -o=$(GOBIN)/jsonnet-v0.20.0 "github.com/google/go-jsonnet/cmd/jsonnet"

JSONNETFMT := $(GOBIN)/jsonnetfmt-v0.20.0
$(JSONNETFMT): $(BINGO_DIR)/jsonnetfmt.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/jsonnetfmt-v0.20.0"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=jsonnetfmt.mod -o=$(GOBIN)/jsonnetfmt-v0.20.0 "github.com/google/go-jsonnet/cmd/jsonnetfmt"

1 change: 1 addition & 0 deletions tests/integration_tests/framework/.bingo/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module _ // Fake go.mod auto-created by 'bingo' for go -moddir compatibility with non-Go projects. Commit this file, together with other .mod files.
5 changes: 5 additions & 0 deletions tests/integration_tests/framework/.bingo/gojsontoyaml.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.19

require github.com/brancz/gojsontoyaml v0.1.0
7 changes: 7 additions & 0 deletions tests/integration_tests/framework/.bingo/gojsontoyaml.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
github.com/brancz/gojsontoyaml v0.1.0 h1:SdzR3+BCVOqaI42nFGTeaB7/2DgDM4fhuvRLqxatA8M=
github.com/brancz/gojsontoyaml v0.1.0/go.mod h1:+ycZY94+V11XZBUaDEsbLr3hPNS/ZPrDVKKNUg3Sgvg=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
5 changes: 5 additions & 0 deletions tests/integration_tests/framework/.bingo/jsonnet-lint.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.19

require github.com/google/go-jsonnet v0.20.0 // cmd/jsonnet-lint
17 changes: 17 additions & 0 deletions tests/integration_tests/framework/.bingo/jsonnet-lint.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
github.com/fatih/color v1.12.0 h1:mRhaKNwANqRgUBGKmnI5ZxEk7QXmjQeCcuYFMX2bfcc=
github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/google/go-jsonnet v0.20.0 h1:WG4TTSARuV7bSm4PMB4ohjxe33IHT5WVTrJSU33uT4g=
github.com/google/go-jsonnet v0.20.0/go.mod h1:VbgWF9JX7ztlv770x/TolZNGGFfiHEVx9G6ca2eUmeA=
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo=
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
5 changes: 5 additions & 0 deletions tests/integration_tests/framework/.bingo/jsonnet.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.19

require github.com/google/go-jsonnet v0.20.0 // cmd/jsonnet
17 changes: 17 additions & 0 deletions tests/integration_tests/framework/.bingo/jsonnet.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
github.com/fatih/color v1.12.0 h1:mRhaKNwANqRgUBGKmnI5ZxEk7QXmjQeCcuYFMX2bfcc=
github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/google/go-jsonnet v0.20.0 h1:WG4TTSARuV7bSm4PMB4ohjxe33IHT5WVTrJSU33uT4g=
github.com/google/go-jsonnet v0.20.0/go.mod h1:VbgWF9JX7ztlv770x/TolZNGGFfiHEVx9G6ca2eUmeA=
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo=
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
5 changes: 5 additions & 0 deletions tests/integration_tests/framework/.bingo/jsonnetfmt.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.19

require github.com/google/go-jsonnet v0.20.0 // cmd/jsonnetfmt
17 changes: 17 additions & 0 deletions tests/integration_tests/framework/.bingo/jsonnetfmt.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
github.com/fatih/color v1.12.0 h1:mRhaKNwANqRgUBGKmnI5ZxEk7QXmjQeCcuYFMX2bfcc=
github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/google/go-jsonnet v0.20.0 h1:WG4TTSARuV7bSm4PMB4ohjxe33IHT5WVTrJSU33uT4g=
github.com/google/go-jsonnet v0.20.0/go.mod h1:VbgWF9JX7ztlv770x/TolZNGGFfiHEVx9G6ca2eUmeA=
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo=
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
18 changes: 18 additions & 0 deletions tests/integration_tests/framework/.bingo/variables.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.8. DO NOT EDIT.
# All tools are designed to be build inside $GOBIN.
# Those variables will work only until 'bingo get' was invoked, or if tools were installed via Makefile's Variables.mk.
GOBIN=${GOBIN:=$(go env GOBIN)}

if [ -z "$GOBIN" ]; then
GOBIN="$(go env GOPATH)/bin"
fi


GOJSONTOYAML="${GOBIN}/gojsontoyaml-v0.1.0"

JSONNET_LINT="${GOBIN}/jsonnet-lint-v0.20.0"

JSONNET="${GOBIN}/jsonnet-v0.20.0"

JSONNETFMT="${GOBIN}/jsonnetfmt-v0.20.0"

12 changes: 12 additions & 0 deletions tests/integration_tests/framework/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM golang:1.20-alpine
RUN apk update && apk add git

WORKDIR /integration-tests

COPY go.mod go.sum ./
RUN go mod download

COPY . .

RUN go build ./cmd/rhobs-test
ENTRYPOINT [ "./rhobs-test" ]
111 changes: 111 additions & 0 deletions tests/integration_tests/framework/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
include .bingo/Variables.mk

IMG ?= quay.io/app-sre/rhobs-test
BRANCH := $(strip $(shell git rev-parse --abbrev-ref HEAD))
BUILD_DATE :=$(shell date -u +"%Y-%m-%d")
TAG := $(shell git rev-parse --short=7 HEAD)
EXAMPLES := examples
OCP_MANIFESTS := $(EXAMPLES)/manifests/openshift
DEV_MANIFESTS := $(EXAMPLES)/manifests/dev
XARGS ?= $(shell which gxargs 2>/dev/null || which xargs)
# Setting GOENV
GOOS := $(shell go env GOOS)
GOARCH := $(shell go env GOARCH)
all: build
build: rhobs-test

.PHONY: rhobs-test
rhobs-test:
CGO_ENABLED=0 go build ./cmd/rhobs-test

.PHONY: vendor
vendor: go.mod go.sum
go mod tidy
go mod vendor
.PHONY: go-fmt
go-fmt:
@fmt_res=$$(gofmt -d -s $$(find . -type f -name '*.go' -not -path './vendor/*')); if [ -n "$$fmt_res" ]; then printf '\nGofmt found style issues. Please check the reported issues\nand fix them if necessary before submitting the code for review:\n\n%s' "$$fmt_res"; exit 1; fi

.PHONY: container-dev
container-dev: kind
@docker build \
-t $(IMG):$(BRANCH)-$(BUILD_DATE)-$(TAG) \
.
docker tag $(IMG):$(BRANCH)-$(BUILD_DATE)-$(TAG) localhost:5001/rhobs-test:latest
docker push localhost:5001/rhobs-test:latest

.PHONY: kind
kind:
wget https://kind.sigs.k8s.io/examples/kind-with-registry.sh
chmod 755 kind-with-registry.sh
./kind-with-registry.sh

.PHONY: test
test:
go test ./...

.PHONY: local
local: kind container-dev
kubectl apply -f $(DEV_MANIFESTS)/test-deployment.yaml
kubectl apply -f $(DEV_MANIFESTS)/test-rbac.yaml
kubectl apply -f $(DEV_MANIFESTS)/test-job.yaml

.PHONY: local-faulty
local-faulty: kind container-dev
kubectl apply -f $(DEV_MANIFESTS)/test-deployment-faulty.yaml
kubectl apply -f $(DEV_MANIFESTS)/test-rbac.yaml
kubectl apply -f $(DEV_MANIFESTS)/test-job.yaml

.PHONY: clean
clean:
find $(EXAMPLES) -type f ! -name '*.yaml' -delete
find $(OCP_MANIFESTS) -type f ! -name '*.yaml' -delete
find $(DEV_MANIFESTS) -type f ! -name '*.yaml' -delete

.PHONY: clean-local
clean-local:
rm -f kind-with-registry.sh
rm -f ./rhobs-test
kind delete cluster
docker ps -a -q | xargs docker rm -f

.PHONY: clean-test
clean-test:
rm -f kind-with-registry.sh
rm -f ./rhobs-test
kind delete cluster
docker ps -a -q | xargs docker rm -f
rm -f kubeconfig

.PHONY: container-build
container-build:
docker build \
--platform linux/$(GOARCH) \
--build-arg DOCKERFILE_PATH="/Dockerfile" \
-t $(IMG):$(BRANCH)-$(BUILD_DATE)-$(TAG) \
-t $(IMG):$(TAG) \
.
.PHONY: container-build-push
container-build-push:
@docker build \
--push \
--platform linux/$(GOARCH) \
-t $(IMG):$(BRANCH)-$(BUILD_DATE)-$(TAG) \
-t $(IMG):$(TAG) \
.
.PHONY: ocp-manifests
ocp-manifests: $(JSONNET) $(JSONNETFMT) $(GOJSONTOYAML)
echo "ocp manifests"
$(JSONNETFMT) -n 2 --max-blank-lines 2 --string-style s --comment-style s -i jsonnet/ocp-manifests.jsonnet
$(JSONNET) -m $(OCP_MANIFESTS) jsonnet/ocp-manifests.jsonnet | $(XARGS) -I{} sh -c 'cat {} | $(GOJSONTOYAML) > {}.yaml' -- {}
make clean
.PHONY: dev-manifests

dev-manifests: $(JSONNET) $(JSONNETFMT) $(GOJSONTOYAML)
echo "dev manifests"
$(JSONNETFMT) -n 2 --max-blank-lines 2 --string-style s --comment-style s -i jsonnet/dev-manifests.jsonnet
$(JSONNET) -m $(DEV_MANIFESTS) jsonnet/dev-manifests.jsonnet | $(XARGS) -I{} sh -c 'cat {} | $(GOJSONTOYAML) > {}.yaml' -- {}
make clean

.PHONY: manifests
manifests: dev-manifests ocp-manifests
55 changes: 55 additions & 0 deletions tests/integration_tests/framework/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Integration-Test
A tool that automates the integration testing of your applications on OpenShift/Kubernetes cluster.

## Goals
Currently, we do not have a convenient way to interact with OpenShift/Kubernetes cluster and perform sanity checks on the cluster once our applications are deployed/rollout to the cluster. We need to rely on manual interventions for that.

The tool aims to provide a simple and easy-to-use way for defining such cluster sanity test cases so that we can have checks in place that can provide us correct deployment status of our applications and flag them in case of any failures.

## Features(WIP)
- Intract with OpenShift/Kubernetes cluster via Incluster config or Kubeconfig.
- Validates deployments, statefulsets, services, pvc's health(***Not implemented yet***) inside the namespace after rollout.
- Validates external network connectivity(***Not implemented yet***).
- Checks API endpoint's used(***Not implemented yet***).
- Validates resource utilization(***Not implemented yet***).

## Design(WIP)
![integration-test-design](integration-test.png)
## Usage
```
Usage of ./rhobs-test:
-interval duration
Wait before retry status check again (default 1m0s)
-kubeconfig string
path of kubeconfig file
-namespaces string
List of Namespaces to be monitored (default "default")
-timeout duration
Timeout for retry (default 5m0s)
```
This repository contains Jsonnet configuration that allows generating OpenShift/Kubernetes objects that are required for local testing.

To generate all required files into example/manifests directory run:
```
make manifests
```

To use the integration test automation locally, follow these steps:
- Make sure you have docker or podman installed and running.
- To trigger integration tests against sample manifests run:
```
make local
```
> :point_right: This will install a kind cluster along with the local registry and build a docker image to push to the local registry from where the test job will fetch the image when running on the Kubernetes cluster. This will also take care of deploying service accounts and necessary rbac along with a prometheus-example-app which the integration-test will validate.
- To trigger integration tests against a faulty deployment run:
```
make local-faulty
```
> This can be used in case of negative testing/faulty deployment.

- To destroy the local testing setup run:
```
make clean-local
```
## Contributing
If you'd like to contribute to the integration test tool, please fork the repository and create a pull request with your changes.
Loading
Loading