@@ -20,7 +20,7 @@ import (
20
20
21
21
func TestSanity (t * testing.T ) {
22
22
// Setup the full driver and its environment
23
- dir , err := ioutil .TempDir ("" , "sanity-ebs -csi" )
23
+ dir , err := ioutil .TempDir ("" , "sanity-powervs -csi" )
24
24
if err != nil {
25
25
t .Fatalf ("error creating directory %v" , err )
26
26
}
@@ -43,6 +43,10 @@ func TestSanity(t *testing.T) {
43
43
mode : AllMode ,
44
44
}
45
45
46
+ statsUtil := MockStatSanity {
47
+ targetPath : targetPath ,
48
+ }
49
+
46
50
drv := & Driver {
47
51
options : driverOptions ,
48
52
controllerService : controllerService {
@@ -56,6 +60,7 @@ func TestSanity(t *testing.T) {
56
60
driverOptions : & Options {},
57
61
pvmInstanceId : "test1234" ,
58
62
volumeLocks : util .NewVolumeLocks (),
63
+ stats : & statsUtil ,
59
64
},
60
65
}
61
66
defer func () {
@@ -82,6 +87,34 @@ func createDir(targetPath string) (string, error) {
82
87
return targetPath , nil
83
88
}
84
89
90
+ // Fake State interface methods implementation for getting
91
+ type MockStatSanity struct {
92
+ targetPath string
93
+ }
94
+
95
+ // FSInfo ...
96
+ func (su * MockStatSanity ) FSInfo (path string ) (int64 , int64 , int64 , int64 , int64 , int64 , error ) {
97
+ return 1 , 1 , 1 , 1 , 1 , 1 , nil
98
+ }
99
+
100
+ // DeviceInfo ...
101
+ func (su * MockStatSanity ) DeviceInfo (path string ) (int64 , error ) {
102
+ return 1 , nil
103
+ }
104
+
105
+ // IsBlockDevice ..
106
+ func (su * MockStatSanity ) IsBlockDevice (devicePath string ) (bool , error ) {
107
+ if ! strings .Contains (devicePath , su .targetPath ) {
108
+ return false , errors .New ("not a valid path" )
109
+ }
110
+ return true , nil
111
+ }
112
+
113
+ func (su * MockStatSanity ) IsPathNotExist (devicePath string ) bool {
114
+ // return true if not matched
115
+ return ! strings .Contains (devicePath , su .targetPath )
116
+ }
117
+
85
118
type fakeCloudProvider struct {
86
119
disks map [string ]* fakeDisk
87
120
pub map [string ]string
0 commit comments