E2E Testing in Kubernetes Beyond Unit Tests with e2e-framework

Carmine Di Monaco

Staff Software Engineer @ SUSE

Golang Roma 30/04/2025

e2e-framework

github.com/kubernetes-sigs/e2e-framework

  • Framework per scrivere ed eseguire e2e-tests di "componenti" che vengono eseguiti in un cluster kubernetes
  • Nato da un SIG di Kubernetes
  • Integrazione con il testing framework standard di Go
  • Supporto a diverse modalita' di provisioning dei cluster di test
  • Ricca API per assertion dello stato del cluster e per il deploy di risorse
  • Astrazioni testing-friendly basate sul client ufficiale di kubernetes

e2e-framework

e2e-framework - demo

Testeremo una policy di Kubewarden - Perche?

  • Artefatto il cui lifecycle si consuma all'interno del cluster ma e' usato da un componente terzo (Kubewarden)
  • Useremo helm per fare il setup del cluster, installaremo Kubewarden e attenderemo la sua installazione prima di cominciare il test
  • Kubewarden e' un prodotto che mi piace

e2e-framework - DEMO

e2e-framework - TIPS AND TRICKS

  • Separare gli e2e-tests con dei buildtag appositi
  • Utilizzare una test suite di testify per astrarre il concetto degli e2e-tests e avere una suite pronta da estendere per i vari casi d'uso
  • Utilizzate lo stesso strumento con cui create dei cluster in development (se ne avete)
  • Debuggate i vostri test con un debugger e fate debugging anche dello stato del cluster
  • Non date ascolto al Signor Bashoni

Chi sono

Carmine Di Monaco

Staff Software Engineer @ SUSE
 

gitbar.it

carmine.dimonaco@gmail.com

carmine.dimonaco@suse.com

@cdimonaco

 

The first thing is deciding what the program should do. If you don’t think carefully about that, it’s going to wind up not doing something that it probably should do or you wind up with an ‘absolute bug-free program’. Because to have a bug, you have to have some notion of what it means for the program to be operating correctly. And there is no precise definition of what it means for the program to be correctly operating — so, well, no bugs. Not a very good situation.

- Leslie Lamport

Grazie

E2E Testing in Kubernetes: Beyond Unit Tests with e2e-framework

By Carmine Di Monaco

E2E Testing in Kubernetes: Beyond Unit Tests with e2e-framework

"Utilizziamo e2e-framework per andare oltre lo unit testing dei componenti Kubernetes. Attraverso una veloce panoramica dello strumento avremo una demo interattiva dove testeremo delle policy Kubewarden all'interno di un vero cluster, utilizzando Helm, dei descrittori custom e puro testing in Go."

  • 33