Skip to content

Commit 789bc8d

Browse files
Fixed test case failures for multipath.conf changes (#170)
Signed-off-by: Adarsh Pratik <[email protected]>
1 parent cc7b5fc commit 789bc8d

File tree

2 files changed

+38
-17
lines changed

2 files changed

+38
-17
lines changed

mpathconfig/configresource_test.go

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,40 @@ package mpathconfig
22

33
// Copyright 2019 Hewlett Packard Enterprise Development LP
44
import (
5+
"fmt"
56
"testing"
67
)
78

89
func TestParseDeviceSection(t *testing.T) {
910
config, err := ParseConfig("./multipath_test.conf")
11+
DeviceType := [2]string{"Nimble", "3PARdata"}
12+
13+
for _, deviceType := range DeviceType {
1014

11-
if err != nil {
12-
t.Error(
13-
"Parsing multipath.conf failed ", err,
14-
)
15-
} else {
16-
// config found
17-
section, err := config.GetDeviceSection()
1815
if err != nil {
1916
t.Error(
20-
"Parsing nimble device section failed ", err,
17+
"Parsing multipath.conf failed ", err,
2118
)
2219
} else {
23-
// section found
24-
if (section.GetProperties())["vendor"] != "\"Nimble\"" {
25-
t.Error(
26-
"Parsing options from nimble device section failed ", err,
27-
)
28-
}
29-
if section.GetParent().GetName() != "devices" {
30-
t.Error(
31-
"Parent section is not set correctly for nimble device section ", err,
20+
// config found
21+
section, err := config.GetDeviceSection(deviceType)
22+
if err != nil {
23+
t.Errorf(
24+
"Parsing %s device section failed: %v ", deviceType, err,
3225
)
26+
} else {
27+
currentDevice := fmt.Sprintf("\"%s\"", deviceType)
28+
// section found
29+
if (section.GetProperties())["vendor"] != currentDevice {
30+
t.Errorf(
31+
"Parsing options from %s device section failed: %v ", deviceType, err,
32+
)
33+
}
34+
if section.GetParent().GetName() != "devices" {
35+
t.Errorf(
36+
"Parent section is not set correctly for %s device section: %v ", deviceType, err,
37+
)
38+
}
3339
}
3440
}
3541
}

mpathconfig/multipath_test.conf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,19 @@ devices {
3232
prio alua
3333
failback immediate
3434
}
35+
device {
36+
path_grouping_policy group_by_prio
37+
rr_min_io 100
38+
path_checker tur
39+
vendor "3PARdata"
40+
prio alua
41+
path_selector "round-robin 0"
42+
checker tur
43+
features "0"
44+
failback immediate
45+
getuid_callout "/lib/udev/scsi_id --whitelisted --device=/dev/%n"
46+
product "VV"
47+
hardware_handler "1 alua"
48+
no_path_retry 18
49+
}
3550
}

0 commit comments

Comments
 (0)