File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -130,6 +130,7 @@ func TestNamespaceMethods(t *testing.T) {
130130 testCaseSync (t ),
131131 testCaseGetOSDistro (t ),
132132 testCaseGetSystemBlockDevices (t ),
133+ testCaseResolveBlockDeviceToPhysicalDevice (t ),
133134 testCaseCopyDirectory (t ),
134135 testCaseCreateDirectory (t ),
135136 testCaseDeleteDirectory (t ),
Original file line number Diff line number Diff line change @@ -124,3 +124,29 @@ func testCaseGetSystemBlockDevices(t *testing.T) map[string]testCaseNamespaceMet
124124 },
125125 }
126126}
127+
128+ func testCaseResolveBlockDeviceToPhysicalDevice (t * testing.T ) map [string ]testCaseNamespaceMethods {
129+ return map [string ]testCaseNamespaceMethods {
130+ "ResolveBlockDeviceToPhysicalDevice/Local" : {
131+ method : func (args ... interface {}) (interface {}, error ) {
132+ return ResolveBlockDeviceToPhysicalDevice ("/dev/sda1" )
133+ },
134+ mockResult : "/dev/sda" ,
135+ expected : "/dev/sda" ,
136+ },
137+ "ResolveBlockDeviceToPhysicalDevice/Failed to run" : {
138+ method : func (args ... interface {}) (interface {}, error ) {
139+ return ResolveBlockDeviceToPhysicalDevice ("/dev/sda1" )
140+ },
141+ mockError : fmt .Errorf ("failed" ),
142+ expectError : true ,
143+ },
144+ "ResolveBlockDeviceToPhysicalDevice/Failed to cast result" : {
145+ method : func (args ... interface {}) (interface {}, error ) {
146+ return ResolveBlockDeviceToPhysicalDevice ("/dev/sda1" )
147+ },
148+ mockResult : int (1 ),
149+ expectError : true ,
150+ },
151+ }
152+ }
You can’t perform that action at this time.
0 commit comments