File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ package internal
2
+
3
+ import (
4
+ "errors"
5
+ "testing"
6
+
7
+ "github.com/stretchr/testify/assert"
8
+
9
+ "github.com/ceph/go-ceph/cephfs"
10
+ "github.com/ceph/go-ceph/rados"
11
+ "github.com/ceph/go-ceph/rbd"
12
+ )
13
+
14
+ func TestErrorCompare (t * testing.T ) {
15
+ t .Run ("ErrNotConnected" , func (t * testing.T ) {
16
+ err := rados .ErrNotConnected
17
+ assert .True (t , errors .Is (err , cephfs .ErrNotConnected ))
18
+ assert .False (t , errors .Is (err , cephfs .ErrNotExist ))
19
+ })
20
+
21
+ t .Run ("ErrNotExist" , func (t * testing.T ) {
22
+ err := rbd .ErrNotExist
23
+ assert .True (t , errors .Is (err , rbd .ErrNotFound ))
24
+ assert .True (t , errors .Is (err , cephfs .ErrNotExist ))
25
+ assert .False (t , errors .Is (err , cephfs .ErrNotConnected ))
26
+ })
27
+
28
+ t .Run ("ErrNotFound" , func (t * testing.T ) {
29
+ err := rbd .ErrNotFound
30
+ assert .True (t , errors .Is (rbd .ErrNotFound , rados .ErrNotFound ))
31
+ assert .False (t , errors .Is (err , rados .ErrNotConnected ))
32
+ })
33
+ }
You can’t perform that action at this time.
0 commit comments