Skip to content

Commit a797602

Browse files
committed
test: assert the returned error of DeleteDevice()
Signed-off-by: Derek Su <[email protected]>
1 parent 9a8e1a4 commit a797602

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/spdk/spdk_test.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ import (
1313

1414
commonTypes "github.com/longhorn/go-common-libs/types"
1515

16+
"github.com/longhorn/go-spdk-helper/pkg/jsonrpc"
1617
"github.com/longhorn/go-spdk-helper/pkg/nvme"
1718
"github.com/longhorn/go-spdk-helper/pkg/spdk/client"
1819
"github.com/longhorn/go-spdk-helper/pkg/spdk/target"
19-
spdktypes "github.com/longhorn/go-spdk-helper/pkg/spdk/types"
2020
"github.com/longhorn/go-spdk-helper/pkg/types"
2121
"github.com/longhorn/go-spdk-helper/pkg/util"
22+
23+
spdktypes "github.com/longhorn/go-spdk-helper/pkg/spdk/types"
2224
)
2325

2426
var (
@@ -112,7 +114,9 @@ func (s *TestSuite) TestSPDKBasic(c *C) {
112114

113115
// Do blindly cleanup
114116
err = spdkCli.DeleteDevice(defaultDeviceName, defaultDeviceName)
115-
c.Assert(err, IsNil)
117+
if err != nil {
118+
c.Assert(jsonrpc.IsJSONRPCRespErrorNoSuchDevice(err), Equals, true)
119+
}
116120

117121
bdevAioName, lvsName, lvsUUID, err := spdkCli.AddDevice(defaultDevicePath, defaultDeviceName, types.MiB)
118122
c.Assert(err, IsNil)

0 commit comments

Comments
 (0)