|
| 1 | +<!-- |
| 2 | +SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. |
| 3 | +SPDX-License-Identifier: Apache-2.0 |
| 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 | + |
| 18 | +# NVIDIA DRA GPU Driver E2E Test Suite |
| 19 | + |
| 20 | +This directory contains the end-to-end (E2E) test suite for the [NVIDIA Kubernetes DRA GPU Driver](https://github.com/NVIDIA/k8s-dra-driver-gpu). It is implemented using [Ginkgo v2](https://onsi.github.io/ginkgo/) and [Gomega](https://onsi.github.io/gomega/) and validates driver deployment and functionality in a real Kubernetes cluster. |
| 21 | + |
| 22 | +## Requirements |
| 23 | + |
| 24 | +- Kubernetes cluster (v1.26+ recommended) |
| 25 | +- Configured `KUBECONFIG` pointing to target cluster |
| 26 | +- Go 1.21+ |
| 27 | +- Required environment variables (see below) |
| 28 | + |
| 29 | +## Environment Variables |
| 30 | + |
| 31 | +| Variable | Required | Description | |
| 32 | +|----------------------------|----------|----------------------------------------------------------| |
| 33 | +| `KUBECONFIG` | ✅ | Path to kubeconfig file | |
| 34 | +| `HELM_CHART` | ✅ | Path or name of the Helm chart for the DRA driver | |
| 35 | +| `E2E_IMAGE_REPO` | ✅ | Container image repository for the driver | |
| 36 | +| `E2E_IMAGE_TAG` | ✅ | Image tag for the driver | |
| 37 | +| `E2E_IMAGE_PULL_POLICY` | ✅ | Pull policy for the image (e.g., `IfNotPresent`) | |
| 38 | +| `E2E_TIMEOUT_SECONDS` | ❌ | Timeout for test suite in seconds (default: 1800) | |
| 39 | +| `E2E_HOST_MANAGED_DRIVERS` | ❌ | Whether host manages the NVIDIA driver (default: true) | |
| 40 | +| `LOG_ARTIFACTS_DIR` | ❌ | Path to store logs and diagnostics (default: ./e2e_logs) | |
| 41 | +| `COLLECT_LOGS_FROM` | ❌ | Namespace or component to collect logs from | |
| 42 | + |
| 43 | +## Makefile Targets |
| 44 | + |
| 45 | +The project includes a `Makefile` with the following targets: |
| 46 | + |
| 47 | +```Makefile |
| 48 | +GINKGO_ARGS ?= |
| 49 | +LOG_ARTIFACTS_DIR ?= $(CURDIR)/e2e_logs |
| 50 | + |
| 51 | +ginkgo: |
| 52 | + mkdir -p $(CURDIR)/bin |
| 53 | + GOBIN=$(CURDIR)/bin go install github.com/onsi/ginkgo/v2/ginkgo@latest |
| 54 | + |
| 55 | +test-e2e: ginkgo |
| 56 | + $(CURDIR)/bin/ginkgo $(GINKGO_ARGS) -v --json-report $(CURDIR)/ginkgo.json ./tests/e2e/... |
| 57 | +``` |
| 58 | + |
| 59 | +## Running the Tests |
| 60 | + |
| 61 | +You can run the test suite using: |
| 62 | + |
| 63 | +```bash |
| 64 | +make test-e2e |
| 65 | +``` |
| 66 | + |
| 67 | +Or manually: |
| 68 | + |
| 69 | +```bash |
| 70 | +make ginkgo |
| 71 | +./bin/ginkgo -v ./tests/e2e |
| 72 | +``` |
| 73 | + |
| 74 | +## Notes |
| 75 | + |
| 76 | +- Each test runs in an isolated namespace and cleans up automatically. |
| 77 | +- Node labels `nvidia.com/gpu.present=true` are applied for scheduling. |
| 78 | +- Helm values can be overridden for container-managed drivers. |
| 79 | + |
| 80 | +## License |
| 81 | + |
| 82 | +Apache 2.0. See [LICENSE](../LICENSE). |
0 commit comments