From 0e48f2735b20595b9c9e43e0c257a950d0ee36ab Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Fri, 25 Feb 2022 13:02:50 +0100 Subject: [PATCH 01/19] Adding e2e-kuttl tests Signed-off-by: Yuri Sa --- .github/workflows/e2e.yaml | 36 ++++++++++++++++++++++++++++++++++++ Makefile | 30 ++++++++++++++++++++++++++++++ hack/install-kuttl.sh | 5 +++++ kuttl-test.yaml | 13 +++++++++++++ tests/e2e/00-assert.yaml | 13 +++++++++++++ tests/e2e/00-install.yaml | 14 ++++++++++++++ 6 files changed, 111 insertions(+) create mode 100644 .github/workflows/e2e.yaml create mode 100644 hack/install-kuttl.sh create mode 100644 kuttl-test.yaml create mode 100644 tests/e2e/00-assert.yaml create mode 100644 tests/e2e/00-install.yaml diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml new file mode 100644 index 0000000..1e4e789 --- /dev/null +++ b/.github/workflows/e2e.yaml @@ -0,0 +1,36 @@ +name: "End-to-end tests" + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + e2e-tests: + name: End-to-end tests + runs-on: ubuntu-20.04 + strategy: + matrix: + kube-version: + - "1.21" + - "1.22" + - "1.23" + + steps: + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.17 + + - name: Check out code into the Go module directory + uses: actions/checkout@v2.4.0 + + - name: "install kuttl" + run: ./hack/install-kuttl.sh + + - name: "run tests" + env: + KUBE_VERSION: ${{ matrix.kube-version }} + run: make prepare-e2e e2e KUBE_VERSION=$KUBE_VERSION diff --git a/Makefile b/Makefile index 22616df..90520bf 100644 --- a/Makefile +++ b/Makefile @@ -105,6 +105,36 @@ sample_deployment: delete_sample_deployment: kubectl delete -f config/samples/sample-deployment.yaml +# end-to-tests +.PHONY: kuttl +kuttl: +ifeq (, $(shell which kubectl-kuttl)) + echo ${PATH} + ls -l /usr/local/bin + which kubectl-kuttl + + @{ \ + set -e ;\ + echo "" ;\ + echo "ERROR: kuttl not found." ;\ + echo "Please check https://kuttl.dev/docs/cli.html for installation instructions and try again." ;\ + echo "" ;\ + exit 1 ;\ + } +else +KUTTL=$(shell which kubectl-kuttl) +endif + +.PHONY: e2e +e2e: + $(KUTTL) test + +.PHONY: prepare-e2e +prepare-e2e: kuttl set-test-image-vars set-image-controller container start-kind + mkdir -p tests/_build/crds tests/_build/manifests + $(KUSTOMIZE) build config/default -o tests/_build/manifests/snoopy-operator.yaml + $(KUSTOMIZE) build config/crd -o tests/_build/crds/ + ##@ Build build: generate fmt vet ## Build manager binary. go build -o bin/manager main.go diff --git a/hack/install-kuttl.sh b/hack/install-kuttl.sh new file mode 100644 index 0000000..783a451 --- /dev/null +++ b/hack/install-kuttl.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +sudo curl -Lo /usr/local/bin/kubectl-kuttl https://github.com/kudobuilder/kuttl/releases/download/v0.11.1/kubectl-kuttl_0.11.1_linux_x86_64 +sudo chmod +x /usr/local/bin/kubectl-kuttl +export PATH=$PATH:/usr/local/bin \ No newline at end of file diff --git a/kuttl-test.yaml b/kuttl-test.yaml new file mode 100644 index 0000000..b521d7d --- /dev/null +++ b/kuttl-test.yaml @@ -0,0 +1,13 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestSuite +crdDir: ./tests/_build/crds/ +artifactsDir: ./tests/_build/artifacts/ +kindContainers: + - local/snoopy-operator:e2e +commands: + - command: kubectl apply -f ./tests/_build/manifests/snoopy-operator.yaml + - command: kubectl wait --timeout=5m --for=condition=available deployment snoopy-operator -n snoopy-operator + - command: sleep 5s +testDirs: + - ./tests/e2e/ +timeout: 150 diff --git a/tests/e2e/00-assert.yaml b/tests/e2e/00-assert.yaml new file mode 100644 index 0000000..35d9e37 --- /dev/null +++ b/tests/e2e/00-assert.yaml @@ -0,0 +1,13 @@ +apiVersion: job.fennecproject.io/v1alpha1 +kind: SnoopyJob +metadata: + name: snoopy-samplejob +spec: + args: -i eth0 -U -w - + command: tcpdump + labelSelector: + networkMonitor: "true" + targetNamespace: cnf-telco + timer: 30s +status: + cronJobList: \ No newline at end of file diff --git a/tests/e2e/00-install.yaml b/tests/e2e/00-install.yaml new file mode 100644 index 0000000..5fb69b0 --- /dev/null +++ b/tests/e2e/00-install.yaml @@ -0,0 +1,14 @@ +apiVersion: job.fennecproject.io/v1alpha1 +kind: SnoopyJob +metadata: + name: snoopy-samplejob +spec: + command: "tcpdump" + args: "-n -i eth0" + labelSelector: { + networkMonitor: "true", + } + targetNamespace: cnf-telco + timer: "30s" + dataServiceIP: "snoopy-data-svc.snoopy-operator.svc.cluster.local" + dataServicePort: "51001" \ No newline at end of file From f0263df1f9c211c2badc06720eaaac66d9fe8e23 Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Fri, 25 Feb 2022 13:06:26 +0100 Subject: [PATCH 02/19] Fixing typos on branch name Signed-off-by: Yuri Sa --- .github/workflows/e2e.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 1e4e789..cf6ee7c 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -2,9 +2,9 @@ name: "End-to-end tests" on: push: - branches: [ main ] + branches: [ master ] pull_request: - branches: [ main ] + branches: [ master ] jobs: e2e-tests: From 7b9f82f62f6bdc2252135fdbc025964381e241a9 Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Fri, 25 Feb 2022 13:57:01 +0100 Subject: [PATCH 03/19] Adding missing parameter on Makefile Signed-off-by: Yuri Sa --- Makefile | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Makefile b/Makefile index 90520bf..3d2a4ca 100644 --- a/Makefile +++ b/Makefile @@ -55,6 +55,10 @@ SHELL = /usr/bin/env bash -o pipefail all: build +## Kind Test +KUBE_VERSION ?= 1.21 +KIND_CONFIG ?= kind-$(KUBE_VERSION).yaml + ##@ General # The help target prints out all targets with their descriptions organized @@ -125,6 +129,23 @@ else KUTTL=$(shell which kubectl-kuttl) endif +.PHONY: set-test-image-vars +set-test-image-vars: + $(eval IMG=local/snoopy-operator:e2e) + +.PHONY: set-image-controller +set-image-controller: manifests kustomize + cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} + +.PHONY: container +container: + docker build -t ${IMG} . + +.PHONY: start-kind +start-kind: + kind create cluster --config $(KIND_CONFIG) + kind load docker-image local/snoopy-operator:e2e + .PHONY: e2e e2e: $(KUTTL) test From 10d9282ba3b8b272d02077091e5cafd0e918da86 Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Fri, 25 Feb 2022 15:01:07 +0100 Subject: [PATCH 04/19] Adding new kind versions Signed-off-by: Yuri Sa --- Makefile | 1 - kind-1.21.yaml | 5 +++++ kind-1.22.yaml | 5 +++++ kind-1.23.yaml | 5 +++++ 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 kind-1.21.yaml create mode 100644 kind-1.22.yaml create mode 100644 kind-1.23.yaml diff --git a/Makefile b/Makefile index 3d2a4ca..aed1d07 100644 --- a/Makefile +++ b/Makefile @@ -116,7 +116,6 @@ ifeq (, $(shell which kubectl-kuttl)) echo ${PATH} ls -l /usr/local/bin which kubectl-kuttl - @{ \ set -e ;\ echo "" ;\ diff --git a/kind-1.21.yaml b/kind-1.21.yaml new file mode 100644 index 0000000..8b2b512 --- /dev/null +++ b/kind-1.21.yaml @@ -0,0 +1,5 @@ +kind: Cluster +apiVersion: kind.x-k8s.io/v1alpha4 +nodes: +- role: control-plane + image: kindest/node:v1.21.2@sha256:9d07ff05e4afefbba983fac311807b3c17a5f36e7061f6cb7e2ba756255b2be4 \ No newline at end of file diff --git a/kind-1.22.yaml b/kind-1.22.yaml new file mode 100644 index 0000000..4300359 --- /dev/null +++ b/kind-1.22.yaml @@ -0,0 +1,5 @@ +kind: Cluster +apiVersion: kind.x-k8s.io/v1alpha4 +nodes: +- role: control-plane + image: kindest/node:v1.22.4@sha256:ca3587e6e545a96c07bf82e2c46503d9ef86fc704f44c17577fca7bcabf5f978 \ No newline at end of file diff --git a/kind-1.23.yaml b/kind-1.23.yaml new file mode 100644 index 0000000..2d0b936 --- /dev/null +++ b/kind-1.23.yaml @@ -0,0 +1,5 @@ +kind: Cluster +apiVersion: kind.x-k8s.io/v1alpha4 +nodes: +- role: control-plane + image: kindest/node:v1.23.0@sha256:2f93d3c7b12a3e93e6c1f34f331415e105979961fcddbe69a4e3ab5a93ccbb35 From 80ef33aec227f3059ef8101e2cf6ccd7812f5c40 Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Wed, 2 Mar 2022 14:03:24 +0100 Subject: [PATCH 05/19] Permissions changed and included missing arguments on makefile Signed-off-by: Yuri Sa --- Makefile | 30 ++++++++++++++++++++++++++++++ hack/install-kuttl.sh | 0 2 files changed, 30 insertions(+) mode change 100644 => 100755 hack/install-kuttl.sh diff --git a/Makefile b/Makefile index aed1d07..15d3c32 100644 --- a/Makefile +++ b/Makefile @@ -110,6 +110,21 @@ delete_sample_deployment: kubectl delete -f config/samples/sample-deployment.yaml # end-to-tests +# go-get-tool will 'go get' any package $2 and install it to $1. +PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) +define go-get-tool +@[ -f $(1) ] || { \ +set -e ;\ +TMP_DIR=$$(mktemp -d) ;\ +cd $$TMP_DIR ;\ +go mod init tmp ;\ +echo "Downloading $(2)" ;\ +go get -d $(2)@$(3) ;\ +GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\ +rm -rf $$TMP_DIR ;\ +} +endef + .PHONY: kuttl kuttl: ifeq (, $(shell which kubectl-kuttl)) @@ -128,6 +143,21 @@ else KUTTL=$(shell which kubectl-kuttl) endif +.PHONY: kind +kind: +ifeq (, $(shell which kind)) + @{ \ + set -e ;\ + echo "" ;\ + echo "ERROR: kind not found." ;\ + echo "Please check https://kind.sigs.k8s.io/docs/user/quick-start/#installation for installation instructions and try again." ;\ + echo "" ;\ + exit 1 ;\ + } +else +KIND=$(shell which kind) +endif + .PHONY: set-test-image-vars set-test-image-vars: $(eval IMG=local/snoopy-operator:e2e) diff --git a/hack/install-kuttl.sh b/hack/install-kuttl.sh old mode 100644 new mode 100755 From 845b48046cbb67e01fd1ec6946b06b15578c8f6a Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Wed, 2 Mar 2022 17:01:20 +0100 Subject: [PATCH 06/19] Testing kind with CRIO Signed-off-by: Yuri Sa --- kind-1.21.yaml | 9 ++++++++- kind-1.22.yaml | 9 ++++++++- kind-1.23.yaml | 9 ++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/kind-1.21.yaml b/kind-1.21.yaml index 8b2b512..2a2e5aa 100644 --- a/kind-1.21.yaml +++ b/kind-1.21.yaml @@ -2,4 +2,11 @@ kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: - role: control-plane - image: kindest/node:v1.21.2@sha256:9d07ff05e4afefbba983fac311807b3c17a5f36e7061f6cb7e2ba756255b2be4 \ No newline at end of file + image: ghcr.io/yuriolisa/kindnode/crio:1.21@sha256:f8172bf479cd092e7b602c874b7c2a62819136b274cca52e324803ed6f26efdd + kubeadmConfigPatches: + - | + kind: InitConfiguration + nodeRegistration: + criSocket: unix:///run/crio/crio.sock + kubeletExtraArgs: + cgroup-driver: cgroupfs \ No newline at end of file diff --git a/kind-1.22.yaml b/kind-1.22.yaml index 4300359..6483ee5 100644 --- a/kind-1.22.yaml +++ b/kind-1.22.yaml @@ -2,4 +2,11 @@ kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: - role: control-plane - image: kindest/node:v1.22.4@sha256:ca3587e6e545a96c07bf82e2c46503d9ef86fc704f44c17577fca7bcabf5f978 \ No newline at end of file + image: ghcr.io/yuriolisa/kindnode/crio:1.22@sha256:061f0eae594dc9534b32f8df81e15e9fbc8e0184f53f5f405b65d96b987244f7 + kubeadmConfigPatches: + - | + kind: InitConfiguration + nodeRegistration: + criSocket: unix:///run/crio/crio.sock + kubeletExtraArgs: + cgroup-driver: cgroupfs \ No newline at end of file diff --git a/kind-1.23.yaml b/kind-1.23.yaml index 2d0b936..dd9dc1f 100644 --- a/kind-1.23.yaml +++ b/kind-1.23.yaml @@ -2,4 +2,11 @@ kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: - role: control-plane - image: kindest/node:v1.23.0@sha256:2f93d3c7b12a3e93e6c1f34f331415e105979961fcddbe69a4e3ab5a93ccbb35 + image: ghcr.io/yuriolisa/kindnode/crio:1.23@sha256:f8172bf479cd092e7b602c874b7c2a62819136b274cca52e324803ed6f26efdd + kubeadmConfigPatches: + - | + kind: InitConfiguration + nodeRegistration: + criSocket: unix:///run/crio/crio.sock + kubeletExtraArgs: + cgroup-driver: cgroupfs \ No newline at end of file From 909f76c2093eb920dbb229b2eca7c414d2196168 Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Wed, 2 Mar 2022 17:28:33 +0100 Subject: [PATCH 07/19] Testing kind with CRIO - diff sha Signed-off-by: Yuri Sa --- kind-1.21.yaml | 2 +- kind-1.22.yaml | 2 +- kind-1.23.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/kind-1.21.yaml b/kind-1.21.yaml index 2a2e5aa..61aae54 100644 --- a/kind-1.21.yaml +++ b/kind-1.21.yaml @@ -2,7 +2,7 @@ kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: - role: control-plane - image: ghcr.io/yuriolisa/kindnode/crio:1.21@sha256:f8172bf479cd092e7b602c874b7c2a62819136b274cca52e324803ed6f26efdd + image: ghcr.io/yuriolisa/kindnode/crio:1.21@sha256:3c43afca813cf724e02efe70bf0ee0ceee498b49ee746781f6951db5bafb6b39 kubeadmConfigPatches: - | kind: InitConfiguration diff --git a/kind-1.22.yaml b/kind-1.22.yaml index 6483ee5..094af03 100644 --- a/kind-1.22.yaml +++ b/kind-1.22.yaml @@ -2,7 +2,7 @@ kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: - role: control-plane - image: ghcr.io/yuriolisa/kindnode/crio:1.22@sha256:061f0eae594dc9534b32f8df81e15e9fbc8e0184f53f5f405b65d96b987244f7 + image: ghcr.io/yuriolisa/kindnode/crio:1.22@sha256:46948065311fd050ae9fb5bf7af76674ad167d9f1a41fba0460bc1467424abc2 kubeadmConfigPatches: - | kind: InitConfiguration diff --git a/kind-1.23.yaml b/kind-1.23.yaml index dd9dc1f..d4fc682 100644 --- a/kind-1.23.yaml +++ b/kind-1.23.yaml @@ -2,7 +2,7 @@ kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: - role: control-plane - image: ghcr.io/yuriolisa/kindnode/crio:1.23@sha256:f8172bf479cd092e7b602c874b7c2a62819136b274cca52e324803ed6f26efdd + image: ghcr.io/yuriolisa/kindnode/crio:1.23@sha256:76548d7eff138dae6dd9c29bfc55a836fb2ed87a19f234f7d3e6c9f8bb0eb71c kubeadmConfigPatches: - | kind: InitConfiguration From a87f4eefe01a37cdf0ef8177857e23e6c31625fa Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Wed, 2 Mar 2022 21:49:47 +0100 Subject: [PATCH 08/19] Change load and repo Signed-off-by: Yuri Sa --- Makefile | 3 ++- kind-1.21.yaml | 2 +- kind-1.22.yaml | 2 +- kind-1.23.yaml | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 15d3c32..2cacbe6 100644 --- a/Makefile +++ b/Makefile @@ -173,7 +173,8 @@ container: .PHONY: start-kind start-kind: kind create cluster --config $(KIND_CONFIG) - kind load docker-image local/snoopy-operator:e2e + podman save -o snoopy-operator-local.tar ${IMG} + podman load -i snoopy-operator-local.tar .PHONY: e2e e2e: diff --git a/kind-1.21.yaml b/kind-1.21.yaml index 61aae54..1bcf4f9 100644 --- a/kind-1.21.yaml +++ b/kind-1.21.yaml @@ -2,7 +2,7 @@ kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: - role: control-plane - image: ghcr.io/yuriolisa/kindnode/crio:1.21@sha256:3c43afca813cf724e02efe70bf0ee0ceee498b49ee746781f6951db5bafb6b39 + image: quay.io/fennec-project/kindnode-crio:1.21@sha256:3c43afca813cf724e02efe70bf0ee0ceee498b49ee746781f6951db5bafb6b39 kubeadmConfigPatches: - | kind: InitConfiguration diff --git a/kind-1.22.yaml b/kind-1.22.yaml index 094af03..1250212 100644 --- a/kind-1.22.yaml +++ b/kind-1.22.yaml @@ -2,7 +2,7 @@ kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: - role: control-plane - image: ghcr.io/yuriolisa/kindnode/crio:1.22@sha256:46948065311fd050ae9fb5bf7af76674ad167d9f1a41fba0460bc1467424abc2 + image: quay.io/fennec-project/kindnode-crio:1.22@sha256:46948065311fd050ae9fb5bf7af76674ad167d9f1a41fba0460bc1467424abc2 kubeadmConfigPatches: - | kind: InitConfiguration diff --git a/kind-1.23.yaml b/kind-1.23.yaml index d4fc682..d9ebb41 100644 --- a/kind-1.23.yaml +++ b/kind-1.23.yaml @@ -2,7 +2,7 @@ kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: - role: control-plane - image: ghcr.io/yuriolisa/kindnode/crio:1.23@sha256:76548d7eff138dae6dd9c29bfc55a836fb2ed87a19f234f7d3e6c9f8bb0eb71c + image: quay.io/fennec-project/kindnode-crio:1.23@sha256:76548d7eff138dae6dd9c29bfc55a836fb2ed87a19f234f7d3e6c9f8bb0eb71c kubeadmConfigPatches: - | kind: InitConfiguration From e606c533e5009891dd4cb0e1721222400cacc78d Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Thu, 3 Mar 2022 09:16:52 +0100 Subject: [PATCH 09/19] Change image build to podman Signed-off-by: Yuri Sa --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2cacbe6..8392dc0 100644 --- a/Makefile +++ b/Makefile @@ -168,7 +168,7 @@ set-image-controller: manifests kustomize .PHONY: container container: - docker build -t ${IMG} . + podman build -t ${IMG} . .PHONY: start-kind start-kind: From 9acdb25c4f54ee1e07cb9817e95a4daeb6867818 Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Thu, 3 Mar 2022 09:35:27 +0100 Subject: [PATCH 10/19] Changing kuttl timeout Signed-off-by: Yuri Sa --- kuttl-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kuttl-test.yaml b/kuttl-test.yaml index b521d7d..5420202 100644 --- a/kuttl-test.yaml +++ b/kuttl-test.yaml @@ -10,4 +10,4 @@ commands: - command: sleep 5s testDirs: - ./tests/e2e/ -timeout: 150 +timeout: 240 From 06edbb1b1d4d8a6a247e8a60e87b8ed6ed1bbb39 Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Thu, 3 Mar 2022 09:47:25 +0100 Subject: [PATCH 11/19] Debugging pipeline Signed-off-by: Yuri Sa --- kuttl-test.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kuttl-test.yaml b/kuttl-test.yaml index 5420202..a457fbd 100644 --- a/kuttl-test.yaml +++ b/kuttl-test.yaml @@ -6,8 +6,14 @@ kindContainers: - local/snoopy-operator:e2e commands: - command: kubectl apply -f ./tests/_build/manifests/snoopy-operator.yaml + - command: sleep 10s + - command: kubect get deployment -n snoopy-operator + - command: "kubectl get deployments -n snoopy-operator snoopy-operator -o yaml | grep image:" + - command: sleep 5s + - command: kubectl get pods -n snoopy-operator + - command: sleep 3s - command: kubectl wait --timeout=5m --for=condition=available deployment snoopy-operator -n snoopy-operator - command: sleep 5s testDirs: - ./tests/e2e/ -timeout: 240 +timeout: 150 From 958c741c78a5eae385817f807f12fc0fdc87d3ef Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Thu, 3 Mar 2022 09:53:30 +0100 Subject: [PATCH 12/19] Debugging pipeline Signed-off-by: Yuri Sa --- kuttl-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kuttl-test.yaml b/kuttl-test.yaml index a457fbd..7ecaba0 100644 --- a/kuttl-test.yaml +++ b/kuttl-test.yaml @@ -7,7 +7,7 @@ kindContainers: commands: - command: kubectl apply -f ./tests/_build/manifests/snoopy-operator.yaml - command: sleep 10s - - command: kubect get deployment -n snoopy-operator + - command: kubectl get deployment -n snoopy-operator - command: "kubectl get deployments -n snoopy-operator snoopy-operator -o yaml | grep image:" - command: sleep 5s - command: kubectl get pods -n snoopy-operator From b3889dfd998aeae64b03a738b85ae543269a4f44 Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Thu, 3 Mar 2022 10:01:06 +0100 Subject: [PATCH 13/19] Debugging pipeline Signed-off-by: Yuri Sa --- kuttl-test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kuttl-test.yaml b/kuttl-test.yaml index 7ecaba0..684e4d4 100644 --- a/kuttl-test.yaml +++ b/kuttl-test.yaml @@ -8,9 +8,9 @@ commands: - command: kubectl apply -f ./tests/_build/manifests/snoopy-operator.yaml - command: sleep 10s - command: kubectl get deployment -n snoopy-operator - - command: "kubectl get deployments -n snoopy-operator snoopy-operator -o yaml | grep image:" + - command: "kubectl get deployments -n snoopy-operator snoopy-operator -o yaml" - command: sleep 5s - - command: kubectl get pods -n snoopy-operator + - command: kubectl get pods -n snoopy-operator -o yaml - command: sleep 3s - command: kubectl wait --timeout=5m --for=condition=available deployment snoopy-operator -n snoopy-operator - command: sleep 5s From 02a18aabde53b3bbee6503487c56776d2e1d55b4 Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Thu, 3 Mar 2022 10:01:22 +0100 Subject: [PATCH 14/19] Debugging pipeline Signed-off-by: Yuri Sa --- kuttl-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kuttl-test.yaml b/kuttl-test.yaml index 684e4d4..3075486 100644 --- a/kuttl-test.yaml +++ b/kuttl-test.yaml @@ -8,7 +8,7 @@ commands: - command: kubectl apply -f ./tests/_build/manifests/snoopy-operator.yaml - command: sleep 10s - command: kubectl get deployment -n snoopy-operator - - command: "kubectl get deployments -n snoopy-operator snoopy-operator -o yaml" + - command: kubectl get deployments -n snoopy-operator snoopy-operator -o yaml - command: sleep 5s - command: kubectl get pods -n snoopy-operator -o yaml - command: sleep 3s From 6e47b7fe2cee73aaf73bb77e6d4a7d420d8e6048 Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Thu, 3 Mar 2022 10:19:12 +0100 Subject: [PATCH 15/19] Debugging pipeline Signed-off-by: Yuri Sa --- kuttl-test.yaml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/kuttl-test.yaml b/kuttl-test.yaml index 3075486..e194ccc 100644 --- a/kuttl-test.yaml +++ b/kuttl-test.yaml @@ -8,10 +8,13 @@ commands: - command: kubectl apply -f ./tests/_build/manifests/snoopy-operator.yaml - command: sleep 10s - command: kubectl get deployment -n snoopy-operator - - command: kubectl get deployments -n snoopy-operator snoopy-operator -o yaml - - command: sleep 5s - - command: kubectl get pods -n snoopy-operator -o yaml - - command: sleep 3s + - command: sleep 10s + - command: kubectl get pods -n snoopy-operator + - command: sleep 10s + - command: kubectl get pods -n snoopy-operator + - command: sleep 20s + - command: kubectl get pods -n snoopy-operator + - command: sleep 20s - command: kubectl wait --timeout=5m --for=condition=available deployment snoopy-operator -n snoopy-operator - command: sleep 5s testDirs: From 873ebf026b91204acd35c96402b0138e43f71fdb Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Thu, 3 Mar 2022 11:09:59 +0100 Subject: [PATCH 16/19] Debugging pipeline Signed-off-by: Yuri Sa --- Makefile | 8 +------- kuttl-test.yaml | 10 +--------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 8392dc0..45c0d8b 100644 --- a/Makefile +++ b/Makefile @@ -158,10 +158,6 @@ else KIND=$(shell which kind) endif -.PHONY: set-test-image-vars -set-test-image-vars: - $(eval IMG=local/snoopy-operator:e2e) - .PHONY: set-image-controller set-image-controller: manifests kustomize cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} @@ -173,15 +169,13 @@ container: .PHONY: start-kind start-kind: kind create cluster --config $(KIND_CONFIG) - podman save -o snoopy-operator-local.tar ${IMG} - podman load -i snoopy-operator-local.tar .PHONY: e2e e2e: $(KUTTL) test .PHONY: prepare-e2e -prepare-e2e: kuttl set-test-image-vars set-image-controller container start-kind +prepare-e2e: kuttl set-image-controller container start-kind mkdir -p tests/_build/crds tests/_build/manifests $(KUSTOMIZE) build config/default -o tests/_build/manifests/snoopy-operator.yaml $(KUSTOMIZE) build config/crd -o tests/_build/crds/ diff --git a/kuttl-test.yaml b/kuttl-test.yaml index e194ccc..d43070c 100644 --- a/kuttl-test.yaml +++ b/kuttl-test.yaml @@ -6,17 +6,9 @@ kindContainers: - local/snoopy-operator:e2e commands: - command: kubectl apply -f ./tests/_build/manifests/snoopy-operator.yaml - - command: sleep 10s - - command: kubectl get deployment -n snoopy-operator - - command: sleep 10s - command: kubectl get pods -n snoopy-operator - - command: sleep 10s - - command: kubectl get pods -n snoopy-operator - - command: sleep 20s - - command: kubectl get pods -n snoopy-operator - - command: sleep 20s - command: kubectl wait --timeout=5m --for=condition=available deployment snoopy-operator -n snoopy-operator - command: sleep 5s testDirs: - ./tests/e2e/ -timeout: 150 +timeout: 240 From 13f99aba225136787f4438eec6a22d9cdd05b4bb Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Thu, 3 Mar 2022 11:33:03 +0100 Subject: [PATCH 17/19] Fixing jobs folder Signed-off-by: Yuri Sa --- tests/e2e/snoopyjob-tcpdump/00-assert.yaml | 13 +++++++++++++ tests/e2e/snoopyjob-tcpdump/00-install.yaml | 14 ++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/e2e/snoopyjob-tcpdump/00-assert.yaml create mode 100644 tests/e2e/snoopyjob-tcpdump/00-install.yaml diff --git a/tests/e2e/snoopyjob-tcpdump/00-assert.yaml b/tests/e2e/snoopyjob-tcpdump/00-assert.yaml new file mode 100644 index 0000000..35d9e37 --- /dev/null +++ b/tests/e2e/snoopyjob-tcpdump/00-assert.yaml @@ -0,0 +1,13 @@ +apiVersion: job.fennecproject.io/v1alpha1 +kind: SnoopyJob +metadata: + name: snoopy-samplejob +spec: + args: -i eth0 -U -w - + command: tcpdump + labelSelector: + networkMonitor: "true" + targetNamespace: cnf-telco + timer: 30s +status: + cronJobList: \ No newline at end of file diff --git a/tests/e2e/snoopyjob-tcpdump/00-install.yaml b/tests/e2e/snoopyjob-tcpdump/00-install.yaml new file mode 100644 index 0000000..5fb69b0 --- /dev/null +++ b/tests/e2e/snoopyjob-tcpdump/00-install.yaml @@ -0,0 +1,14 @@ +apiVersion: job.fennecproject.io/v1alpha1 +kind: SnoopyJob +metadata: + name: snoopy-samplejob +spec: + command: "tcpdump" + args: "-n -i eth0" + labelSelector: { + networkMonitor: "true", + } + targetNamespace: cnf-telco + timer: "30s" + dataServiceIP: "snoopy-data-svc.snoopy-operator.svc.cluster.local" + dataServicePort: "51001" \ No newline at end of file From 55cb1e7bf9205ed9d0159bcace0838863afb18cd Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Thu, 3 Mar 2022 12:13:12 +0100 Subject: [PATCH 18/19] Changing timeout Signed-off-by: Yuri Sa --- kuttl-test.yaml | 2 +- tests/e2e/00-assert.yaml | 13 ------------- tests/e2e/00-install.yaml | 14 -------------- 3 files changed, 1 insertion(+), 28 deletions(-) delete mode 100644 tests/e2e/00-assert.yaml delete mode 100644 tests/e2e/00-install.yaml diff --git a/kuttl-test.yaml b/kuttl-test.yaml index d43070c..05e3759 100644 --- a/kuttl-test.yaml +++ b/kuttl-test.yaml @@ -11,4 +11,4 @@ commands: - command: sleep 5s testDirs: - ./tests/e2e/ -timeout: 240 +timeout: 300 diff --git a/tests/e2e/00-assert.yaml b/tests/e2e/00-assert.yaml deleted file mode 100644 index 35d9e37..0000000 --- a/tests/e2e/00-assert.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: job.fennecproject.io/v1alpha1 -kind: SnoopyJob -metadata: - name: snoopy-samplejob -spec: - args: -i eth0 -U -w - - command: tcpdump - labelSelector: - networkMonitor: "true" - targetNamespace: cnf-telco - timer: 30s -status: - cronJobList: \ No newline at end of file diff --git a/tests/e2e/00-install.yaml b/tests/e2e/00-install.yaml deleted file mode 100644 index 5fb69b0..0000000 --- a/tests/e2e/00-install.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: job.fennecproject.io/v1alpha1 -kind: SnoopyJob -metadata: - name: snoopy-samplejob -spec: - command: "tcpdump" - args: "-n -i eth0" - labelSelector: { - networkMonitor: "true", - } - targetNamespace: cnf-telco - timer: "30s" - dataServiceIP: "snoopy-data-svc.snoopy-operator.svc.cluster.local" - dataServicePort: "51001" \ No newline at end of file From 39557971d3a1f335dc10967dd0c80acedf86abb9 Mon Sep 17 00:00:00 2001 From: Yuri Sa Date: Fri, 4 Mar 2022 12:20:11 +0100 Subject: [PATCH 19/19] Debugging tests Signed-off-by: Yuri Sa --- kuttl-test.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kuttl-test.yaml b/kuttl-test.yaml index 05e3759..471ef2d 100644 --- a/kuttl-test.yaml +++ b/kuttl-test.yaml @@ -7,6 +7,15 @@ kindContainers: commands: - command: kubectl apply -f ./tests/_build/manifests/snoopy-operator.yaml - command: kubectl get pods -n snoopy-operator + - command: sleep 5s + - command: kubectl get pods -n snoopy-operator + - command: sleep 10s + - command: kubectl get pods -n snoopy-operator + - command: sleep 10s + - command: kubectl get pods -n snoopy-operator + - command: sleep 10s + - command: kubectl get pods -n snoopy-operator + - command: sleep 10s - command: kubectl wait --timeout=5m --for=condition=available deployment snoopy-operator -n snoopy-operator - command: sleep 5s testDirs: