diff --git a/.gitignore b/.gitignore index 7d49375f..2ccd54ac 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ goofys goofys.test xout +s3proxy.jar diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..6d077535 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +language: go +sudo: false +addons: + apt_packages: + - openjdk-7-jre-headless +install: +- go get -t ./... +- make +go: + - 1.5.1 diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..f115e2af --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +test: s3proxy.jar + ./run-tests.sh + +s3proxy.jar: + wget https://oss.sonatype.org/content/repositories/snapshots/org/gaul/s3proxy/1.5.0-SNAPSHOT/s3proxy-1.5.0-20151012.215145-8-jar-with-dependencies.jar -O s3proxy.jar + +get-deps: s3proxy.jar + go get -t ./... diff --git a/goofys.go b/goofys.go index 88315fa8..adcd3b8f 100644 --- a/goofys.go +++ b/goofys.go @@ -127,7 +127,7 @@ func NewGoofys(bucket string, awsConfig *aws.Config, flags *flagStorage) *Goofys log.Println(err) return nil } - } else if *awsConfig.Region != "milkyway" { + } else if len(toRegion) == 0 && *awsConfig.Region != "milkyway" { log.Printf("Unable to detect bucket region, staying at '%v'", *awsConfig.Region) } diff --git a/goofys_test.go b/goofys_test.go index 12230087..fb6a71e6 100644 --- a/goofys_test.go +++ b/goofys_test.go @@ -20,7 +20,6 @@ import ( "math/rand" "os/exec" "os/user" - "path/filepath" "strconv" "strings" "sync" @@ -38,10 +37,6 @@ import ( "github.com/jacobsa/fuse/fuseops" "github.com/jacobsa/fuse/fuseutil" - "github.com/minio/minio/pkg/auth" - "github.com/minio/minio/pkg/server" - "github.com/minio/minio/pkg/server/api" - . "gopkg.in/check.v1" ) @@ -119,50 +114,20 @@ func (s *GoofysTest) waitFor(t *C, addr string) (err error) { return } -func (s *GoofysTest) setupMinio(t *C, addr string) (accessKey string, secretKey string) { - accessKeyID, perr := auth.GenerateAccessKeyID() - t.Assert(perr, IsNil) - secretAccessKey, perr := auth.GenerateSecretAccessKey() - t.Assert(perr, IsNil) - - accessKey = string(accessKeyID) - secretKey = string(secretAccessKey) - - authConf := &auth.Config{} - authConf.Users = make(map[string]*auth.User) - authConf.Users[string(accessKeyID)] = &auth.User{ - Name: "testuser", - AccessKeyID: accessKey, - SecretAccessKey: secretKey, - } - auth.SetAuthConfigPath(filepath.Join(t.MkDir(), "users.json")) - perr = auth.SaveConfig(authConf) - t.Assert(perr, IsNil) - - go server.Start(api.Config{ Address: addr }) - - err := s.waitFor(t, addr) - t.Assert(err, IsNil) - - return -} - func (s *GoofysTest) SetUpSuite(t *C) { //addr := "play.minio.io:9000" - addr := "127.0.0.1:9000" - - accessKey, secretKey := s.setupMinio(t, addr) + addr := "127.0.0.1:8080" s.awsConfig = &aws.Config{ //Credentials: credentials.AnonymousCredentials, - Credentials: credentials.NewStaticCredentials(accessKey, secretKey, ""), - Region: aws.String("milkyway"),//aws.String("us-west-2"), + Credentials: credentials.NewStaticCredentials("foo", "bar", ""), + Region: aws.String("us-west-2"), Endpoint: aws.String(addr), DisableSSL: aws.Bool(true), S3ForcePathStyle: aws.Bool(true), MaxRetries: aws.Int(0), - Logger: t, - LogLevel: aws.LogLevel(aws.LogDebug), + //Logger: t, + //LogLevel: aws.LogLevel(aws.LogDebug), //LogLevel: aws.LogLevel(aws.LogDebug | aws.LogDebugWithHTTPBody), } s.s3 = s3.New(s.awsConfig) @@ -210,7 +175,7 @@ func (s *GoofysTest) setupEnv(t *C, bucket string, env map[string]io.ReadSeeker) // from https://stackoverflow.com/questions/22892120/how-to-generate-a-random-string-of-a-fixed-length-in-golang func RandStringBytesMaskImprSrc(n int) string { - const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + const letterBytes = "abcdefghijklmnopqrstuvwxyz0123456789" const ( letterIdxBits = 6 // 6 bits to represent a letter index letterIdxMask = 1<