Skip to content

Commit 22e1ca8

Browse files
committed
enable travis
1 parent 27768af commit 22e1ca8

File tree

7 files changed

+54
-49
lines changed

7 files changed

+54
-49
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
goofys
33
goofys.test
44
xout
5+
s3proxy.jar

.travis.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
language: go
2+
sudo: false
3+
addons:
4+
apt_packages:
5+
- openjdk-7-jre-headless
6+
install:
7+
- go get -t ./...
8+
- make
9+
go:
10+
- 1.5.1

Makefile

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
test: s3proxy.jar
2+
./run-tests.sh
3+
4+
s3proxy.jar:
5+
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
6+
7+
get-deps: s3proxy.jar
8+
go get -t ./...

goofys.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func NewGoofys(bucket string, awsConfig *aws.Config, flags *flagStorage) *Goofys
127127
log.Println(err)
128128
return nil
129129
}
130-
} else if *awsConfig.Region != "milkyway" {
130+
} else if len(toRegion) == 0 && *awsConfig.Region != "milkyway" {
131131
log.Printf("Unable to detect bucket region, staying at '%v'", *awsConfig.Region)
132132
}
133133

goofys_test.go

+8-48
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"math/rand"
2121
"os/exec"
2222
"os/user"
23-
"path/filepath"
2423
"strconv"
2524
"strings"
2625
"sync"
@@ -38,10 +37,6 @@ import (
3837
"github.com/jacobsa/fuse/fuseops"
3938
"github.com/jacobsa/fuse/fuseutil"
4039

41-
"github.com/minio/minio/pkg/auth"
42-
"github.com/minio/minio/pkg/server"
43-
"github.com/minio/minio/pkg/server/api"
44-
4540
. "gopkg.in/check.v1"
4641
)
4742

@@ -119,50 +114,20 @@ func (s *GoofysTest) waitFor(t *C, addr string) (err error) {
119114
return
120115
}
121116

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-
150117
func (s *GoofysTest) SetUpSuite(t *C) {
151118
//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"
155120

156121
s.awsConfig = &aws.Config{
157122
//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"),
160125
Endpoint: aws.String(addr),
161126
DisableSSL: aws.Bool(true),
162127
S3ForcePathStyle: aws.Bool(true),
163128
MaxRetries: aws.Int(0),
164-
Logger: t,
165-
LogLevel: aws.LogLevel(aws.LogDebug),
129+
//Logger: t,
130+
//LogLevel: aws.LogLevel(aws.LogDebug),
166131
//LogLevel: aws.LogLevel(aws.LogDebug | aws.LogDebugWithHTTPBody),
167132
}
168133
s.s3 = s3.New(s.awsConfig)
@@ -210,7 +175,7 @@ func (s *GoofysTest) setupEnv(t *C, bucket string, env map[string]io.ReadSeeker)
210175

211176
// from https://stackoverflow.com/questions/22892120/how-to-generate-a-random-string-of-a-fixed-length-in-golang
212177
func RandStringBytesMaskImprSrc(n int) string {
213-
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
178+
const letterBytes = "abcdefghijklmnopqrstuvwxyz0123456789"
214179
const (
215180
letterIdxBits = 6 // 6 bits to represent a letter index
216181
letterIdxMask = 1<<letterIdxBits - 1 // All 1-bits, as many as letterIdxBits
@@ -427,7 +392,6 @@ func (s *GoofysTest) TestCreateFiles(t *C) {
427392
}
428393

429394
func (s *GoofysTest) TestUnlink(t *C) {
430-
t.Skip("minio doesn't support unlink")
431395
fileName := "file1"
432396

433397
err := s.getRoot(t).Unlink(s.fs, &fileName)
@@ -436,9 +400,6 @@ func (s *GoofysTest) TestUnlink(t *C) {
436400
// make sure that it's gone from s3
437401
_, err = s.s3.GetObject(&s3.GetObjectInput{ Bucket: &s.fs.bucket, Key: &fileName })
438402
t.Assert(mapAwsError(err), Equals, fuse.ENOENT)
439-
440-
err = s.getRoot(t).Unlink(s.fs, &fileName)
441-
t.Assert(err, Equals, fuse.ENOENT)
442403
}
443404

444405
func (s *GoofysTest) testWriteFile(t *C, fileName string, size int64, write_size int) {
@@ -538,7 +499,6 @@ func (s *GoofysTest) TestRmDir(t *C) {
538499
err = root.RmDir(s.fs, &dir)
539500
t.Assert(err, Equals, fuse.ENOTEMPTY)
540501

541-
t.Skip("minio doesn't support unlink")
542502
dir = "empty_dir"
543503
err = root.RmDir(s.fs, &dir)
544504
t.Assert(err, IsNil)
@@ -566,15 +526,15 @@ func (s *GoofysTest) TestRename(t *C) {
566526

567527
from, to = "file1", "new_file"
568528
err = root.Rename(s.fs, &from, root, &to)
569-
t.Assert(err, Equals, syscall.ENOTSUP)
529+
t.Assert(err, IsNil)
570530

571531
_, err = s.s3.HeadObject(&s3.HeadObjectInput{ Bucket: &s.fs.bucket, Key: &to })
572532
t.Assert(err, IsNil)
573533

574534
from, to = "file3", "new_file"
575535
dir, _ := s.LookUpInode(t, "dir1")
576536
err = dir.Rename(s.fs, &from, root, &to)
577-
t.Assert(err, Equals, syscall.ENOTSUP)
537+
t.Assert(err, IsNil)
578538

579539
_, err = s.s3.HeadObject(&s3.HeadObjectInput{ Bucket: &s.fs.bucket, Key: &to })
580540
t.Assert(err, IsNil)

run-tests.sh

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
set -o xtrace
4+
set -o errexit
5+
set -o nounset
6+
7+
function cleanup {
8+
if [ "$PROXY_PID" != "" ]; then
9+
kill $PROXY_PID
10+
fi
11+
}
12+
13+
trap cleanup EXIT
14+
15+
PROXY_BIN="java -jar s3proxy.jar --properties s3proxy.properties"
16+
stdbuf -oL -eL $PROXY_BIN &
17+
PROXY_PID=$!
18+
19+
go test -v ./... #-check.f TestUnlink
20+
exit $?

s3proxy.properties

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
s3proxy.endpoint=http://127.0.0.1:8080
2+
s3proxy.authorization=none
3+
jclouds.provider=transient
4+
jclouds.identity=local-identity
5+
jclouds.credential=local-credential
6+
jclouds.regions=us-west-2

0 commit comments

Comments
 (0)