Skip to content

Commit 61cfd57

Browse files
committed
fix: add test case for vdisk parsing issue
Resolves #115 Signed-off-by: Alexander Trost <galexrt@googlemail.com>
1 parent e1a7d60 commit 61cfd57

File tree

1 file changed

+124
-0
lines changed

1 file changed

+124
-0
lines changed

pkg/omreport/omreport_test.go

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,130 @@ ID;Status;Name;State;Hot Spare Policy violated;Encrypted;Progress;Layout;Size;T1
10291029
},
10301030
},
10311031
},
1032+
{
1033+
Input: `List of Virtual Disks in the System
1034+
1035+
Controller PERC H740P Adapter (Slot 6)
1036+
1037+
ID;Status;Name;State;Hot Spare Policy violated;Virtual Disk Bad Blocks;Encrypted;Layout;Size;T10 Protection Information Status;Associated Fluid Cache State ;Device Name;Bus Protocol;Media;Read Policy;Write Policy;Cache Policy;Strip Element Size;Disk Cache Policy
1038+
0;Ok;DATA;Ready;Not Applicable;No;No;RAID-0;7,153.38 GiB (7680877920256 bytes);No;Not Applicable;/dev/sda;SAS;SSD;Read Ahead;Write Back;Not Applicable;512 KB;Unchanged
1039+
1;Critical;STORAGE;Ready;Not Assigned;Yes;No;RAID-5;49,170.00 GiB (52795885486080 bytes);No;Not Applicable;/dev/sdb;SAS;HDD;Read Ahead;Write Back;Not Applicable;512 KB;Unchanged
1040+
1041+
ID;Status;Name;State;Hot Spare Policy violated;Virtual Disk Bad Blocks;Encrypted;Layout;Size;T10 Protection Information Status;Associated Fluid Cache State ;Device Name;Bus Protocol;Media;Read Policy;Write Policy;Cache Policy;Strip Element Size;Disk Cache Policy
1042+
`,
1043+
Values: []Value{
1044+
// 1st Disk
1045+
{
1046+
Name: "storage_vdisk_status",
1047+
Value: "0",
1048+
Labels: map[string]string{
1049+
"vdisk": "0",
1050+
"vdisk_name": "DATA",
1051+
controllerNameLabel: "PERC H740P Adapter (Slot 6)",
1052+
},
1053+
},
1054+
{
1055+
Name: "storage_vdisk_state",
1056+
Value: "1",
1057+
Labels: map[string]string{
1058+
"vdisk": "0",
1059+
"vdisk_name": "DATA",
1060+
controllerNameLabel: "PERC H740P Adapter (Slot 6)",
1061+
},
1062+
},
1063+
{
1064+
Name: "storage_vdisk_raidlevel",
1065+
Value: "0",
1066+
Labels: map[string]string{
1067+
"vdisk": "0",
1068+
"vdisk_name": "DATA",
1069+
controllerNameLabel: "PERC H740P Adapter (Slot 6)",
1070+
},
1071+
},
1072+
{
1073+
Name: "storage_vdisk_read_policy",
1074+
Value: "1",
1075+
Labels: map[string]string{
1076+
"vdisk": "0",
1077+
"vdisk_name": "DATA",
1078+
controllerNameLabel: "PERC H740P Adapter (Slot 6)",
1079+
},
1080+
},
1081+
{
1082+
Name: "storage_vdisk_write_policy",
1083+
Value: "7",
1084+
Labels: map[string]string{
1085+
"vdisk": "0",
1086+
"vdisk_name": "DATA",
1087+
controllerNameLabel: "PERC H740P Adapter (Slot 6)",
1088+
},
1089+
},
1090+
{
1091+
Name: "storage_vdisk_cache_policy",
1092+
Value: "0",
1093+
Labels: map[string]string{
1094+
"vdisk": "0",
1095+
"vdisk_name": "DATA",
1096+
controllerNameLabel: "PERC H740P Adapter (Slot 6)",
1097+
},
1098+
},
1099+
// 2nd Disk
1100+
{
1101+
Name: "storage_vdisk_status",
1102+
Value: "1",
1103+
Labels: map[string]string{
1104+
"vdisk": "1",
1105+
"vdisk_name": "STORAGE",
1106+
controllerNameLabel: "PERC H740P Adapter (Slot 6)",
1107+
},
1108+
},
1109+
{
1110+
Name: "storage_vdisk_state",
1111+
Value: "1",
1112+
Labels: map[string]string{
1113+
"vdisk": "1",
1114+
"vdisk_name": "STORAGE",
1115+
controllerNameLabel: "PERC H740P Adapter (Slot 6)",
1116+
},
1117+
},
1118+
{
1119+
Name: "storage_vdisk_raidlevel",
1120+
Value: "5",
1121+
Labels: map[string]string{
1122+
"vdisk": "1",
1123+
"vdisk_name": "STORAGE",
1124+
controllerNameLabel: "PERC H740P Adapter (Slot 6)",
1125+
},
1126+
},
1127+
{
1128+
Name: "storage_vdisk_read_policy",
1129+
Value: "1",
1130+
Labels: map[string]string{
1131+
"vdisk": "1",
1132+
"vdisk_name": "STORAGE",
1133+
controllerNameLabel: "PERC H740P Adapter (Slot 6)",
1134+
},
1135+
},
1136+
{
1137+
Name: "storage_vdisk_write_policy",
1138+
Value: "7",
1139+
Labels: map[string]string{
1140+
"vdisk": "1",
1141+
"vdisk_name": "STORAGE",
1142+
controllerNameLabel: "PERC H740P Adapter (Slot 6)",
1143+
},
1144+
},
1145+
{
1146+
Name: "storage_vdisk_cache_policy",
1147+
Value: "0",
1148+
Labels: map[string]string{
1149+
"vdisk": "1",
1150+
"vdisk_name": "STORAGE",
1151+
controllerNameLabel: "PERC H740P Adapter (Slot 6)",
1152+
},
1153+
},
1154+
},
1155+
},
10321156
}
10331157

10341158
func TestStorageVdisk(t *testing.T) {

0 commit comments

Comments
 (0)