Skip to content

Commit

Permalink
Fixed test case failures for multipath.conf changes (#170)
Browse files Browse the repository at this point in the history
Signed-off-by: Adarsh Pratik <[email protected]>
  • Loading branch information
adarshpratikhpe authored Mar 31, 2022
1 parent cc7b5fc commit 789bc8d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 17 deletions.
40 changes: 23 additions & 17 deletions mpathconfig/configresource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,40 @@ package mpathconfig

// Copyright 2019 Hewlett Packard Enterprise Development LP
import (
"fmt"
"testing"
)

func TestParseDeviceSection(t *testing.T) {
config, err := ParseConfig("./multipath_test.conf")
DeviceType := [2]string{"Nimble", "3PARdata"}

for _, deviceType := range DeviceType {

if err != nil {
t.Error(
"Parsing multipath.conf failed ", err,
)
} else {
// config found
section, err := config.GetDeviceSection()
if err != nil {
t.Error(
"Parsing nimble device section failed ", err,
"Parsing multipath.conf failed ", err,
)
} else {
// section found
if (section.GetProperties())["vendor"] != "\"Nimble\"" {
t.Error(
"Parsing options from nimble device section failed ", err,
)
}
if section.GetParent().GetName() != "devices" {
t.Error(
"Parent section is not set correctly for nimble device section ", err,
// config found
section, err := config.GetDeviceSection(deviceType)
if err != nil {
t.Errorf(
"Parsing %s device section failed: %v ", deviceType, err,
)
} else {
currentDevice := fmt.Sprintf("\"%s\"", deviceType)
// section found
if (section.GetProperties())["vendor"] != currentDevice {
t.Errorf(
"Parsing options from %s device section failed: %v ", deviceType, err,
)
}
if section.GetParent().GetName() != "devices" {
t.Errorf(
"Parent section is not set correctly for %s device section: %v ", deviceType, err,
)
}
}
}
}
Expand Down
15 changes: 15 additions & 0 deletions mpathconfig/multipath_test.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,19 @@ devices {
prio alua
failback immediate
}
device {
path_grouping_policy group_by_prio
rr_min_io 100
path_checker tur
vendor "3PARdata"
prio alua
path_selector "round-robin 0"
checker tur
features "0"
failback immediate
getuid_callout "/lib/udev/scsi_id --whitelisted --device=/dev/%n"
product "VV"
hardware_handler "1 alua"
no_path_retry 18
}
}

0 comments on commit 789bc8d

Please sign in to comment.