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

Feat E2E CI and an exectuable #10

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

leoarpin
Copy link
Contributor

Created a e2e CI to test the basic functionment of the Kotary operator.

This CI runs when you push a commit. It builds an image from the current files of the repository and run it in a Kind cluster. Then it uses a bash script to make an basic e2e test to verify that everything still works as intended.

The CI test the operator for versions 1.21, 23, 24, and 26 of kubernetes.

The e2e.sh script can also be drectly used if you are already connected to a kubernetes cluster. Be careful, the script run the tests ,using the version of kotary referenced in the deployment.yaml manifest. If you want to test your modifications you will have to build your own image, push it to dockerhub and modify the manifest accordingly.

Copy link

@evrardjp evrardjp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfinished review, sorry for sending it too quickly.

.github/workflows/e2eCI.yaml Outdated Show resolved Hide resolved
e2e/KindConfig/badpod.yml Outdated Show resolved Hide resolved
e2e/KindConfig/pod1.yml Outdated Show resolved Hide resolved
e2e/KindConfig/pod2.yml Outdated Show resolved Hide resolved
e2e/KindConfig/pod3.yml Outdated Show resolved Hide resolved
e2e/KindConfig/pod4.yml Outdated Show resolved Hide resolved
e2e/KindConfig/pod5.yml Outdated Show resolved Hide resolved
Copy link

@evrardjp evrardjp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see comments above.

.github/workflows/e2eCI.yaml Outdated Show resolved Hide resolved
e2e/e2e.sh Outdated
ROOT=$(git rev-parse --show-toplevel) #get root of git repo
QUOTACLAIM='resourcequotaclaims.cagip.github.com'

#clean up function. If you want to totaly remove kotary after test, uncomment the lines

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be a trap.

kubectl apply -f $ROOT/e2e/KotaryService/ConfigMap.yaml -n kube-system

kubectl create ns $NS
while ! kubectl get pods -n kube-system | grep kotary | grep Running > /dev/null ; do echo -e "${BLUE}.... Waiting for Kotary pod to be Running ....${NC}" ; sleep 2; done

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: You could use a different command to ensure 1/1 are running, but this is fine for me.

e2e/e2e.sh Outdated
kubectl apply -f $ROOT/e2e/KotaryService/QuotaClaim.yaml -n $NS && sleep 3
echo -e "${GREEN} -- OK --${NC}\\n"

#echo -e "\\n ${PURPLE}-- Adding a pod with bad image --> should not impact the ressources used --${NC}" && sleep 3

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you remove this?

@@ -0,0 +1,94 @@
#!/bin/bash

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the tests should stop on first error, and throw a recap.

you should probably:

  • set -o errexit,pipefail
  • use a trap (see comment below)
  • add the "recap" of the tests who succeeded/failed in the trap.

After that (and the indentation issues), I think we can merge up this script. In the future, I think it might be more robust to use a different test framework than a self made bash script. (Either a test framework in bash, or a golang test).

@leoarpin leoarpin force-pushed the e2eCI branch 2 times, most recently from ba224df to ffe1829 Compare January 15, 2024 15:50
Features a new e2e CI based on a bash script. the script makes some
tests to verify that the operator is working as intended. It does not go
into really deep tests, this is a way to simulate how a classic user
would use kotary. Mainly used to verify that the operator is working
fine.
Copy link

@evrardjp evrardjp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few last minute things to clean up.

apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: "kindest/node:v1.25.11"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

highly confusing.


- name: testing cluster kinD
run: |
kubectl cluster-info --context kind-chart-testing echo " current-context:" $(kubectl config current-context)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you seme to be using kind-chart-testing or chart-testing... yet:
there is no helm chart testing, and there is no chart-testing name in the config of the cluster.

- name: testing cluster kinD
run: |
kubectl cluster-info --context kind-chart-testing echo " current-context:" $(kubectl config current-context)
kubectl get all --all-namespaces

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessary.


- name: Docker Build image
run: |
docker build -t "ci/kotary:${{ matrix.kubernetes }}" .

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is confusing. When multiple jobs will run together, they will override each other. Let's include a sha.

Without this, 1.24 is deploying 1.25, and the CI would actually
fail.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants