rados: remove errcheck linter warnings

Signed-off-by: Sven Anderson <sven@redhat.com>
This commit is contained in:
Sven Anderson 2021-09-15 19:27:15 +02:00 committed by mergify[bot]
parent b7f01be284
commit 54fe45484a
4 changed files with 14 additions and 7 deletions

View File

@ -1175,7 +1175,9 @@ func (suite *RadosTestSuite) TestGetLastVersion() {
ioctx, err := suite.conn.OpenIOContext(suite.pool)
require.NoError(suite.T(), err)
oid := suite.GenObjectName()
defer suite.ioctx.Delete(oid)
defer func(oid string) {
assert.NoError(t, ioctx.Delete(oid))
}(oid)
v1, _ := ioctx.GetLastVersion()
@ -1201,7 +1203,9 @@ func (suite *RadosTestSuite) TestGetLastVersion() {
ioctx, err := suite.conn.OpenIOContext(suite.pool)
require.NoError(suite.T(), err)
oid := suite.GenObjectName()
defer ioctx.Delete(oid)
defer func(oid string) {
assert.NoError(t, ioctx.Delete(oid))
}(oid)
v1, _ := ioctx.GetLastVersion()
@ -1241,7 +1245,9 @@ func (suite *RadosTestSuite) TestGetLastVersion() {
vers := make([]uint64, 5)
for i := 0; i < 5; i++ {
oid := suite.GenObjectName()
defer ioctx.Delete(oid)
defer func(oid string) {
assert.NoError(t, ioctx.Delete(oid))
}(oid)
err = ioctx.Write(oid, []byte(oid), 0)
assert.NoError(t, err)

View File

@ -30,7 +30,7 @@ func (suite *RadosTestSuite) TestReadOpAssertExists() {
// ensure a nil ioctx triggers a panic
assert.Panics(suite.T(), func() {
op2.Operate(nil, "foo", OperationNoFlag)
_ = op2.Operate(nil, "foo", OperationNoFlag)
})
}

View File

@ -195,7 +195,6 @@ func (suite *RadosTestSuite) TestRollbackSnapshot() {
ioctx, err := suite.conn.OpenIOContext(suite.pool)
require.NoError(suite.T(), err)
oid := suite.GenObjectName()
defer suite.ioctx.Delete(oid)
err = ioctx.RollbackSnap(oid, "someName")
assert.Error(t, err)
@ -220,7 +219,9 @@ func (suite *RadosTestSuite) TestRollbackSnapshot() {
ioctx, err := suite.conn.OpenIOContext(suite.pool)
require.NoError(suite.T(), err)
oid := suite.GenObjectName()
defer suite.ioctx.Delete(oid)
defer func(oid string) {
assert.NoError(t, ioctx.Delete(oid))
}(oid)
bytesIn := []byte("Harry Potter")
err = suite.ioctx.Write(oid, bytesIn, 0)

View File

@ -31,7 +31,7 @@ func (suite *RadosTestSuite) TestWriteOpCreate() {
assert.Panics(suite.T(), func() {
op := CreateWriteOp()
defer op.Release()
op.Operate(nil, "foo", OperationNoFlag)
_ = op.Operate(nil, "foo", OperationNoFlag)
})
}