maruina / kubecon-2024-eu

Building Confidence in Kubernetes Controllers: Lessons Learned from Using E2E-Framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Building Confidence in Kubernetes Controllers: Lessons Learned from Using E2E-Framework

Companion repository for the presentation Building Confidence in Kubernetes Controllers: Lessons Learned from Using E2E-Framework.

Running from a laptop

Running with go test allows to run the code against a target cluster, useful while developing a new test.

kind create cluster
go test -timeout 0 -race -v ./... -args --context kind-kind
?   	github.com/maruina/kubecon-2024-eu/pkg/conditions	[no test files]
?   	github.com/maruina/kubecon-2024-eu/pkg/config	[no test files]
?   	github.com/maruina/kubecon-2024-eu/pkg/resources	[no test files]
?   	github.com/maruina/kubecon-2024-eu/pkg/resources/container	[no test files]
?   	github.com/maruina/kubecon-2024-eu/pkg/resources/pod	[no test files]
=== RUN   TestPodNative
=== RUN   TestPodNative/basic_pod_native
=== RUN   TestPodNative/basic_pod_native/pod_is_ready
=== RUN   TestPodNative/basic_pod_native/environment_variables_are_injected
--- PASS: TestPodNative (6.20s)
    --- PASS: TestPodNative/basic_pod_native (5.13s)
        --- PASS: TestPodNative/basic_pod_native/pod_is_ready (5.01s)
        --- PASS: TestPodNative/basic_pod_native/environment_variables_are_injected (0.09s)
=== RUN   TestPodDns
=== RUN   TestPodDns/dns
=== RUN   TestPodDns/dns/pod_is_ready
=== RUN   TestPodDns/dns/dns_is_resolving
--- PASS: TestPodDns (6.19s)
    --- PASS: TestPodDns/dns (5.16s)
        --- PASS: TestPodDns/dns/pod_is_ready (5.01s)
        --- PASS: TestPodDns/dns/dns_is_resolving (0.14s)
PASS
ok  	github.com/maruina/kubecon-2024-eu	14.350s

Running on a cluster

Run the docker image as a cronjob on a live cluster to run the tests suite.

kubectl apply -f deploy/e2e.yaml

Integrating with CI Visibility

We can generate JUnit XML test reports to integrate with Datadog Test Visibility

Screenshot 2024-03-17 at 13-56-16 CI Tests Datadog

test_details

About

Building Confidence in Kubernetes Controllers: Lessons Learned from Using E2E-Framework

License:Apache License 2.0


Languages

Language:Go 85.3%Language:Dockerfile 8.1%Language:Shell 6.7%