[client] Get static system info once (#2965)

Get static system info once for Windows, Darwin, and Linux nodes

This should improve startup and peer authentication times
This commit is contained in:
Maycon Santos
2024-12-03 10:22:04 +01:00
committed by GitHub
parent a0bf0bdcc0
commit a4826cfb5f
6 changed files with 123 additions and 70 deletions

View File

@@ -183,7 +183,10 @@ func Test_sysInfo(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
gotSerialNum, gotProdName, gotManufacturer := sysInfo(tt.sysInfo)
getSystemInfo = func() SysInfo {
return tt.sysInfo
}
gotSerialNum, gotProdName, gotManufacturer := sysInfo()
if gotSerialNum != tt.wantSerialNum {
t.Errorf("sysInfo() gotSerialNum = %v, want %v", gotSerialNum, tt.wantSerialNum)
}