Skip to content

Commit

Permalink
feat(test): include index in test assertions
Browse files Browse the repository at this point in the history
- Updated test cases to include `index` in the `want` structure.
- Ensured better coverage of scenarios involving `index` handling.

chore: update .gitignore to ignore build and test output

- Added `_output/` directory to `.gitignore` to ignore generated build artifacts.
- Added `coverage.out` to `.gitignore` to ignore test coverage reports.
  • Loading branch information
elrondwong committed Dec 26, 2024
1 parent 9982e83 commit 743cc1e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ libvgpu.so
.idea
vendor
license
vgpuvalidator
vgpuvalidator
_output/
coverage.out
4 changes: 2 additions & 2 deletions pkg/device/ascend/device_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ func Test_PatchAnnotations(t *testing.T) {
},
},
want: map[string]string{
util.InRequestDevices[dev.config.CommonWord]: "device-0,Ascend,8738,1:;",
util.SupportDevices[dev.config.CommonWord]: "device-0,Ascend,8738,1:;",
util.InRequestDevices[dev.config.CommonWord]: "device-0,Ascend,8738,1,0:;",
util.SupportDevices[dev.config.CommonWord]: "device-0,Ascend,8738,1,0:;",
"predicate-time": strconv.FormatInt(time.Now().Unix(), 10),
"huawei.com/Ascend910A": "[{\"UUID\":\"device-0\",\"temp\":\"vir08\"}]",
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/device/iluvatar/device_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ func TestPatchAnnotations(t *testing.T) {
},
},
expected: map[string]string{
util.InRequestDevices[IluvatarGPUDevice]: "k8s-gpu-iluvatar-0,Iluvatar,0,0:;",
util.SupportDevices[IluvatarGPUDevice]: "k8s-gpu-iluvatar-0,Iluvatar,0,0:;",
util.InRequestDevices[IluvatarGPUDevice]: "k8s-gpu-iluvatar-0,Iluvatar,0,0,0:;",
util.SupportDevices[IluvatarGPUDevice]: "k8s-gpu-iluvatar-0,Iluvatar,0,0,0:;",
"iluvatar.ai/gpu-assigned": "false",
"iluvatar.ai/predicate-time": strconv.FormatInt(time.Now().UnixNano(), 10),
IluvatarDeviceSelection + "0": "0",
Expand Down
4 changes: 2 additions & 2 deletions pkg/device/nvidia/device_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,8 @@ func Test_PatchAnnotations(t *testing.T) {
},
},
want: map[string]string{
util.InRequestDevices[NvidiaGPUDevice]: "nvidia-device-0,NVIDIA,2000,1:;",
util.SupportDevices[NvidiaGPUDevice]: "nvidia-device-0,NVIDIA,2000,1:;",
util.InRequestDevices[NvidiaGPUDevice]: "nvidia-device-0,NVIDIA,2000,1,0:;",
util.SupportDevices[NvidiaGPUDevice]: "nvidia-device-0,NVIDIA,2000,1,0:;",
},
},
{
Expand Down

0 comments on commit 743cc1e

Please sign in to comment.