From 4047187889b1ecba67264b1d71f60b396ce0aeac Mon Sep 17 00:00:00 2001 From: Joel Takvorian Date: Thu, 12 Dec 2024 12:47:33 +0100 Subject: [PATCH] Add doc --- README.md | 4 ++++ e2e/README.md | 42 ++++++++++++++++++++++++++++++++++++++++++ e2e/cluster/kind.go | 3 +-- 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 e2e/README.md diff --git a/README.md b/README.md index 7d94c135b..d5c66a89b 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,10 @@ make generate Regularly tested on Fedora. +### Running end-to-end tests + +Refer to the specific documentation: [e2e readme](./e2e/README.md) + ## Known issues ### Extrenal Traffic in Openshift (OVN-Kubernetes CNI) diff --git a/e2e/README.md b/e2e/README.md new file mode 100644 index 000000000..20e70ca99 --- /dev/null +++ b/e2e/README.md @@ -0,0 +1,42 @@ +## eBPF Agent e2e tests + +e2e tests can be run with: + +```bash +make tests-e2e +``` + +If you use podman, you may need to run it as root instead: + +```bash +sudo make tests-e2e +``` + +### What it does + +It builds an image with the current code, including pre-generated BPF bytecode, starts a KIND cluster and deploys the agent on it. It also deploys a typical NetObserv stack, that includes flowlogs-pipeline, Loki and/or Kafka. + +It then runs a couple of smoke tests on that cluster, such as testing sending pings between pods and verifying that the expected flows are created. + +The tests leverage Kube's [e2e-framework](https://github.com/kubernetes-sigs/e2e-framework). They are based on manifest files that you can find in [this directory](./cluster/base/). + +### How to troubleshoot + +During the tests, you can run any `kubectl` command to the KIND cluster. + +If you use podman/root and don't want to open a root session you can simply copy the root kube config: + +```bash +sudo cp /root/.kube/config /tmp/agent-kind-kubeconfig +sudo -E chown $USER:$USER /tmp/agent-kind-kubeconfig +export KUBECONFIG=/tmp/agent-kind-kubeconfig +``` + +Then: + +```bash +$ kubectl get pods +NAME READY STATUS RESTARTS AGE +flp-29bmd 1/1 Running 0 6s +loki-7c98dfd6d4-c8q9m 1/1 Running 0 56s +``` diff --git a/e2e/cluster/kind.go b/e2e/cluster/kind.go index 252bd2422..a36af8f04 100644 --- a/e2e/cluster/kind.go +++ b/e2e/cluster/kind.go @@ -14,13 +14,12 @@ import ( "os" "os/signal" "path" + rt2 "runtime" "sort" "syscall" "testing" "time" - rt2 "runtime" - "github.com/netobserv/netobserv-ebpf-agent/e2e/cluster/tester" "github.com/sirupsen/logrus"