2015-05-15 21:53:00 +00:00
|
|
|
package backend_test
|
|
|
|
|
|
|
|
import (
|
2015-11-07 12:43:15 +00:00
|
|
|
"os"
|
2015-05-15 21:53:00 +00:00
|
|
|
"testing"
|
|
|
|
|
2015-11-07 12:43:15 +00:00
|
|
|
"github.com/minio/minio-go"
|
2015-05-15 21:53:00 +00:00
|
|
|
bes3 "github.com/restic/restic/backend/s3"
|
2015-11-07 12:43:15 +00:00
|
|
|
. "github.com/restic/restic/test"
|
2015-05-15 21:53:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestS3Backend(t *testing.T) {
|
2015-11-07 12:43:15 +00:00
|
|
|
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
|
|
|
|
2015-11-07 12:43:15 +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
|
|
|
|
2015-11-07 12:43:15 +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)
|
|
|
|
}
|