@@ -20,7 +20,6 @@ import (
20
20
"math/rand"
21
21
"os/exec"
22
22
"os/user"
23
- "path/filepath"
24
23
"strconv"
25
24
"strings"
26
25
"sync"
@@ -38,10 +37,6 @@ import (
38
37
"github.com/jacobsa/fuse/fuseops"
39
38
"github.com/jacobsa/fuse/fuseutil"
40
39
41
- "github.com/minio/minio/pkg/auth"
42
- "github.com/minio/minio/pkg/server"
43
- "github.com/minio/minio/pkg/server/api"
44
-
45
40
. "gopkg.in/check.v1"
46
41
)
47
42
@@ -119,50 +114,20 @@ func (s *GoofysTest) waitFor(t *C, addr string) (err error) {
119
114
return
120
115
}
121
116
122
- func (s * GoofysTest ) setupMinio (t * C , addr string ) (accessKey string , secretKey string ) {
123
- accessKeyID , perr := auth .GenerateAccessKeyID ()
124
- t .Assert (perr , IsNil )
125
- secretAccessKey , perr := auth .GenerateSecretAccessKey ()
126
- t .Assert (perr , IsNil )
127
-
128
- accessKey = string (accessKeyID )
129
- secretKey = string (secretAccessKey )
130
-
131
- authConf := & auth.Config {}
132
- authConf .Users = make (map [string ]* auth.User )
133
- authConf .Users [string (accessKeyID )] = & auth.User {
134
- Name : "testuser" ,
135
- AccessKeyID : accessKey ,
136
- SecretAccessKey : secretKey ,
137
- }
138
- auth .SetAuthConfigPath (filepath .Join (t .MkDir (), "users.json" ))
139
- perr = auth .SaveConfig (authConf )
140
- t .Assert (perr , IsNil )
141
-
142
- go server .Start (api.Config { Address : addr })
143
-
144
- err := s .waitFor (t , addr )
145
- t .Assert (err , IsNil )
146
-
147
- return
148
- }
149
-
150
117
func (s * GoofysTest ) SetUpSuite (t * C ) {
151
118
//addr := "play.minio.io:9000"
152
- addr := "127.0.0.1:9000"
153
-
154
- accessKey , secretKey := s .setupMinio (t , addr )
119
+ addr := "127.0.0.1:8080"
155
120
156
121
s .awsConfig = & aws.Config {
157
122
//Credentials: credentials.AnonymousCredentials,
158
- Credentials : credentials .NewStaticCredentials (accessKey , secretKey , "" ),
159
- Region : aws .String ("milkyway" ), //aws.String(" us-west-2"),
123
+ Credentials : credentials .NewStaticCredentials ("foo" , "bar" , "" ),
124
+ Region : aws .String ("us-west-2" ),
160
125
Endpoint : aws .String (addr ),
161
126
DisableSSL : aws .Bool (true ),
162
127
S3ForcePathStyle : aws .Bool (true ),
163
128
MaxRetries : aws .Int (0 ),
164
- Logger : t ,
165
- LogLevel : aws .LogLevel (aws .LogDebug ),
129
+ // Logger: t,
130
+ // LogLevel: aws.LogLevel(aws.LogDebug),
166
131
//LogLevel: aws.LogLevel(aws.LogDebug | aws.LogDebugWithHTTPBody),
167
132
}
168
133
s .s3 = s3 .New (s .awsConfig )
@@ -210,7 +175,7 @@ func (s *GoofysTest) setupEnv(t *C, bucket string, env map[string]io.ReadSeeker)
210
175
211
176
// from https://stackoverflow.com/questions/22892120/how-to-generate-a-random-string-of-a-fixed-length-in-golang
212
177
func RandStringBytesMaskImprSrc (n int ) string {
213
- const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
178
+ const letterBytes = "abcdefghijklmnopqrstuvwxyz0123456789 "
214
179
const (
215
180
letterIdxBits = 6 // 6 bits to represent a letter index
216
181
letterIdxMask = 1 << letterIdxBits - 1 // All 1-bits, as many as letterIdxBits
@@ -427,7 +392,6 @@ func (s *GoofysTest) TestCreateFiles(t *C) {
427
392
}
428
393
429
394
func (s * GoofysTest ) TestUnlink (t * C ) {
430
- t .Skip ("minio doesn't support unlink" )
431
395
fileName := "file1"
432
396
433
397
err := s .getRoot (t ).Unlink (s .fs , & fileName )
@@ -436,9 +400,6 @@ func (s *GoofysTest) TestUnlink(t *C) {
436
400
// make sure that it's gone from s3
437
401
_ , err = s .s3 .GetObject (& s3.GetObjectInput { Bucket : & s .fs .bucket , Key : & fileName })
438
402
t .Assert (mapAwsError (err ), Equals , fuse .ENOENT )
439
-
440
- err = s .getRoot (t ).Unlink (s .fs , & fileName )
441
- t .Assert (err , Equals , fuse .ENOENT )
442
403
}
443
404
444
405
func (s * GoofysTest ) testWriteFile (t * C , fileName string , size int64 , write_size int ) {
@@ -538,7 +499,6 @@ func (s *GoofysTest) TestRmDir(t *C) {
538
499
err = root .RmDir (s .fs , & dir )
539
500
t .Assert (err , Equals , fuse .ENOTEMPTY )
540
501
541
- t .Skip ("minio doesn't support unlink" )
542
502
dir = "empty_dir"
543
503
err = root .RmDir (s .fs , & dir )
544
504
t .Assert (err , IsNil )
@@ -566,15 +526,15 @@ func (s *GoofysTest) TestRename(t *C) {
566
526
567
527
from , to = "file1" , "new_file"
568
528
err = root .Rename (s .fs , & from , root , & to )
569
- t .Assert (err , Equals , syscall . ENOTSUP )
529
+ t .Assert (err , IsNil )
570
530
571
531
_ , err = s .s3 .HeadObject (& s3.HeadObjectInput { Bucket : & s .fs .bucket , Key : & to })
572
532
t .Assert (err , IsNil )
573
533
574
534
from , to = "file3" , "new_file"
575
535
dir , _ := s .LookUpInode (t , "dir1" )
576
536
err = dir .Rename (s .fs , & from , root , & to )
577
- t .Assert (err , Equals , syscall . ENOTSUP )
537
+ t .Assert (err , IsNil )
578
538
579
539
_ , err = s .s3 .HeadObject (& s3.HeadObjectInput { Bucket : & s .fs .bucket , Key : & to })
580
540
t .Assert (err , IsNil )
0 commit comments