Ejemplo n.º 1
0
func setupS3Backend(t *testing.T) *bes3.S3Backend {
	s.config = &s3test.Config{
		Send409Conflict: true,
	}
	srv, err := s3test.NewServer(s.config)
	OK(t, err)
	s.srv = srv

	s.region = aws.Region{
		Name:                 "faux-region-1",
		S3Endpoint:           srv.URL(),
		S3LocationConstraint: true, // s3test server requires a LocationConstraint
	}

	s.auth = aws.Auth{"abc", "123", ""}

	service := s3.New(s.auth, s.region)
	bucket := service.Bucket("testbucket")
	err = bucket.PutBucket("private")
	OK(t, err)

	t.Logf("created s3 backend locally")

	return bes3.OpenS3Bucket(bucket, "testbucket")
}
Ejemplo n.º 2
0
func (s *LocalServer) SetUp(c *C) {
	srv, err := s3test.NewServer(s.config)
	c.Assert(err, IsNil)
	c.Assert(srv, NotNil)

	s.srv = srv
	s.region = aws.Region{
		Name:                 "faux-region-1",
		S3Endpoint:           srv.URL(),
		S3LocationConstraint: true, // s3test server requires a LocationConstraint
	}
}
Ejemplo n.º 3
0
func (s *PublishedStorageSuite) SetUpTest(c *C) {
	var err error
	s.srv, err = s3test.NewServer(&s3test.Config{})
	c.Assert(err, IsNil)
	c.Assert(s.srv, NotNil)

	auth, _ := aws.GetAuth("aa", "bb")
	s.storage, err = NewPublishedStorageRaw(auth, aws.Region{Name: "test-1", S3Endpoint: s.srv.URL(), S3LocationConstraint: true}, "test", "", "", "", "", false, true)
	c.Assert(err, IsNil)

	s.prefixedStorage, err = NewPublishedStorageRaw(auth, aws.Region{Name: "test-1", S3Endpoint: s.srv.URL(), S3LocationConstraint: true}, "test", "", "lala", "", "", false, true)
	c.Assert(err, IsNil)

	err = s.storage.s3.Bucket("test").PutBucket("private")
	c.Assert(err, IsNil)
}
func (s *localS3Server) SetUp() {
	if s.srv != nil {
		return
	}

	srv, err := s3test.NewServer(s.config)
	if err != nil {
		panic(err)
	}

	s.srv = srv
	s.Region = aws.Region{
		Name:                 "faux-region-9000",
		S3Endpoint:           srv.URL(),
		S3LocationConstraint: true,
	}
}
Ejemplo n.º 5
0
package s3_test

import (
	"github.com/mitchellh/goamz/s3/s3test"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"testing"
)

var fakeS3EndpointURL string

func TestS3(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "S3 Suite")
}

var _ = BeforeSuite(func() {
	s3TestServerConfig := &s3test.Config{
		Send409Conflict: true,
	}
	s3testServer, err := s3test.NewServer(s3TestServerConfig)
	Ω(err).ToNot(HaveOccurred())
	fakeS3EndpointURL = s3testServer.URL()
})