Skip to content
Open
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
22 changes: 17 additions & 5 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,14 @@ jobs:
- name: Run e2e tests
env:
KUBECONFIG: ${{ github.workspace }}/kubeconfig
HELM_CHART: ${{ github.workspace }}/deployments/helm/nvidia-device-plugin
E2E_IMAGE_REPO: ghcr.io/nvidia/k8s-device-plugin
E2E_IMAGE_TAG: ${{ inputs.version }}
E2E_IMAGE_PULL_POLICY: Always
NVIDIA_DRIVER_ENABLED: true
LOG_ARTIFACTS: ${{ github.workspace }}/e2e_logs
run: |
make test-e2e
make -f tests/e2e/Makefile test

- name: Archive test logs
if: ${{ failure() }}
Expand All @@ -72,6 +75,13 @@ jobs:
path: ./e2e_logs/
retention-days: 15

- name: Archive Ginkgo logs
uses: actions/upload-artifact@v4
with:
name: ginkgo-logs
path: ginkgo.json
retention-days: 15

- name: Send Slack alert notification
id: slack
if: false
Expand All @@ -80,8 +90,10 @@ jobs:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SUMMARY_URL: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
slack-message: |
:x: On repository ${{ github.repository }} the Workflow *${{ github.workflow }}* has failed.
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: ${{ secrets.SLACK_CHANNEL_ID }}
text: ":x: On repository ${{ github.repository }} the Workflow *${{ github.workflow }}* has failed.

Details: ${{ env.SUMMARY_URL }}
Details: ${{ env.SUMMARY_URL }}"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
deployments/helm/gpu-feature-discovery
cmd/gpu-feature-discovery/gfd-test-loop
e2e_logs

bin
*.out
*.log
ginkgo.json
25 changes: 25 additions & 0 deletions testdata/job-1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: batch/v1
kind: Job
metadata:
name: j-e2e-1
labels:
app.nvidia.com: k8s-device-plugin-test-app
spec:
template:
metadata:
name: gpu-pod
spec:
restartPolicy: Never
containers:
- name: cuda-container
image: nvcr.io/nvidia/k8s/cuda-sample:nbody-cuda11.7.1-ubuntu18.04
args:
- "--benchmark"
- "--numbodies=10000"
resources:
limits:
nvidia.com/gpu: "1"
tolerations:
- key: "nvidia.com/gpu"
operator: "Exists"
effect: "NoSchedule"
44 changes: 24 additions & 20 deletions tests/e2e/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -20,29 +20,33 @@ GO_TEST_TIMEOUT ?= 30m

include $(CURDIR)/versions.mk

DRIVER_ENABLED ?= true
NVIDIA_DRIVER_ENABLED ?= true

E2E_IMAGE_REPO ?= $(REGISTRY)/$(DRIVER_NAME)
E2E_IMAGE_TAG ?= $(VERSION)
E2E_IMAGE_PULL_POLICY ?= IfNotPresent
HELM_CHART ?= $(CURDIR)/deployments/helm/nvidia-device-plugin
LOG_ARTIFACTS ?= $(CURDIR)/e2e_logs

.PHONY: test
test:
@if [ -z ${KUBECONFIG} ]; then \
echo "[ERR] KUBECONFIG missing, must be defined"; \
exit 1; \
fi
cd $(CURDIR)/tests/e2e && $(GO_CMD) test -timeout $(GO_TEST_TIMEOUT) -v . -args \
-kubeconfig=$(KUBECONFIG) \
-driver-enabled=$(DRIVER_ENABLED) \
-image.repo=$(E2E_IMAGE_REPO) \
-image.tag=$(E2E_IMAGE_TAG) \
-image.pull-policy=$(E2E_IMAGE_PULL_POLICY) \
-log-artifacts=$(LOG_ARTIFACTS) \
-helm-chart=$(HELM_CHART) \
-helm-log-file=$(LOG_ARTIFACTS)/helm.log \
-ginkgo.focus="\[nvidia\]" \
-test.timeout=1h \
-ginkgo.v
# Test configuration
GINKGO_COMMON_ARGS := -v --fail-on-pending --randomize-all --trace
GINKGO_REPORT_ARGS := --json-report=$(LOG_ARTIFACTS)/report.json --junit-report=$(LOG_ARTIFACTS)/junit.xml

.PHONY: ginkgo test clean-artifacts

GINKGO_VERSION = $(shell grep -Eo "github.com/onsi/ginkgo/v2.*$$" ./tests/go.mod | sed -e 's&github.com/onsi/ginkgo/v2[[:space:]]&&g')
ginkgo:
mkdir -p $(CURDIR)/bin
GOBIN=$(CURDIR)/bin go install github.com/onsi/ginkgo/v2/ginkgo@$(GINKGO_VERSION)

# Create artifacts directory
$(LOG_ARTIFACTS):
mkdir -p $(LOG_ARTIFACTS)

# Clean artifacts
clean-artifacts:
rm -rf $(LOG_ARTIFACTS)

# Run tests
test: ginkgo $(LOG_ARTIFACTS)
$(CURDIR)/bin/ginkgo $(GINKGO_COMMON_ARGS) $(GINKGO_REPORT_ARGS) $(GINKGO_ARGS) ./tests/e2e/...
60 changes: 0 additions & 60 deletions tests/e2e/common/gpu_job.go

This file was deleted.

Loading
Loading