Skip to content

Commit 99ec561

Browse files
update unit tests on templates
Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
1 parent f1f4f36 commit 99ec561

File tree

2 files changed

+58
-12
lines changed

2 files changed

+58
-12
lines changed

pkg/provisioner/templates/nv-driver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626

2727
// From https://docs.nvidia.com/datacenter/tesla/tesla-installation-notes/index.html#ubuntu-lts
2828
const NvDriverTemplate = `
29-
29+
# Install Dependencies
3030
with_retry 3 10s sudo apt-get update
3131
install_packages_with_retry linux-headers-$(uname -r) gcc make
3232
install_packages_with_retry apt-utils build-essential \

pkg/provisioner/templates/nv-driver_test.go

Lines changed: 57 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,29 @@ func TestNVDriverTemplate(t *testing.T) {
4141
},
4242
expectedOutput: `
4343
44-
sudo apt-get update
45-
install_packages_with_retry linux-headers-$(uname -r)
44+
# Install Dependencies
45+
with_retry 3 10s sudo apt-get update
46+
install_packages_with_retry linux-headers-$(uname -r) gcc make
47+
install_packages_with_retry apt-utils build-essential \
48+
ca-certificates \
49+
curl \
50+
kmod \
51+
file \
52+
libelf-dev \
53+
libglvnd-dev \
54+
pkg-config
55+
56+
install_packages_with_retry gcc-12 g++-12 && \
57+
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12 && \
58+
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 12
59+
60+
# Install the new cuda-keyring package
4661
distribution=$(. /etc/os-release;echo $ID$VERSION_ID | sed -e 's/\.//g')
4762
wget https://developer.download.nvidia.com/compute/cuda/repos/$distribution/x86_64/cuda-keyring_1.1-1_all.deb
4863
sudo dpkg -i cuda-keyring_1.1-1_all.deb
49-
5064
with_retry 3 10s sudo apt-get update
65+
66+
# Install the NVIDIA driver
5167
install_packages_with_retry cuda-drivers=123.4.5
5268
5369
# Check if NVIDIA module is loaded, if not load it
@@ -68,14 +84,29 @@ nvidia-smi
6884
Branch: "550",
6985
},
7086
expectedOutput: `
71-
72-
sudo apt-get update
73-
install_packages_with_retry linux-headers-$(uname -r)
87+
# Install Dependencies
88+
with_retry 3 10s sudo apt-get update
89+
install_packages_with_retry linux-headers-$(uname -r) gcc make
90+
install_packages_with_retry apt-utils build-essential \
91+
ca-certificates \
92+
curl \
93+
kmod \
94+
file \
95+
libelf-dev \
96+
libglvnd-dev \
97+
pkg-config
98+
99+
install_packages_with_retry gcc-12 g++-12 && \
100+
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12 && \
101+
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 12
102+
103+
# Install the new cuda-keyring package
74104
distribution=$(. /etc/os-release;echo $ID$VERSION_ID | sed -e 's/\.//g')
75105
wget https://developer.download.nvidia.com/compute/cuda/repos/$distribution/x86_64/cuda-keyring_1.1-1_all.deb
76106
sudo dpkg -i cuda-keyring_1.1-1_all.deb
77-
78107
with_retry 3 10s sudo apt-get update
108+
109+
# Install the NVIDIA driver
79110
install_packages_with_retry cuda-drivers-550
80111
81112
# Check if NVIDIA module is loaded, if not load it
@@ -97,14 +128,29 @@ nvidia-smi
97128
Version: "123.4.5",
98129
},
99130
expectedOutput: `
100-
101-
sudo apt-get update
102-
install_packages_with_retry linux-headers-$(uname -r)
131+
# Install Dependencies
132+
with_retry 3 10s sudo apt-get update
133+
install_packages_with_retry linux-headers-$(uname -r) gcc make
134+
install_packages_with_retry apt-utils build-essential \
135+
ca-certificates \
136+
curl \
137+
kmod \
138+
file \
139+
libelf-dev \
140+
libglvnd-dev \
141+
pkg-config
142+
143+
install_packages_with_retry gcc-12 g++-12 && \
144+
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12 && \
145+
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 12
146+
147+
# Install the new cuda-keyring package
103148
distribution=$(. /etc/os-release;echo $ID$VERSION_ID | sed -e 's/\.//g')
104149
wget https://developer.download.nvidia.com/compute/cuda/repos/$distribution/x86_64/cuda-keyring_1.1-1_all.deb
105150
sudo dpkg -i cuda-keyring_1.1-1_all.deb
106-
107151
with_retry 3 10s sudo apt-get update
152+
153+
# Install the NVIDIA driver
108154
install_packages_with_retry cuda-drivers=123.4.5
109155
110156
# Check if NVIDIA module is loaded, if not load it

0 commit comments

Comments
 (0)