Skip to content

Commit 47fda5a

Browse files
committed
Remove gNMI functionality from e2e tests
e2e tests should only evaluate the correct deployment of the operator as defined by the kubebuilder markers. Hence, in this commit we remove all the gNMI related infrastructure from the e2e tests. The current integration tests with the gNMI test server will be later moved into its own space within the project. The tests will use an `envtest` environment, removing the need to deploy a cluster to evaluate that the workflow from k8s resource to provider payload is correctly implemented: no need to have it as a module. The standalone main.go and Dockerfile are removed. Removed the HTTP end-point as this is no longer needed. We relocate the txtar test fixtures from test/e2e/testdata/ to test/gnmi/testdata/, where the gNMI integration tests will live. The default profile in kustomize now has prometheus enabled by default. With this change we can eliminate some code and remove the Makefile targets that modify the profile when running the e2e tests. Allow overriding the Prometheus Operator and cert-manager installation URLs via environment variables PROMETHEUS_OPERATOR_URL and CERT_MANAGER_URL. Signed-off-by: Pujol <enric.pujol@sap.com>
1 parent 51e0721 commit 47fda5a

24 files changed

Lines changed: 201 additions & 523 deletions

Makefile

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ default: build-all
3636
# Image to use all building/pushing image targets
3737
IMG ?= controller:latest
3838

39+
# E2E test dependency versions
40+
E2E_PROMETHEUS_OPERATOR_VERSION ?= v0.82.2
41+
E2E_CERTMANAGER_VERSION ?= v1.17.2
42+
3943
# CONTAINER_TOOL defines the container tool to be used for building images.
4044
# The default is docker, but it can be overridden to use other tools (i.e. podman or nerdctl).
4145
CONTAINER_TOOL ?= docker
@@ -83,7 +87,14 @@ test-e2e: FORCE
8387
exit 1; \
8488
}
8589
@printf "\e[1;36m>> go test ./test/e2e/ -v -ginkgo.v\e[0m\n"
86-
@KIND_CLUSTER=$(KIND_CLUSTER) go test ./test/e2e/ -v -ginkgo.v
90+
@KIND_CLUSTER=$(KIND_CLUSTER) \
91+
E2E_PROMETHEUS_OPERATOR_VERSION=$(E2E_PROMETHEUS_OPERATOR_VERSION) \
92+
E2E_CERTMANAGER_VERSION=$(E2E_CERTMANAGER_VERSION) \
93+
go test ./test/e2e/ -v -ginkgo.v
94+
95+
# Run integration tests for gNMI.
96+
test-gnmi: FORCE
97+
@printf "\e[1;33m>> gNMI integration tests not yet implemented\e[0m\n"
8798

8899
docker-build: FORCE
89100
@printf "\e[1;36m>> $(CONTAINER_TOOL) build --tag=$(IMG) .\e[0m\n"
@@ -159,16 +170,6 @@ netop-provider:
159170
@printf "\e[1;36m>> ./build/netop-provider --help\e[0m\n"
160171
@./build/netop-provider --help
161172

162-
TEST_SERVER_IMG ?= ghcr.io/ironcore-dev/gnmi-test-server:latest
163-
164-
docker-build-test-gnmi-server: FORCE
165-
@printf "\e[1;36m>> $(CONTAINER_TOOL) build --tag=$(TEST_SERVER_IMG) ./test/gnmi\e[0m\n"
166-
@$(CONTAINER_TOOL) build --tag=$(TEST_SERVER_IMG) ./test/gnmi
167-
168-
docker-run-test-gnmi-server: FORCE docker-build-test-gnmi-server
169-
@printf "\e[1;36m>> $(CONTAINER_TOOL) run -p 8000:8000 -p 9339:9339 $(TEST_SERVER_IMG)\e[0m\n"
170-
@$(CONTAINER_TOOL) run --rm -p 8000:8000 -p 9339:9339 $(TEST_SERVER_IMG)
171-
172173
# TEST_LAB_IMG defines the image to used for packaging the lab tests.
173174
TEST_LAB_IMG ?= ghcr.io/ironcore-dev/network-operator-lab-test:latest
174175

@@ -274,9 +275,9 @@ check: FORCE static-check build/cover.html build-all
274275

275276
generate: install-controller-gen
276277
@printf "\e[1;36m>> controller-gen\e[0m\n"
277-
@controller-gen crd rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases output:rbac:artifacts:config=config/rbac
278-
@controller-gen object:headerFile="hack/boilerplate.go.txt",year=$(YEAR) paths="./..."
279-
@controller-gen applyconfiguration:headerFile="hack/boilerplate.go.txt" paths="./..."
278+
@controller-gen crd rbac:roleName=manager-role webhook paths="{./api/...,./internal/...,./cmd/...}" output:crd:artifacts:config=config/crd/bases output:rbac:artifacts:config=config/rbac
279+
@controller-gen object:headerFile="hack/boilerplate.go.txt",year=$(YEAR) paths="{./api/...,./internal/...,./cmd/...}"
280+
@controller-gen applyconfiguration:headerFile="hack/boilerplate.go.txt" paths="{./api/...,./internal/...,./cmd/...}"
280281

281282
run-golangci-lint: FORCE install-golangci-lint
282283
@printf "\e[1;36m>> golangci-lint\e[0m\n"

Makefile.maker.yaml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ golangciLint:
3030

3131
shellCheck:
3232
ignorePaths:
33-
- 'docs/node_modules/*'
33+
- "docs/node_modules/*"
3434

3535
goReleaser:
3636
createConfig: true
3737

3838
license:
3939
addHeaders: true
4040
checkDependencies: true
41-
copyright: 'SAP SE or an SAP affiliate company and IronCore contributors'
41+
copyright: "SAP SE or an SAP affiliate company and IronCore contributors"
4242
spdx: Apache-2.0
4343

4444
nix:
@@ -54,7 +54,7 @@ renovate:
5454
- felix-kaestner
5555

5656
testPackages:
57-
except: '/test'
57+
except: "/test"
5858

5959
githubWorkflow:
6060
ci:
@@ -69,12 +69,16 @@ githubWorkflow:
6969
enabled: false
7070

7171
variables:
72-
GO_BUILDENV: 'CGO_ENABLED=0'
72+
GO_BUILDENV: "CGO_ENABLED=0"
7373

7474
verbatim: |
7575
# Image to use all building/pushing image targets
7676
IMG ?= controller:latest
7777
78+
# E2E test dependency versions
79+
E2E_PROMETHEUS_OPERATOR_VERSION ?= v0.82.2
80+
E2ECERTMANAGER_VERSION ?= v1.17.2
81+
7882
# CONTAINER_TOOL defines the container tool to be used for building images.
7983
# The default is docker, but it can be overridden to use other tools (i.e. podman or nerdctl).
8084
CONTAINER_TOOL ?= docker
@@ -122,7 +126,14 @@ verbatim: |
122126
exit 1; \
123127
}
124128
@printf "\e[1;36m>> go test ./test/e2e/ -v -ginkgo.v\e[0m\n"
125-
@KIND_CLUSTER=$(KIND_CLUSTER) go test ./test/e2e/ -v -ginkgo.v
129+
@KIND_CLUSTER=$(KIND_CLUSTER) \
130+
E2E_PROMETHEUS_OPERATOR_VERSION=$(E2E_PROMETHEUS_OPERATOR_VERSION) \
131+
E2E_CERTMANAGER_VERSION=$(E2E_CERTMANAGER_VERSION) \
132+
go test ./test/e2e/ -v -ginkgo.v
133+
134+
# Run integration tests for gNMI.
135+
test-gnmi: FORCE
136+
@printf "\e[1;33m>> gNMI integration tests not yet implemented\e[0m\n"
126137
127138
docker-build: FORCE
128139
@printf "\e[1;36m>> $(CONTAINER_TOOL) build --tag=$(IMG) .\e[0m\n"

Tiltfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ local_resource('controller-gen', 'make generate', ignore=['**/*/zz_generated.dee
2020
'api/', 'cmd/', 'hack/', 'internal/', 'go.mod', 'go.sum', 'Makefile',
2121
])
2222

23-
docker_build('ghcr.io/ironcore-dev/gnmi-test-server:latest', './test/gnmi')
24-
2523
provider = os.getenv('PROVIDER', 'openconfig')
2624

2725
manager = kustomize('config/develop')

config/develop/gnmi-test-server.yaml

Lines changed: 0 additions & 83 deletions
This file was deleted.

config/develop/kustomization.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
resources:
22
- ../default
3-
- gnmi-test-server.yaml
43

54
patches:
65
- path: manager_patch.yaml

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ require (
1616
github.com/sapcc/go-api-declarations v1.24.0
1717
github.com/stretchr/testify v1.11.1
1818
github.com/tidwall/gjson v1.19.0
19+
github.com/tidwall/sjson v1.2.5
1920
go.uber.org/automaxprocs v1.6.0
2021
go.uber.org/zap v1.28.0
2122
golang.org/x/crypto v0.54.0
22-
golang.org/x/tools v0.48.0
2323
google.golang.org/grpc v1.82.0
2424
google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af
2525
k8s.io/api v0.36.0
@@ -109,6 +109,7 @@ require (
109109
golang.org/x/term v0.45.0 // indirect
110110
golang.org/x/text v0.40.0 // indirect
111111
golang.org/x/time v0.15.0 // indirect
112+
golang.org/x/tools v0.48.0 // indirect
112113
gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect
113114
google.golang.org/genproto/googleapis/api v0.0.0-20260414002931-afd174a4e478 // indirect
114115
google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/e2e/e2e_suite_test.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ var (
3030
// with the code source changes to be tested.
3131
const image = "ghcr.io/ironcore-dev/network-operator:latest"
3232

33-
// serverImage is the name of the image which will be built and loaded
34-
// with the gNMI test server.
35-
const serverImage = "ghcr.io/ironcore-dev/gnmi-test-server:latest"
36-
3733
// TestE2E runs the end-to-end (e2e) test suite for the project. These tests execute in an isolated,
3834
// temporary environment to validate project changes with the purposed to be used in CI jobs.
3935
// The default setup requires Kind, builds/loads the Manager Docker image locally, and installs
@@ -61,15 +57,6 @@ var _ = BeforeSuite(func(ctx SpecContext) {
6157
err = LoadImageToKindClusterWithName(ctx, image)
6258
ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to load the manager(Operator) image into Kind")
6359

64-
By("building the gnmi-test-server image")
65-
cmd = exec.CommandContext(ctx, "make", "docker-build-test-gnmi-server", "TEST_SERVER_IMG="+serverImage)
66-
_, err = Run(cmd)
67-
ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to build the gnmi-test-server image")
68-
69-
By("loading the gnmi-test-server image on Kind")
70-
err = LoadImageToKindClusterWithName(ctx, serverImage)
71-
ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to load the gnmi-test-server image into Kind")
72-
7360
// The tests-e2e are intended to run on a temporary cluster that is created and destroyed for testing.
7461
// To prevent errors when tests run in environments with Prometheus or CertManager already installed,
7562
// we check for their presence before execution.

0 commit comments

Comments
 (0)