Пример #1
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
	}
}
Пример #2
0
func New() (*FakeS3, error) {
	var err error
	f := FakeS3{}
	f.Server, err = s3test.NewServer(&s3test.Config{})
	if err != nil {
		return nil, err
	}
	f.Config = &aws.Config{
		Credentials:      credentials.NewStaticCredentials("AKIAXXXXXXXXXXXXXXXX", "QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFB", ""),
		Endpoint:         aws.String(f.Server.URL()),
		Region:           aws.String("fake-region"),
		DisableSSL:       aws.Bool(true),
		S3ForcePathStyle: aws.Bool(true),
	}
	return &f, nil
}
	localDumpRdbPath string
	tmpDir           string
)

var _ = BeforeSuite(func() {
	redisHost := "127.0.0.1"
	redisPort := integration.RedisPort

	redisRunner = &integration.RedisRunner{}
	redisRunner.Start([]string{"--bind", redisHost, "--port", fmt.Sprintf("%d", redisPort)})

	localDumpRdbPath = filepath.Join(redisRunner.Dir, "dump.rdb")

	var err error
	s3Server, err = s3test.NewServer(&s3test.Config{
		Send409Conflict: true,
	})
	Expect(err).ToNot(HaveOccurred())

	logger := lager.NewLogger("logger")

	client, err := redis.Connect(redis.Host(redisHost), redis.Port(redisPort))
	Expect(err).ToNot(HaveOccurred())

	Expect(localDumpRdbPath).ToNot(BeAnExistingFile())

	bucketName := "test-bucket"
	targetPath := "target"

	bucket := goamzBucket(bucketName, s3Server.URL())
	_, err = bucket.Get(targetPath)