예제 #1
0
func (srv *localServer) startServer(c *gc.C) {
	var err error
	srv.ec2srv, err = ec2test.NewServer()
	if err != nil {
		c.Fatalf("cannot start ec2 test server: %v", err)
	}
	srv.ec2srv.SetCreateRootDisks(srv.createRootDisks)
	srv.s3srv, err = s3test.NewServer(srv.config)
	if err != nil {
		c.Fatalf("cannot start s3 test server: %v", err)
	}
	aws.Regions["test"] = aws.Region{
		Name:                 "test",
		EC2Endpoint:          srv.ec2srv.URL(),
		S3Endpoint:           srv.s3srv.URL(),
		S3LocationConstraint: true,
	}
	srv.addSpice(c)

	zones := make([]amzec2.AvailabilityZoneInfo, 3)
	zones[0].Region = "test"
	zones[0].Name = "test-available"
	zones[0].State = "available"
	zones[1].Region = "test"
	zones[1].Name = "test-impaired"
	zones[1].State = "impaired"
	zones[2].Region = "test"
	zones[2].Name = "test-unavailable"
	zones[2].State = "unavailable"
	srv.ec2srv.SetAvailabilityZones(zones)
}
예제 #2
0
파일: s3_test.go 프로젝트: marete/restic
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, berr := service.Bucket("testbucket")
	OK(t, berr)
	err = bucket.PutBucket("private")
	OK(t, err)

	t.Logf("created s3 backend locally")

	return bes3.OpenS3Bucket(bucket, "testbucket")
}
예제 #3
0
파일: s3t_test.go 프로젝트: marete/restic
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
	}
}