Skip to content

Commit

Permalink
[Windows] Fix tests broken by rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Sploder12 committed Feb 4, 2025
1 parent bd38068 commit 0833cce
Show file tree
Hide file tree
Showing 21 changed files with 1,243 additions and 1,285 deletions.
26 changes: 13 additions & 13 deletions internal/collector/sysinfo/hardware/hardware_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/ubuntu/ubuntu-insights/internal/collector/sysinfo"
"github.com/ubuntu/ubuntu-insights/internal/collector/sysinfo/hardware"
"github.com/ubuntu/ubuntu-insights/internal/testutils"
)

Expand Down Expand Up @@ -320,49 +320,49 @@ func TestCollectWindows(t *testing.T) {
t.Run(name, func(t *testing.T) {
t.Parallel()

l := testutils.NewMockHandler()
l := testutils.NewMockHandler(slog.LevelDebug)

options := []sysinfo.Options{
sysinfo.WithLogger(&l),
sysinfo.WithArch("amd64"),
options := []hardware.Options{
hardware.WithLogger(&l),
hardware.WithArch("amd64"),
}

if tc.productInfo != "-" {
cmdArgs := testutils.SetupFakeCmdArgs("TestFakeProductInfo", tc.productInfo)
options = append(options, sysinfo.WithProductInfo(cmdArgs))
options = append(options, hardware.WithProductInfo(cmdArgs))
}

if tc.cpuInfo != "-" {
cmdArgs := testutils.SetupFakeCmdArgs("TestFakeCPUInfo", tc.cpuInfo)
options = append(options, sysinfo.WithCPUInfo(cmdArgs))
options = append(options, hardware.WithCPUInfo(cmdArgs))
}

if tc.gpuInfo != "-" {
cmdArgs := testutils.SetupFakeCmdArgs("TestFakeGPUInfo", tc.gpuInfo)
options = append(options, sysinfo.WithGPUInfo(cmdArgs))
options = append(options, hardware.WithGPUInfo(cmdArgs))
}

if tc.memoryInfo != "-" {
cmdArgs := testutils.SetupFakeCmdArgs("TestFakeMemoryInfo", tc.memoryInfo)
options = append(options, sysinfo.WithMemoryInfo(cmdArgs))
options = append(options, hardware.WithMemoryInfo(cmdArgs))
}

if tc.diskInfo != "-" {
cmdArgs := testutils.SetupFakeCmdArgs("TestFakeDiskInfo", tc.diskInfo)
options = append(options, sysinfo.WithDiskInfo(cmdArgs))
options = append(options, hardware.WithDiskInfo(cmdArgs))
}

if tc.partitionInfo != "-" {
cmdArgs := testutils.SetupFakeCmdArgs("TestFakePartitionInfo", tc.partitionInfo)
options = append(options, sysinfo.WithPartitionInfo(cmdArgs))
options = append(options, hardware.WithPartitionInfo(cmdArgs))
}

if tc.screenInfo != "-" {
cmdArgs := testutils.SetupFakeCmdArgs("TestFakeScreenInfo", tc.screenInfo)
options = append(options, sysinfo.WithScreenInfo(cmdArgs))
options = append(options, hardware.WithScreenInfo(cmdArgs))
}

s := sysinfo.New(options...)
s := hardware.New(options...)

got, err := s.Collect()
if tc.wantErr {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,49 +1,47 @@
hardware:
product:
Family: "1582.3"
Model: Star 11 CPP
Vendor: Micro-Star International Co., Ltd.
cpu:
Architecture: amd64
Manufacturer: GenuineIntel
Name: 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
NumberOfCores: "8"
NumberOfLogicalProcessors: "16"
Sockets: "1"
gpus:
- Driver: nvldumdx.dll
Name: NVIDIA GeForce RTX 3050 Ti Laptop GPU
Vendor: NVIDIA
- Driver: igdumdim0.dll
Name: Intel(R) UHD Graphics
Vendor: Intel Corporation
mem:
MemTotal: 0
blks:
- name: \\.\PHYSICALDRIVE0
size: "2000396321280"
partitions:
- name: 'Disk #0, Partition #0'
size: "314572800"
partitions: []
- name: 'Disk #0, Partition #1'
size: "943718400"
partitions: []
- name: 'Disk #0, Partition #2'
size: "22153265152"
partitions: []
- name: 'Disk #0, Partition #3'
size: "1976850972672"
partitions: []
screens:
- name: Default Monitor
physicalresolution: ""
size: ""
resolution: 1920x1080
refreshrate: ""
- name: Generic PnP Monitor
physicalresolution: ""
size: ""
resolution: 1920x1080
refreshrate: ""
software: {}
product:
Family: "1582.3"
Model: Star 11 CPP
Vendor: Micro-Star International Co., Ltd.
cpu:
Architecture: amd64
Manufacturer: GenuineIntel
Name: 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
NumberOfCores: "8"
NumberOfLogicalProcessors: "16"
Sockets: "1"
gpus:
- Driver: nvldumdx.dll
Name: NVIDIA GeForce RTX 3050 Ti Laptop GPU
Vendor: NVIDIA
- Driver: igdumdim0.dll
Name: Intel(R) UHD Graphics
Vendor: Intel Corporation
mem:
MemTotal: 0
blks:
- name: \\.\PHYSICALDRIVE0
size: "2000396321280"
partitions:
- name: 'Disk #0, Partition #0'
size: "314572800"
partitions: []
- name: 'Disk #0, Partition #1'
size: "943718400"
partitions: []
- name: 'Disk #0, Partition #2'
size: "22153265152"
partitions: []
- name: 'Disk #0, Partition #3'
size: "1976850972672"
partitions: []
screens:
- name: Default Monitor
physicalresolution: ""
size: ""
resolution: 1920x1080
refreshrate: ""
- name: Generic PnP Monitor
physicalresolution: ""
size: ""
resolution: 1920x1080
refreshrate: ""
Original file line number Diff line number Diff line change
@@ -1,44 +1,41 @@
hardware:
product:
Family: "1582.3"
Model: Star 11 CPP
Vendor: Micro-Star International Co., Ltd.
cpu:
Architecture: amd64
gpus:
- Driver: nvldumdx.dll
Name: NVIDIA GeForce RTX 3050 Ti Laptop GPU
Vendor: NVIDIA
- Driver: igdumdim0.dll
Name: Intel(R) UHD Graphics
Vendor: Intel Corporation
mem:
MemTotal: 68406489088
blks:
- name: \\.\PHYSICALDRIVE0
size: "2000396321280"
partitions:
- name: 'Disk #0, Partition #0'
size: "314572800"
partitions: []
- name: 'Disk #0, Partition #1'
size: "943718400"
partitions: []
- name: 'Disk #0, Partition #2'
size: "22153265152"
partitions: []
- name: 'Disk #0, Partition #3'
size: "1976850972672"
partitions: []
screens:
- name: Default Monitor
physicalresolution: ""
size: ""
resolution: 1920x1080
refreshrate: ""
- name: Generic PnP Monitor
physicalresolution: ""
size: ""
resolution: 1920x1080
refreshrate: ""
software: {}
product:
Family: "1582.3"
Model: Star 11 CPP
Vendor: Micro-Star International Co., Ltd.
cpu: {}
gpus:
- Driver: nvldumdx.dll
Name: NVIDIA GeForce RTX 3050 Ti Laptop GPU
Vendor: NVIDIA
- Driver: igdumdim0.dll
Name: Intel(R) UHD Graphics
Vendor: Intel Corporation
mem:
MemTotal: 68406489088
blks:
- name: \\.\PHYSICALDRIVE0
size: "2000396321280"
partitions:
- name: 'Disk #0, Partition #0'
size: "314572800"
partitions: []
- name: 'Disk #0, Partition #1'
size: "943718400"
partitions: []
- name: 'Disk #0, Partition #2'
size: "22153265152"
partitions: []
- name: 'Disk #0, Partition #3'
size: "1976850972672"
partitions: []
screens:
- name: Default Monitor
physicalresolution: ""
size: ""
resolution: 1920x1080
refreshrate: ""
- name: Generic PnP Monitor
physicalresolution: ""
size: ""
resolution: 1920x1080
refreshrate: ""
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
hardware:
product:
Family: "1582.3"
Model: Star 11 CPP
Vendor: Micro-Star International Co., Ltd.
cpu:
Architecture: amd64
Manufacturer: GenuineIntel
Name: 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
NumberOfCores: "8"
NumberOfLogicalProcessors: "16"
Sockets: "1"
gpus:
- Driver: nvldumdx.dll
Name: NVIDIA GeForce RTX 3050 Ti Laptop GPU
Vendor: NVIDIA
- Driver: igdumdim0.dll
Name: Intel(R) UHD Graphics
Vendor: Intel Corporation
mem:
MemTotal: 68406489088
blks: []
screens:
- name: Default Monitor
physicalresolution: ""
size: ""
resolution: 1920x1080
refreshrate: ""
- name: Generic PnP Monitor
physicalresolution: ""
size: ""
resolution: 1920x1080
refreshrate: ""
software: {}
product:
Family: "1582.3"
Model: Star 11 CPP
Vendor: Micro-Star International Co., Ltd.
cpu:
Architecture: amd64
Manufacturer: GenuineIntel
Name: 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
NumberOfCores: "8"
NumberOfLogicalProcessors: "16"
Sockets: "1"
gpus:
- Driver: nvldumdx.dll
Name: NVIDIA GeForce RTX 3050 Ti Laptop GPU
Vendor: NVIDIA
- Driver: igdumdim0.dll
Name: Intel(R) UHD Graphics
Vendor: Intel Corporation
mem:
MemTotal: 68406489088
blks: []
screens:
- name: Default Monitor
physicalresolution: ""
size: ""
resolution: 1920x1080
refreshrate: ""
- name: Generic PnP Monitor
physicalresolution: ""
size: ""
resolution: 1920x1080
refreshrate: ""
Loading

0 comments on commit 0833cce

Please sign in to comment.