MCPcopy Create free account
hub / github.com/NVIDIA/gpu-operator / TestGetStringHash

Function TestGetStringHash

internal/utils/utils_test.go:155–192  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

153}
154
155func TestGetStringHash(t *testing.T) {
156 type test struct {
157 input string
158 expected string
159 }
160
161 testcases := []test{
162 {
163 input: "2269c984-db9a-4b0e-9fd5-86df0ad269f7",
164 expected: "7c6d7bd86b",
165 },
166 {
167 input: "2269c984-db9a-4b0e-9fd5-86df0ad269f7-5.15.0-1041-azure",
168 expected: "79d6bd954f",
169 },
170 {
171 input: "2269c984-db9a-4b0e-9fd5-86df0ad269f7-rhcos4.14-414.92.202309282257",
172 expected: "646cdfdb96",
173 },
174 {
175 input: "rhcos4.14-414.92.202309282257",
176 expected: "5bbdb464cb",
177 },
178 {
179 input: "nvidia-gpu-driver-2269c984-db9a-4b0e-9fd5-86df0ad269f7-rhcos4.14-414.92.202309282257",
180 expected: "7bf6859b6d",
181 },
182 {
183 input: "nvidia-vgpu-driver-2269c984-db9a-4b0e-9fd5-868df0ad269f7-rhcos4.14-414.92.202309282257",
184 expected: "7469f59898",
185 },
186 }
187
188 for _, tc := range testcases {
189 actual := GetStringHash(tc.input)
190 assert.Equal(t, tc.expected, actual)
191 }
192}

Callers

nothing calls this directly

Calls 1

GetStringHashFunction · 0.85

Tested by

no test coverage detected