restic/backend/s3_test.go

35 lines
644 B
Go
Raw Normal View History

2015-05-15 21:53:00 +00:00
package backend_test
import (
"os"
2015-05-15 21:53:00 +00:00
"testing"
"github.com/minio/minio-go"
2015-05-15 21:53:00 +00:00
bes3 "github.com/restic/restic/backend/s3"
. "github.com/restic/restic/test"
2015-05-15 21:53:00 +00:00
)
func TestS3Backend(t *testing.T) {
config := minio.Config{
AccessKeyID: os.Getenv("AWS_ACCESS_KEY_ID"),
SecretAccessKey: os.Getenv("AWS_SECRET_ACCESS_KEY"),
Endpoint: "http://localhost:9000",
}
s3Client, err := minio.New(config)
if err != nil {
t.Fatal(err)
}
bucketname := "restictestbucket"
2015-11-06 22:00:10 +00:00
err = s3Client.MakeBucket(bucketname, "")
2015-11-06 22:00:10 +00:00
if err != nil {
t.Fatal(err)
}
2015-05-15 21:53:00 +00:00
s, err := bes3.Open("127.0.0.1:9000", bucketname)
OK(t, err)
2015-05-15 21:53:00 +00:00
testBackend(s, t)
}