...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package sysfs
18
19 import (
20 "testing"
21
22 "github.com/google/go-cmp/cmp"
23 )
24
25 func TestDMIClass(t *testing.T) {
26 fs, err := NewFS(sysTestFixtures)
27 if err != nil {
28 t.Fatal(err)
29 }
30
31 got, err := fs.DMIClass()
32 if err != nil {
33 t.Fatal(err)
34 }
35
36 empty := ""
37 biosDate := "04/12/2021"
38 biosRelease := "2.2"
39 biosVendor := "Dell Inc."
40 biosVersion := "2.2.4"
41 boardName := "07PXPY"
42 boardSerial := ".7N62AI2.GRTCL6944100GP."
43 boardVendor := "Dell Inc."
44 boardVersion := "A01"
45 chassisSerial := "7N62AI2"
46 chassisType := "23"
47 chassisVendor := "Dell Inc."
48 productFamily := "PowerEdge"
49 productName := "PowerEdge R6515"
50 productSerial := "7N62AI2"
51 productSKU := "SKU=NotProvided;ModelName=PowerEdge R6515"
52 productUUID := "83340ca8-cb49-4474-8c29-d2088ca84dd9"
53 systemVendor := "Dell Inc."
54
55 want := &DMIClass{
56 BiosDate: &biosDate,
57 BiosRelease: &biosRelease,
58 BiosVendor: &biosVendor,
59 BiosVersion: &biosVersion,
60 BoardName: &boardName,
61 BoardSerial: &boardSerial,
62 BoardVendor: &boardVendor,
63 BoardVersion: &boardVersion,
64 ChassisAssetTag: &empty,
65 ChassisSerial: &chassisSerial,
66 ChassisType: &chassisType,
67 ChassisVendor: &chassisVendor,
68 ChassisVersion: &empty,
69 ProductFamily: &productFamily,
70 ProductName: &productName,
71 ProductSerial: &productSerial,
72 ProductSKU: &productSKU,
73 ProductUUID: &productUUID,
74 ProductVersion: &empty,
75 SystemVendor: &systemVendor,
76 }
77
78 if diff := cmp.Diff(want, got); diff != "" {
79 t.Fatalf("unexpected DMI class (-want +got):\n%s", diff)
80 }
81 }
82
View as plain text