Skip to content

Conversation

@Richard87
Copy link
Contributor

@Richard87 Richard87 commented Nov 7, 2025

Created with this prompt:

Create a new folder called e2e which uses go testing library to set up a kind cluster, installs a helm chart in it (based on helm template radix-operator --set "rbac.createApp.groups[0]"=123 charts/radix-operator) and configures a kubernetes client for integration tests against it.

The first test is for RadixRegistration should work, and fail (we will test the admission webhook)

Create multiple tasks with specific part goals

TODO:

  • Fix missing ServiceMonitor CRD failure

First run:

make test-e2e

cd e2e && go test -v -timeout 30m ./...
Creating cluster "radix-operator-e2e" ...
 • Ensuring node image (kindest/node:v1.32.0) 🖼  ...
 ✓ Ensuring node image (kindest/node:v1.32.0) 🖼
 • Preparing nodes 📦   ...
 ✓ Preparing nodes 📦 
 • Writing configuration 📜  ...
 ✓ Writing configuration 📜
 • Starting control-plane 🕹️  ...
 ✓ Starting control-plane 🕹️
 • Installing CNI 🔌  ...
 ✓ Installing CNI 🔌
 • Installing StorageClass 💾  ...
 ✓ Installing StorageClass 💾
 • Waiting ≤ 5m0s for control-plane = Ready ⏳  ...
 ✓ Waiting ≤ 5m0s for control-plane = Ready ⏳
 • Ready after 16s 💚
Set kubectl context to "kind-radix-operator-e2e"
You can now use your cluster with:

kubectl cluster-info --context kind-radix-operator-e2e --kubeconfig /tmp/kind-kubeconfig-3536424627/kubeconfig

Have a nice day! 👋
Installing Prometheus Operator CRDs version v0.76.0...
customresourcedefinition.apiextensions.k8s.io/alertmanagerconfigs.monitoring.coreos.com created
customresourcedefinition.apiextensions.k8s.io/alertmanagers.monitoring.coreos.com created
customresourcedefinition.apiextensions.k8s.io/podmonitors.monitoring.coreos.com created
customresourcedefinition.apiextensions.k8s.io/probes.monitoring.coreos.com created
customresourcedefinition.apiextensions.k8s.io/prometheusagents.monitoring.coreos.com created
customresourcedefinition.apiextensions.k8s.io/prometheuses.monitoring.coreos.com created
customresourcedefinition.apiextensions.k8s.io/prometheusrules.monitoring.coreos.com created
customresourcedefinition.apiextensions.k8s.io/scrapeconfigs.monitoring.coreos.com created
customresourcedefinition.apiextensions.k8s.io/servicemonitors.monitoring.coreos.com created
customresourcedefinition.apiextensions.k8s.io/thanosrulers.monitoring.coreos.com created
serviceaccount/radix-operator created
secret/radix-known-hosts-git created
configmap/radix-config created
configmap/radix-operator-ingress-configmap created
configmap/seccomp-allow-buildah created
customresourcedefinition.apiextensions.k8s.io/radixalerts.radix.equinor.com created
customresourcedefinition.apiextensions.k8s.io/radixapplications.radix.equinor.com created
customresourcedefinition.apiextensions.k8s.io/radixbatches.radix.equinor.com created
customresourcedefinition.apiextensions.k8s.io/radixdeployments.radix.equinor.com created
customresourcedefinition.apiextensions.k8s.io/radixdnsaliases.radix.equinor.com created
customresourcedefinition.apiextensions.k8s.io/radixenvironments.radix.equinor.com created
customresourcedefinition.apiextensions.k8s.io/radixjobs.radix.equinor.com created
customresourcedefinition.apiextensions.k8s.io/radixregistrations.radix.equinor.com created
clusterrole.rbac.authorization.k8s.io/radix-operator-view created
clusterrole.rbac.authorization.k8s.io/radix-operator-edit created
clusterrole.rbac.authorization.k8s.io/radix-app-reader-envs created
clusterrole.rbac.authorization.k8s.io/radix-app-reader created
clusterrole.rbac.authorization.k8s.io/radix-webhook created
clusterrole.rbac.authorization.k8s.io/radix-api created
clusterrole.rbac.authorization.k8s.io/radix-access-validation created
clusterrole.rbac.authorization.k8s.io/radix-job-scheduler created
clusterrole.rbac.authorization.k8s.io/radix-operator created
clusterrole.rbac.authorization.k8s.io/radix-pipeline-app created
clusterrole.rbac.authorization.k8s.io/radix-pipeline-env created
clusterrole.rbac.authorization.k8s.io/radix-platform-user created
clusterrole.rbac.authorization.k8s.io/radix-app-admin created
clusterrole.rbac.authorization.k8s.io/radix-app-admin-envs created
clusterrolebinding.rbac.authorization.k8s.io/radix-operator created
clusterrolebinding.rbac.authorization.k8s.io/radix-platform-user-binding created
service/radix-operator created
daemonset.apps/copy-seccomp-profile created
deployment.apps/radix-operator created
servicemonitor.monitoring.coreos.com/radix-operator created
=== RUN   TestExample
    example_test.go:16: This is an example test, not meant to be run
--- SKIP: TestExample (0.00s)
=== RUN   TestRadixRegistrationWebhook
=== RUN   TestRadixRegistrationWebhook/should_reject_invalid_RadixRegistration
    radix_registration_test.go:50: Validation error (expected): RadixRegistration.radix.equinor.com "test-invalid-rr" is invalid: [spec.cloneURL: Invalid value: "": spec.cloneURL in body should match '^[email protected]:[\w-]+/[\w-]+.git$', spec.configBranch: Invalid value: "string": failed rule: !(  self == '@' ||  self == '' )]
=== RUN   TestRadixRegistrationWebhook/should_reject_RadixRegistration_with_invalid_CloneURL
    radix_registration_test.go:82: Validation error (expected): RadixRegistration.radix.equinor.com "test-invalid-clone-url" is invalid: spec.cloneURL: Invalid value: "not-a-valid-github-url": spec.cloneURL in body should match '^[email protected]:[\w-]+/[\w-]+.git$'
=== RUN   TestRadixRegistrationWebhook/should_accept_valid_RadixRegistration
    radix_registration_test.go:115: Successfully created RadixRegistration: test-valid-rr
--- PASS: TestRadixRegistrationWebhook (0.03s)
    --- PASS: TestRadixRegistrationWebhook/should_reject_invalid_RadixRegistration (0.02s)
    --- PASS: TestRadixRegistrationWebhook/should_reject_RadixRegistration_with_invalid_CloneURL (0.00s)
    --- PASS: TestRadixRegistrationWebhook/should_accept_valid_RadixRegistration (0.01s)
=== RUN   TestRadixRegistrationCRUD
=== RUN   TestRadixRegistrationCRUD/should_list_RadixRegistrations
    radix_registration_test.go:153: Found 0 RadixRegistrations
--- PASS: TestRadixRegistrationCRUD (0.00s)
    --- PASS: TestRadixRegistrationCRUD/should_list_RadixRegistrations (0.00s)
PASS
ok      github.com/equinor/radix-operator/e2e   35.538s

@Richard87 Richard87 marked this pull request as draft November 7, 2025 10:11
@Richard87 Richard87 requested a review from Copilot November 7, 2025 12:58
@Richard87 Richard87 self-assigned this Nov 7, 2025
@Richard87 Richard87 linked an issue Nov 7, 2025 that may be closed by this pull request
@Richard87 Richard87 marked this pull request as ready for review November 7, 2025 12:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces end-to-end testing infrastructure using KIND (Kubernetes in Docker) for the Radix Operator. The implementation creates a test framework that spins up a KIND cluster, installs the radix-operator Helm chart with Prometheus Operator CRDs, and executes integration tests against RadixRegistration resources to validate admission webhook behavior.

Key changes:

  • New e2e testing framework with KIND cluster management and automated Helm chart installation
  • Comprehensive validation tests for RadixRegistration CRD including webhook validation, immutability rules, and CRUD operations
  • CI/CD integration with GitHub Actions workflow for automated e2e testing

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
e2e/setup_test.go TestMain setup managing KIND cluster lifecycle, Prometheus CRD installation, and test infrastructure initialization
e2e/radix_registration_validation_test.go Extensive validation tests covering CloneURL patterns, ConfigBranch rules, field immutability, and AppID uniqueness
e2e/radix_registration_test.go Basic webhook validation tests and CRUD operations for RadixRegistration resources
e2e/internal/prometheus_installer.go Prometheus Operator CRD installation utility with dynamic version detection
e2e/internal/kind_cluster.go KIND cluster creation, deletion, and kubeconfig management
e2e/internal/helm_installer.go Helm chart installation wrapper with custom value configuration
e2e/example_test.go Example test demonstrating e2e testing patterns and best practices
e2e/README.md Comprehensive documentation for running and writing e2e tests
e2e/IMPLEMENTATION.md Technical implementation details and architecture documentation
e2e/.gitignore Git ignore rules for test artifacts and temporary files
Makefile New test-e2e target and updated test target to exclude e2e tests
.github/workflows/pr.yml New integration-test job for automated e2e testing in CI

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@nilsgstrabo nilsgstrabo 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 comments we can discuss

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Richard87 Richard87 merged commit 6cc7b29 into master Nov 17, 2025
21 of 22 checks passed
@Richard87 Richard87 deleted the e2e branch November 17, 2025 13:21
This was referenced Nov 17, 2025
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.

Create testing framework for admission webhook

3 participants