コード例 #1
0
ファイル: s3_sequins_test.go プロジェクト: delkyd/sequins
func setupS3() *backend.S3Backend {
	fakeS3, _ := s3test.NewServer(&s3test.Config{})

	// cargo-culted from s3test
	fakeRegion := aws.Region{
		Name:                 "faux-region-1",
		S3Endpoint:           fakeS3.URL(),
		S3LocationConstraint: true,
	}

	auth, _ := aws.GetAuth("foo", "bar", "", time.Time{})
	bucket := s3.New(auth, fakeRegion).Bucket("sequinstest")
	bucket.PutBucket("")

	putFile(bucket, "test_data/0/part-00000")
	putFile(bucket, "test_data/0/part-00001")
	putFile(bucket, "test_data/0/_SUCCESS")

	putFile(bucket, "test_data/1/part-00000")
	putFile(bucket, "test_data/1/part-00001")

	bucket.Put("test_data/foo", []byte("nothing"), "", "", s3.Options{})

	return backend.NewS3Backend(bucket, "test_data")
}
コード例 #2
0
func (s *LocalServer) SetUp(c *gocheck.C) {
	srv, err := s3test.NewServer(s.config)
	c.Assert(err, gocheck.IsNil)
	c.Assert(srv, gocheck.NotNil)

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