Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ default: build-all
# Image to use all building/pushing image targets
IMG ?= controller:latest

# E2E test dependency versions
E2E_PROMETHEUS_OPERATOR_VERSION ?= v0.82.2
E2E_CERTMANAGER_VERSION ?= v1.17.2

# CONTAINER_TOOL defines the container tool to be used for building images.
# The default is docker, but it can be overridden to use other tools (i.e. podman or nerdctl).
CONTAINER_TOOL ?= docker
Expand Down Expand Up @@ -83,7 +87,19 @@ test-e2e: FORCE
exit 1; \
}
@printf "\e[1;36m>> go test ./test/e2e/ -v -ginkgo.v\e[0m\n"
@KIND_CLUSTER=$(KIND_CLUSTER) go test ./test/e2e/ -v -ginkgo.v
@KIND_CLUSTER=$(KIND_CLUSTER) \
E2E_PROMETHEUS_OPERATOR_VERSION=$(E2E_PROMETHEUS_OPERATOR_VERSION) \
E2E_CERTMANAGER_VERSION=$(E2E_CERTMANAGER_VERSION) \
go test ./test/e2e/ -v -ginkgo.v

# Run gNMI server unit tests
test-gnmi-unit: FORCE
@printf "\e[1;36m>> go test ./test/gnmi/testserver/...\e[0m\n"
@go test ./test/gnmi/testserver/...

# Run gNMI integration tests (envtest-based)
test-gnmi: FORCE test-gnmi-unit
@printf "\e[1;33m>> gNMI integration tests not yet implemented\e[0m\n"

docker-build: FORCE
@printf "\e[1;36m>> $(CONTAINER_TOOL) build --tag=$(IMG) .\e[0m\n"
Expand Down Expand Up @@ -159,16 +175,6 @@ netop-provider:
@printf "\e[1;36m>> ./build/netop-provider --help\e[0m\n"
@./build/netop-provider --help

TEST_SERVER_IMG ?= ghcr.io/ironcore-dev/gnmi-test-server:latest

docker-build-test-gnmi-server: FORCE
@printf "\e[1;36m>> $(CONTAINER_TOOL) build --tag=$(TEST_SERVER_IMG) ./test/gnmi\e[0m\n"
@$(CONTAINER_TOOL) build --tag=$(TEST_SERVER_IMG) ./test/gnmi

docker-run-test-gnmi-server: FORCE docker-build-test-gnmi-server
@printf "\e[1;36m>> $(CONTAINER_TOOL) run -p 8000:8000 -p 9339:9339 $(TEST_SERVER_IMG)\e[0m\n"
@$(CONTAINER_TOOL) run --rm -p 8000:8000 -p 9339:9339 $(TEST_SERVER_IMG)

# TEST_LAB_IMG defines the image to used for packaging the lab tests.
TEST_LAB_IMG ?= ghcr.io/ironcore-dev/network-operator-lab-test:latest

Expand Down Expand Up @@ -274,9 +280,9 @@ check: FORCE static-check build/cover.html build-all

generate: install-controller-gen
@printf "\e[1;36m>> controller-gen\e[0m\n"
@controller-gen crd rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases output:rbac:artifacts:config=config/rbac
@controller-gen object:headerFile="hack/boilerplate.go.txt",year=$(YEAR) paths="./..."
@controller-gen applyconfiguration:headerFile="hack/boilerplate.go.txt" paths="./..."
@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
@controller-gen object:headerFile="hack/boilerplate.go.txt",year=$(YEAR) paths="{./api/...,./internal/...,./cmd/...}"
@controller-gen applyconfiguration:headerFile="hack/boilerplate.go.txt" paths="{./api/...,./internal/...,./cmd/...}"

run-golangci-lint: FORCE install-golangci-lint
@printf "\e[1;36m>> golangci-lint\e[0m\n"
Expand Down
28 changes: 22 additions & 6 deletions Makefile.maker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ golangciLint:

shellCheck:
ignorePaths:
- 'docs/node_modules/*'
- "docs/node_modules/*"

goReleaser:
createConfig: true

license:
addHeaders: true
checkDependencies: true
copyright: 'SAP SE or an SAP affiliate company and IronCore contributors'
copyright: "SAP SE or an SAP affiliate company and IronCore contributors"
spdx: Apache-2.0

nix:
Expand All @@ -54,7 +54,7 @@ renovate:
- felix-kaestner

testPackages:
except: '/test'
except: "/test"

githubWorkflow:
ci:
Expand All @@ -69,12 +69,16 @@ githubWorkflow:
enabled: false

variables:
GO_BUILDENV: 'CGO_ENABLED=0'
GO_BUILDENV: "CGO_ENABLED=0"

verbatim: |
# Image to use all building/pushing image targets
IMG ?= controller:latest

# E2E test dependency versions
E2E_PROMETHEUS_OPERATOR_VERSION ?= v0.82.2
E2ECERTMANAGER_VERSION ?= v1.17.2

# CONTAINER_TOOL defines the container tool to be used for building images.
# The default is docker, but it can be overridden to use other tools (i.e. podman or nerdctl).
CONTAINER_TOOL ?= docker
Expand Down Expand Up @@ -112,7 +116,7 @@ verbatim: |
@gofumpt -l -w $(shell git ls-files '*.go' | grep -v '^internal/provider/openconfig')

# Run the e2e tests against a k8s cluster.
test-e2e: FORCE
test-e2e: FORCE docker-build
@command -v kind >/dev/null 2>&1 || { \
echo "Kind is not installed. Please install Kind manually."; \
exit 1; \
Expand All @@ -122,7 +126,19 @@ verbatim: |
exit 1; \
}
@printf "\e[1;36m>> go test ./test/e2e/ -v -ginkgo.v\e[0m\n"
@KIND_CLUSTER=$(KIND_CLUSTER) go test ./test/e2e/ -v -ginkgo.v
@KIND_CLUSTER=$(KIND_CLUSTER) \
E2E_PROMETHEUS_OPERATOR_VERSION=$(E2E_PROMETHEUS_OPERATOR_VERSION) \
E2E_CERTMANAGER_VERSION=$(E2E_CERTMANAGER_VERSION) \
go test ./test/e2e/ -v -ginkgo.v

# Run gNMI server unit tests
test-gnmi-unit: FORCE
@printf "\e[1;36m>> go test ./test/gnmi/testserver/...\e[0m\n"
@go test ./test/gnmi/testserver/...

# Run gNMI integration tests (envtest-based)
test-gnmi: FORCE test-gnmi-unit
@printf "\e[1;33m>> gNMI integration tests not yet implemented\e[0m\n"

docker-build: FORCE
@printf "\e[1;36m>> $(CONTAINER_TOOL) build --tag=$(IMG) .\e[0m\n"
Expand Down
2 changes: 1 addition & 1 deletion config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ resources:
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required.
- ../certmanager
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
#- ../prometheus
- ../prometheus
# [METRICS] Expose the controller manager metrics service.
- metrics_service.yaml
# [PROVISIONING] Expose the controller manager provisioning service.
Expand Down
83 changes: 0 additions & 83 deletions config/develop/gnmi-test-server.yaml

This file was deleted.

1 change: 0 additions & 1 deletion config/develop/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
resources:
- ../default
- gnmi-test-server.yaml

patches:
- path: manager_patch.yaml
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ require (
github.com/sapcc/go-api-declarations v1.24.0
github.com/stretchr/testify v1.11.1
github.com/tidwall/gjson v1.19.0
github.com/tidwall/sjson v1.2.5
go.uber.org/automaxprocs v1.6.0
go.uber.org/zap v1.28.0
golang.org/x/crypto v0.53.0
golang.org/x/tools v0.47.0
google.golang.org/grpc v1.82.0
google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af
k8s.io/api v0.36.0
Expand Down Expand Up @@ -109,6 +109,7 @@ require (
golang.org/x/term v0.44.0 // indirect
golang.org/x/text v0.38.0 // indirect
golang.org/x/time v0.15.0 // indirect
golang.org/x/tools v0.47.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260414002931-afd174a4e478 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 1 addition & 21 deletions test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ var (
// with the code source changes to be tested.
const image = "ghcr.io/ironcore-dev/network-operator:latest"

// serverImage is the name of the image which will be built and loaded
// with the gNMI test server.
const serverImage = "ghcr.io/ironcore-dev/gnmi-test-server:latest"

// TestE2E runs the end-to-end (e2e) test suite for the project. These tests execute in an isolated,
// temporary environment to validate project changes with the purposed to be used in CI jobs.
// The default setup requires Kind, builds/loads the Manager Docker image locally, and installs
Expand All @@ -45,31 +41,15 @@ func TestE2E(t *testing.T) {
}

var _ = BeforeSuite(func(ctx SpecContext) {
By("Ensure that Prometheus is enabled")
cwd, err := GetProjectDir()
Expect(err).NotTo(HaveOccurred(), "Failed to get project directory")

err = UncommentCode(cwd+"/config/default/kustomization.yaml", "#- ../prometheus", "#")
Expect(err).NotTo(HaveOccurred(), "Failed to enable Prometheus")

By("building the manager(Operator) image")
cmd := exec.CommandContext(ctx, "make", "docker-build", "IMG="+image)
_, err = Run(cmd)
_, err := Run(cmd)
ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to build the manager(Operator) image")

By("loading the manager(Operator) image on Kind")
err = LoadImageToKindClusterWithName(ctx, image)
ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to load the manager(Operator) image into Kind")

By("building the gnmi-test-server image")
cmd = exec.CommandContext(ctx, "make", "docker-build-test-gnmi-server", "TEST_SERVER_IMG="+serverImage)
_, err = Run(cmd)
ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to build the gnmi-test-server image")

By("loading the gnmi-test-server image on Kind")
err = LoadImageToKindClusterWithName(ctx, serverImage)
ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to load the gnmi-test-server image into Kind")

// The tests-e2e are intended to run on a temporary cluster that is created and destroyed for testing.
// To prevent errors when tests run in environments with Prometheus or CertManager already installed,
// we check for their presence before execution.
Expand Down
Loading
Loading