Skip to content

Commit 0c5eacb

Browse files
Add E2E calling script to hack folder
Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
1 parent fd6ed17 commit 0c5eacb

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ CMDS := $(patsubst ./cmd/%/,%,$(sort $(dir $(wildcard ./cmd/*/))))
3131
CMD_TARGETS := $(patsubst %,cmd-%, $(CMDS))
3232

3333
CHECK_TARGETS := golangci-lint check-generate
34-
MAKE_TARGETS := binaries build build-image check fmt lint-internal test examples cmds coverage generate vendor check-modules $(CHECK_TARGETS)
34+
MAKE_TARGETS := binaries build build-image check fmt lint-internal test examples cmds coverage generate vendor check-modules $(CHECK_TARGETS) ginkgo
3535

3636
TARGETS := $(MAKE_TARGETS) $(CMD_TARGETS)
3737

@@ -47,6 +47,8 @@ CLI_VERSION = $(VERSION)
4747
endif
4848
CLI_VERSION_PACKAGE = $(MODULE)/internal/info
4949

50+
GINKGO_ARGS ?=
51+
5052
binaries: cmds
5153
ifneq ($(PREFIX),)
5254
cmd-%: COMMAND_BUILD_OPTIONS = -o $(PREFIX)/$(*)
@@ -91,6 +93,13 @@ vendor:
9193
check-modules: vendor
9294
git diff --quiet HEAD -- go.mod go.sum vendor
9395

96+
ginkgo: $(CURDIR)/bin/ginkgo
97+
mkdir -p $(CURDIR)/bin
98+
GOBIN=$(CURDIR)/bin go install github.com/onsi/ginkgo/v2/ginkgo@latest
99+
100+
e2e-test: ginkgo
101+
./bin/ginkgo $(GINKGO_ARGS) -v --json-report ginkgo.json ./tests/e2e/...
102+
94103
COVERAGE_FILE := coverage.out
95104
test: build cmds
96105
go test -race -cover -v -coverprofile=$(COVERAGE_FILE) $(MODULE)/...

hack/e2e-test.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
# Copyright 2025 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -o errexit
18+
set -o nounset
19+
set -o pipefail
20+
21+
SOURCE_DIR="$(cd "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
22+
ROOT_DIR="$SOURCE_DIR/.."
23+
24+
GINKGO="$ROOT_DIR"/bin/ginkgo
25+
GINKGO_ARGS=${GINKGO_ARGS:-}
26+
27+
# Check if ginkgo binary is present
28+
if [ ! -f "$GINKGO" ]; then
29+
echo "ginkgo binary not found at $GINKGO, building it"
30+
make ginkgo
31+
fi
32+
33+
HELM_CHART=$ROOT_DIR/deployments/helm/nvidia-dra-driver-gpu
34+
E2E_IMAGE_REPO=${E2E_IMAGE_REPO:-"ghcr.io/nvidia/k8s-dra-driver-gpu"}
35+
E2E_IMAGE_TAG=${E2E_IMAGE_TAG:-"93cd4799-ubi9"}
36+
E2E_IMAGE_PULL_POLICY=${E2E_IMAGE_PULL_POLICY:-"IfNotPresent"}
37+
ENABLE_GFD=${ENABLE_GFD:-"true"}
38+
E2E_HOST_MANAGED_DRIVERS=${E2E_HOST_MANAGED_DRIVERS:-"true"}
39+
40+
export E2E_IMAGE_REPO HELM_CHART E2E_IMAGE_TAG E2E_IMAGE_PULL_POLICY ENABLE_GFD E2E_HOST_MANAGED_DRIVERS
41+
42+
# shellcheck disable=SC2086
43+
make e2e-test

0 commit comments

Comments
 (0)