mirror of
https://github.com/octoleo/restic.git
synced 2024-11-16 01:57:10 +00:00
Add ability to open bucket using S3 object for testing purposes.
This commit is contained in:
parent
b793261ba1
commit
4aa75994b0
@ -28,6 +28,11 @@ type S3 struct {
|
|||||||
path string
|
path string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Open a backend using an S3 bucket object
|
||||||
|
func OpenS3Bucket(bucket *s3.Bucket, bucketname string) *S3 {
|
||||||
|
return &S3{bucket: bucket, path: bucketname}
|
||||||
|
}
|
||||||
|
|
||||||
// Open opens the s3 backend at bucket and region.
|
// Open opens the s3 backend at bucket and region.
|
||||||
func Open(regionname, bucketname string) (*S3, error) {
|
func Open(regionname, bucketname string) (*S3, error) {
|
||||||
auth, err := aws.EnvAuth()
|
auth, err := aws.EnvAuth()
|
||||||
|
@ -23,7 +23,7 @@ func setupS3Backend(t *testing.T) *bes3.S3 {
|
|||||||
|
|
||||||
t.Logf("created s3 backend locally at %s", testServer.URL)
|
t.Logf("created s3 backend locally at %s", testServer.URL)
|
||||||
|
|
||||||
return bes3.S3{bucket: bucket, path: "testbucket"}
|
return bes3.OpenS3Bucket(bucket, "testbucket")
|
||||||
}
|
}
|
||||||
|
|
||||||
func teardownS3Backend(t *testing.T, b *bes3.S3) {
|
func teardownS3Backend(t *testing.T, b *bes3.S3) {
|
||||||
|
Loading…
Reference in New Issue
Block a user