diff --git a/tests/e2e/Makefile b/tests/e2e/Makefile index cc11366e..c67c5574 100644 --- a/tests/e2e/Makefile +++ b/tests/e2e/Makefile @@ -1,4 +1,5 @@ -# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,34 +13,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -GO_CMD ?= go +.PHONY: test-e2e ginkgo -include $(CURDIR)/versions.mk +GINKGO_ARGS ?= +LOG_ARTIFACTS_DIR ?= $(CURDIR)/e2e_logs -E2E_RUNTIME ?= docker +ginkgo: + mkdir -p $(CURDIR)/bin + GOBIN=$(CURDIR)/bin go install github.com/onsi/ginkgo/v2/ginkgo@latest -E2E_INSTALL_CTK ?= false - -ifeq ($($(DIST)),) -DIST ?= ubuntu20.04 -endif -IMAGE_TAG ?= $(VERSION)-$(DIST) -IMAGE = $(IMAGE_NAME):$(IMAGE_TAG) - -E2E_SSH_KEY ?= -E2E_SSH_USER ?= -E2E_SSH_HOST ?= -E2E_SSH_PORT ?= 22 - -.PHONY: test -test: - cd $(CURDIR)/tests/e2e && $(GO_CMD) test -v . -args \ - -ginkgo.focus="$(E2E_RUNTIME)" \ - -test.timeout=1h \ - -ginkgo.v \ - -install-ctk=$(E2E_INSTALL_CTK) \ - -toolkit-image=$(IMAGE) \ - -ssh-key=$(E2E_SSH_KEY) \ - -ssh-user=$(E2E_SSH_USER) \ - -remote-host=$(E2E_SSH_HOST) \ - -remote-port=$(E2E_SSH_PORT) +test-e2e: ginkgo + $(CURDIR)/bin/ginkgo $(GINKGO_ARGS) -v --json-report ginkgo.json ./tests/e2e/... diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index e31a88f0..3d16bf26 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -1,24 +1,28 @@ /* -* Copyright (c) 2025, 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. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package e2e import ( "context" - "flag" + "os" + "path/filepath" + "runtime" + "strconv" "testing" . "github.com/onsi/ginkgo/v2" @@ -31,27 +35,27 @@ var ( installCTK bool - image string + ImageRepo string + ImageTag string - sshKey string - sshUser string - host string - sshPort string + sshKey string + sshUser string + host string + sshPort string + cwd string + packagePath string + + runner Runner ) -func init() { - flag.BoolVar(&installCTK, "install-ctk", false, "Install the NVIDIA Container Toolkit") - flag.StringVar(&image, "toolkit-image", "", "Repository of the image to test") - flag.StringVar(&sshKey, "ssh-key", "", "SSH key to use for remote login") - flag.StringVar(&sshUser, "ssh-user", "", "SSH user to use for remote login") - flag.StringVar(&host, "remote-host", "", "Hostname of the remote machine") - flag.StringVar(&sshPort, "remote-port", "22", "SSH port to use for remote login") -} - func TestMain(t *testing.T) { - suiteName := "NVIDIA Container Toolkit E2E" + suiteName := "E2E NVIDIA Container Toolkit" RegisterFailHandler(Fail) + + ctx = context.Background() + getTestEnv() + RunSpecs(t, suiteName, ) @@ -59,5 +63,77 @@ func TestMain(t *testing.T) { // BeforeSuite runs before the test suite var _ = BeforeSuite(func() { - ctx = context.Background() + runner = NewRunner( + WithHost(host), + WithPort(sshPort), + WithSshKey(sshKey), + WithSshUser(sshUser), + ) + + if installCTK { + installer, err := NewToolkitInstaller( + WithRunner(runner), + WithImage(ImageRepo+":"+ImageTag), + WithTemplate(dockerInstallTemplate), + ) + Expect(err).ToNot(HaveOccurred()) + + err = installer.Install() + Expect(err).ToNot(HaveOccurred()) + } + + _, _, err := runner.Run("docker pull ubuntu") + Expect(err).ToNot(HaveOccurred()) + + _, _, err = runner.Run("docker pull nvcr.io/nvidia/k8s/cuda-sample:vectoradd-cuda12.5.0") + Expect(err).ToNot(HaveOccurred()) + + _, _, err = runner.Run("docker pull nvcr.io/nvidia/cuda:12.8.0-base-ubi8") + Expect(err).ToNot(HaveOccurred()) }) + +// getTestEnv gets the test environment variables +func getTestEnv() { + defer GinkgoRecover() + var err error + + _, thisFile, _, _ := runtime.Caller(0) + packagePath = filepath.Dir(thisFile) + + installCTK = getBoolEnvVar("INSTALL_CTK", false) + + ImageRepo = os.Getenv("E2E_IMAGE_REPO") + Expect(ImageRepo).NotTo(BeEmpty(), "E2E_IMAGE_REPO environment variable must be set") + + ImageTag = os.Getenv("E2E_IMAGE_TAG") + Expect(ImageTag).NotTo(BeEmpty(), "E2E_IMAGE_TAG environment variable must be set") + + sshKey = os.Getenv("SSH_KEY") + Expect(sshKey).NotTo(BeEmpty(), "SSH_KEY environment variable must be set") + + sshUser = os.Getenv("SSH_USER") + Expect(sshUser).NotTo(BeEmpty(), "SSH_USER environment variable must be set") + + host = os.Getenv("REMOTE_HOST") + Expect(host).NotTo(BeEmpty(), "REMOTE_HOST environment variable must be set") + + sshPort = os.Getenv("REMOTE_PORT") + Expect(sshPort).NotTo(BeEmpty(), "REMOTE_PORT environment variable must be set") + + // Get current working directory + cwd, err = os.Getwd() + Expect(err).NotTo(HaveOccurred()) +} + +// getBoolEnvVar returns the boolean value of the environment variable or the default value if not set. +func getBoolEnvVar(key string, defaultValue bool) bool { + value := os.Getenv(key) + if value == "" { + return defaultValue + } + boolValue, err := strconv.ParseBool(value) + if err != nil { + return defaultValue + } + return boolValue +} diff --git a/tests/e2e/installer.go b/tests/e2e/installer.go index 4bd2552b..9d8afd54 100644 --- a/tests/e2e/installer.go +++ b/tests/e2e/installer.go @@ -1,19 +1,19 @@ /* -* Copyright (c) 2025, 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. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ - package e2e import ( diff --git a/tests/e2e/nvidia-container-toolkit_test.go b/tests/e2e/nvidia-container-toolkit_test.go index 5948014b..310bbade 100644 --- a/tests/e2e/nvidia-container-toolkit_test.go +++ b/tests/e2e/nvidia-container-toolkit_test.go @@ -1,5 +1,6 @@ /* - * Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. + * SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,69 +28,50 @@ import ( // Integration tests for Docker runtime var _ = Describe("docker", Ordered, ContinueOnFailure, func() { - var r Runner - - // Install the NVIDIA Container Toolkit - BeforeAll(func(ctx context.Context) { - r = NewRunner( - WithHost(host), - WithPort(sshPort), - WithSshKey(sshKey), - WithSshUser(sshUser), - ) - if installCTK { - installer, err := NewToolkitInstaller( - WithRunner(r), - WithImage(image), - WithTemplate(dockerInstallTemplate), - ) - Expect(err).ToNot(HaveOccurred()) - err = installer.Install() - Expect(err).ToNot(HaveOccurred()) - } - }) - // GPUs are accessible in a container: Running nvidia-smi -L inside the // container shows the same output inside the container as outside the // container. This means that the following commands must all produce // the same output When("running nvidia-smi -L", Ordered, func() { var hostOutput string + var err error BeforeAll(func(ctx context.Context) { - _, _, err := r.Run("docker pull ubuntu") - Expect(err).ToNot(HaveOccurred()) - - hostOutput, _, err = r.Run("nvidia-smi -L") + hostOutput, _, err = runner.Run("nvidia-smi -L") Expect(err).ToNot(HaveOccurred()) }) It("should support NVIDIA_VISIBLE_DEVICES", func(ctx context.Context) { - containerOutput, _, err := r.Run("docker run --rm -i --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all ubuntu nvidia-smi -L") + By("Running docker run with --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all") + containerOutput, _, err := runner.Run("docker run --rm -i --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all ubuntu nvidia-smi -L") Expect(err).ToNot(HaveOccurred()) Expect(containerOutput).To(Equal(hostOutput)) }) It("should support automatic CDI spec generation", func(ctx context.Context) { - containerOutput, _, err := r.Run("docker run --rm -i --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=runtime.nvidia.com/gpu=all ubuntu nvidia-smi -L") + By("Running docker run with --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=runtime.nvidia.com/gpu=all") + containerOutput, _, err := runner.Run("docker run --rm -i --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=runtime.nvidia.com/gpu=all ubuntu nvidia-smi -L") Expect(err).ToNot(HaveOccurred()) Expect(containerOutput).To(Equal(hostOutput)) }) It("should support automatic CDI spec generation with the --gpus flag", func(ctx context.Context) { - containerOutput, _, err := r.Run("docker run --rm -i --gpus=all --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=runtime.nvidia.com/gpu=all ubuntu nvidia-smi -L") + By("Running docker run with --gpus=all --runtime=nvidia --gpus all") + containerOutput, _, err := runner.Run("docker run --rm -i --gpus=all --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=runtime.nvidia.com/gpu=all ubuntu nvidia-smi -L") Expect(err).ToNot(HaveOccurred()) Expect(containerOutput).To(Equal(hostOutput)) }) It("should support the --gpus flag using the nvidia-container-runtime", func(ctx context.Context) { - containerOutput, _, err := r.Run("docker run --rm -i --runtime=nvidia --gpus all ubuntu nvidia-smi -L") + By("Running docker run with --runtime=nvidia --gpus all") + containerOutput, _, err := runner.Run("docker run --rm -i --runtime=nvidia --gpus all ubuntu nvidia-smi -L") Expect(err).ToNot(HaveOccurred()) Expect(containerOutput).To(Equal(hostOutput)) }) It("should support the --gpus flag using the nvidia-container-runtime-hook", func(ctx context.Context) { - containerOutput, _, err := r.Run("docker run --rm -i --gpus all ubuntu nvidia-smi -L") + By("Running docker run with --gpus all") + containerOutput, _, err := runner.Run("docker run --rm -i --gpus all ubuntu nvidia-smi -L") Expect(err).ToNot(HaveOccurred()) Expect(containerOutput).To(Equal(hostOutput)) }) @@ -98,35 +80,34 @@ var _ = Describe("docker", Ordered, ContinueOnFailure, func() { // A vectorAdd sample runs in a container with access to all GPUs. // The following should all produce the same result. When("Running the cuda-vectorAdd sample", Ordered, func() { - BeforeAll(func(ctx context.Context) { - _, _, err := r.Run("docker pull nvcr.io/nvidia/k8s/cuda-sample:vectoradd-cuda12.5.0") - Expect(err).ToNot(HaveOccurred()) - }) - var referenceOutput string It("should support NVIDIA_VISIBLE_DEVICES", func(ctx context.Context) { + By("Running docker run with --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all") var err error - referenceOutput, _, err = r.Run("docker run --rm -i --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all nvcr.io/nvidia/k8s/cuda-sample:vectoradd-cuda12.5.0") + referenceOutput, _, err = runner.Run("docker run --rm -i --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all nvcr.io/nvidia/k8s/cuda-sample:vectoradd-cuda12.5.0") Expect(err).ToNot(HaveOccurred()) Expect(referenceOutput).To(ContainSubstring("Test PASSED")) }) It("should support automatic CDI spec generation", func(ctx context.Context) { - out2, _, err := r.Run("docker run --rm -i --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=runtime.nvidia.com/gpu=all nvcr.io/nvidia/k8s/cuda-sample:vectoradd-cuda12.5.0") + By("Running docker run with --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=runtime.nvidia.com/gpu=all") + out2, _, err := runner.Run("docker run --rm -i --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=runtime.nvidia.com/gpu=all nvcr.io/nvidia/k8s/cuda-sample:vectoradd-cuda12.5.0") Expect(err).ToNot(HaveOccurred()) Expect(referenceOutput).To(Equal(out2)) }) It("should support the --gpus flag using the nvidia-container-runtime", func(ctx context.Context) { - out3, _, err := r.Run("docker run --rm -i --runtime=nvidia --gpus all nvcr.io/nvidia/k8s/cuda-sample:vectoradd-cuda12.5.0") + By("Running docker run with --runtime=nvidia --gpus all") + out3, _, err := runner.Run("docker run --rm -i --runtime=nvidia --gpus all nvcr.io/nvidia/k8s/cuda-sample:vectoradd-cuda12.5.0") Expect(err).ToNot(HaveOccurred()) Expect(referenceOutput).To(Equal(out3)) }) It("should support the --gpus flag using the nvidia-container-runtime-hook", func(ctx context.Context) { - out4, _, err := r.Run("docker run --rm -i --gpus all nvcr.io/nvidia/k8s/cuda-sample:vectoradd-cuda12.5.0") + By("Running docker run with --gpus all") + out4, _, err := runner.Run("docker run --rm -i --gpus all nvcr.io/nvidia/k8s/cuda-sample:vectoradd-cuda12.5.0") Expect(err).ToNot(HaveOccurred()) Expect(referenceOutput).To(Equal(out4)) }) @@ -136,53 +117,52 @@ var _ = Describe("docker", Ordered, ContinueOnFailure, func() { // The following should all produce the same result. When("Running the cuda-deviceQuery sample", Ordered, func() { BeforeAll(func(ctx context.Context) { - _, _, err := r.Run("docker pull nvcr.io/nvidia/k8s/cuda-sample:devicequery-cuda12.5.0") + _, _, err := runner.Run("docker pull nvcr.io/nvidia/k8s/cuda-sample:devicequery-cuda12.5.0") Expect(err).ToNot(HaveOccurred()) }) var referenceOutput string It("should support NVIDIA_VISIBLE_DEVICES", func(ctx context.Context) { + By("Running docker run with --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all") var err error - referenceOutput, _, err = r.Run("docker run --rm -i --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all nvcr.io/nvidia/k8s/cuda-sample:devicequery-cuda12.5.0") + referenceOutput, _, err = runner.Run("docker run --rm -i --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all nvcr.io/nvidia/k8s/cuda-sample:devicequery-cuda12.5.0") Expect(err).ToNot(HaveOccurred()) - Expect(referenceOutput).To(ContainSubstring("Result = PASS")) }) It("should support automatic CDI spec generation", func(ctx context.Context) { - out2, _, err := r.Run("docker run --rm -i --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=runtime.nvidia.com/gpu=all nvcr.io/nvidia/k8s/cuda-sample:devicequery-cuda12.5.0") + By("Running docker run with --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=runtime.nvidia.com/gpu=all") + out2, _, err := runner.Run("docker run --rm -i --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=runtime.nvidia.com/gpu=all nvcr.io/nvidia/k8s/cuda-sample:devicequery-cuda12.5.0") Expect(err).ToNot(HaveOccurred()) Expect(referenceOutput).To(Equal(out2)) }) It("should support the --gpus flag using the nvidia-container-runtime", func(ctx context.Context) { - out3, _, err := r.Run("docker run --rm -i --runtime=nvidia --gpus all nvcr.io/nvidia/k8s/cuda-sample:devicequery-cuda12.5.0") + By("Running docker run with --runtime=nvidia --gpus all") + out3, _, err := runner.Run("docker run --rm -i --runtime=nvidia --gpus all nvcr.io/nvidia/k8s/cuda-sample:devicequery-cuda12.5.0") Expect(err).ToNot(HaveOccurred()) Expect(referenceOutput).To(Equal(out3)) }) It("should support the --gpus flag using the nvidia-container-runtime-hook", func(ctx context.Context) { - out4, _, err := r.Run("docker run --rm -i --gpus all nvcr.io/nvidia/k8s/cuda-sample:devicequery-cuda12.5.0") + By("Running docker run with --gpus all") + out4, _, err := runner.Run("docker run --rm -i --gpus all nvcr.io/nvidia/k8s/cuda-sample:devicequery-cuda12.5.0") Expect(err).ToNot(HaveOccurred()) Expect(referenceOutput).To(Equal(out4)) }) }) - Describe("CUDA Forward compatibility", Ordered, func() { + When("Testing CUDA Forward compatibility", Ordered, func() { BeforeAll(func(ctx context.Context) { - _, _, err := r.Run("docker pull nvcr.io/nvidia/cuda:12.8.0-base-ubi8") - Expect(err).ToNot(HaveOccurred()) - }) - - BeforeAll(func(ctx context.Context) { - compatOutput, _, err := r.Run("docker run --rm -i -e NVIDIA_VISIBLE_DEVICES=void nvcr.io/nvidia/cuda:12.8.0-base-ubi8 bash -c \"ls /usr/local/cuda/compat/libcuda.*.*\"") + compatOutput, _, err := runner.Run("docker run --rm -i -e NVIDIA_VISIBLE_DEVICES=void nvcr.io/nvidia/cuda:12.8.0-base-ubi8 bash -c \"ls /usr/local/cuda/compat/libcuda.*.*\"") Expect(err).ToNot(HaveOccurred()) Expect(compatOutput).ToNot(BeEmpty()) + compatDriverVersion := strings.TrimPrefix(filepath.Base(compatOutput), "libcuda.so.") compatMajor := strings.SplitN(compatDriverVersion, ".", 2)[0] - driverOutput, _, err := r.Run("nvidia-smi -q | grep \"Driver Version\"") + driverOutput, _, err := runner.Run("nvidia-smi -q | grep \"Driver Version\"") Expect(err).ToNot(HaveOccurred()) parts := strings.SplitN(driverOutput, ":", 2) Expect(parts).To(HaveLen(2)) @@ -198,19 +178,22 @@ var _ = Describe("docker", Ordered, ContinueOnFailure, func() { }) It("should work with the nvidia runtime in legacy mode", func(ctx context.Context) { - ldconfigOut, _, err := r.Run("docker run --rm -i -e NVIDIA_DISABLE_REQUIRE=true --runtime=nvidia --gpus all nvcr.io/nvidia/cuda:12.8.0-base-ubi8 bash -c \"ldconfig -p | grep libcuda.so.1\"") + By("Running docker run with -e NVIDIA_DISABLE_REQUIRE=true --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all") + ldconfigOut, _, err := runner.Run("docker run --rm -i -e NVIDIA_DISABLE_REQUIRE=true --runtime=nvidia --gpus all nvcr.io/nvidia/cuda:12.8.0-base-ubi8 bash -c \"ldconfig -p | grep libcuda.so.1\"") Expect(err).ToNot(HaveOccurred()) Expect(ldconfigOut).To(ContainSubstring("/usr/local/cuda/compat")) }) It("should work with the nvidia runtime in CDI mode", func(ctx context.Context) { - ldconfigOut, _, err := r.Run("docker run --rm -i -e NVIDIA_DISABLE_REQUIRE=true --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=runtime.nvidia.com/gpu=all nvcr.io/nvidia/cuda:12.8.0-base-ubi8 bash -c \"ldconfig -p | grep libcuda.so.1\"") + By("Running docker run with -e NVIDIA_DISABLE_REQUIRE=true --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=runtime.nvidia.com/gpu=all") + ldconfigOut, _, err := runner.Run("docker run --rm -i -e NVIDIA_DISABLE_REQUIRE=true --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=runtime.nvidia.com/gpu=all nvcr.io/nvidia/cuda:12.8.0-base-ubi8 bash -c \"ldconfig -p | grep libcuda.so.1\"") Expect(err).ToNot(HaveOccurred()) Expect(ldconfigOut).To(ContainSubstring("/usr/local/cuda/compat")) }) It("should NOT work with nvidia-container-runtime-hook", func(ctx context.Context) { - ldconfigOut, _, err := r.Run("docker run --rm -i -e NVIDIA_DISABLE_REQUIRE=true --runtime=runc --gpus all nvcr.io/nvidia/cuda:12.8.0-base-ubi8 bash -c \"ldconfig -p | grep libcuda.so.1\"") + By("Running docker run with -e NVIDIA_DISABLE_REQUIRE=true --gpus all") + ldconfigOut, _, err := runner.Run("docker run --rm -i -e NVIDIA_DISABLE_REQUIRE=true --runtime=runc --gpus all nvcr.io/nvidia/cuda:12.8.0-base-ubi8 bash -c \"ldconfig -p | grep libcuda.so.1\"") Expect(err).ToNot(HaveOccurred()) Expect(ldconfigOut).To(ContainSubstring("/usr/lib64")) }) diff --git a/tests/e2e/runner.go b/tests/e2e/runner.go index e1a75d26..1afb4226 100644 --- a/tests/e2e/runner.go +++ b/tests/e2e/runner.go @@ -1,17 +1,18 @@ /* -* Copyright (c) 2025, 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. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package e2e diff --git a/tests/go.mod b/tests/go.mod index 4137d4d9..c1f84352 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -1,11 +1,9 @@ module github.com/NVIDIA/nvidia-container-toolkit/tests -go 1.23.2 - -toolchain go1.24.1 +go 1.24.1 require ( - github.com/onsi/ginkgo/v2 v2.23.3 + github.com/onsi/ginkgo/v2 v2.23.4 github.com/onsi/gomega v1.37.0 golang.org/x/crypto v0.36.0 ) @@ -14,10 +12,11 @@ require ( github.com/go-logr/logr v1.4.2 // indirect github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/google/go-cmp v0.7.0 // indirect - github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect + github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect + go.uber.org/automaxprocs v1.6.0 // indirect golang.org/x/net v0.38.0 // indirect - golang.org/x/sys v0.31.0 // indirect + golang.org/x/sys v0.32.0 // indirect golang.org/x/text v0.23.0 // indirect - golang.org/x/tools v0.30.0 // indirect + golang.org/x/tools v0.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/tests/go.sum b/tests/go.sum index d6ff2095..99e5ff4e 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -6,31 +6,40 @@ github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1v github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad h1:a6HEuzUHeKH6hwfN/ZoQgRgVIWFJljSWa/zetS2WTvg= -github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= -github.com/onsi/ginkgo/v2 v2.23.3 h1:edHxnszytJ4lD9D5Jjc4tiDkPBZ3siDeJJkUZJJVkp0= -github.com/onsi/ginkgo/v2 v2.23.3/go.mod h1:zXTP6xIp3U8aVuXN8ENK9IXRaTjFnpVB9mGmaSRvxnM= +github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 h1:BHT72Gu3keYf3ZEu2J0b1vyeLSOYI8bm5wbJM/8yDe8= +github.com/google/pprof v0.0.0-20250403155104-27863c87afa6/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/onsi/ginkgo/v2 v2.23.4 h1:ktYTpKJAVZnDT4VjxSbiBenUjmlL/5QkBEocaWXiQus= +github.com/onsi/ginkgo/v2 v2.23.4/go.mod h1:Bt66ApGPBFzHyR+JO10Zbt0Gsp4uWxu5mIOTusL46e8= github.com/onsi/gomega v1.37.0 h1:CdEG8g0S133B4OswTDC/5XPSzE1OeP29QOioj2PID2Y= github.com/onsi/gomega v1.37.0/go.mod h1:8D9+Txp43QWKhM24yyOBEdpkzN8FvJyAwecBgsU4KU0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= +github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs= +go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8= golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= -golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= -golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20= +golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y= golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g= golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= -golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY= -golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY= +golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU= +golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ= google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM= google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=