(t *testing.T)
| 202 | } |
| 203 | |
| 204 | func TestMigStrategySingleLabels(t *testing.T) { |
| 205 | testCases := []struct { |
| 206 | description string |
| 207 | devices []resource.Device |
| 208 | expectedError bool |
| 209 | expectedLabels Labels |
| 210 | isInvalid bool |
| 211 | }{ |
| 212 | { |
| 213 | description: "no devices returns empty labels", |
| 214 | }, |
| 215 | { |
| 216 | description: "single non-mig device returns non-mig (none) labels", |
| 217 | devices: []resource.Device{ |
| 218 | rt.NewFullGPU(), |
| 219 | }, |
| 220 | expectedLabels: Labels{ |
| 221 | "nvidia.com/gpu.compute.major": "8", |
| 222 | "nvidia.com/gpu.compute.minor": "0", |
| 223 | "nvidia.com/gpu.family": "ampere", |
| 224 | "nvidia.com/gpu.count": "1", |
| 225 | "nvidia.com/gpu.replicas": "1", |
| 226 | "nvidia.com/gpu.sharing-strategy": "none", |
| 227 | "nvidia.com/gpu.memory": "300", |
| 228 | "nvidia.com/gpu.product": "MOCKMODEL", |
| 229 | "nvidia.com/mig.strategy": "single", |
| 230 | }, |
| 231 | }, |
| 232 | { |
| 233 | description: "multiple non-mig device returns non-mig (none) labels", |
| 234 | devices: []resource.Device{ |
| 235 | rt.NewFullGPU(), |
| 236 | rt.NewFullGPU(), |
| 237 | }, |
| 238 | expectedLabels: Labels{ |
| 239 | "nvidia.com/gpu.compute.major": "8", |
| 240 | "nvidia.com/gpu.compute.minor": "0", |
| 241 | "nvidia.com/gpu.family": "ampere", |
| 242 | "nvidia.com/gpu.count": "2", |
| 243 | "nvidia.com/gpu.replicas": "1", |
| 244 | "nvidia.com/gpu.sharing-strategy": "none", |
| 245 | "nvidia.com/gpu.memory": "300", |
| 246 | "nvidia.com/gpu.product": "MOCKMODEL", |
| 247 | "nvidia.com/mig.strategy": "single", |
| 248 | }, |
| 249 | }, |
| 250 | { |
| 251 | description: "single mig-enabled device returns mig labels", |
| 252 | devices: []resource.Device{ |
| 253 | rt.NewMigEnabledDevice( |
| 254 | rt.NewMigDevice(1, 2, 100), |
| 255 | ), |
| 256 | }, |
| 257 | expectedLabels: Labels{ |
| 258 | "nvidia.com/gpu.count": "1", |
| 259 | "nvidia.com/gpu.replicas": "1", |
| 260 | "nvidia.com/gpu.sharing-strategy": "none", |
| 261 | "nvidia.com/gpu.memory": "100", |
nothing calls this directly
no test coverage detected