Runs s3 storagedriver tests against all regions (excluding gov)
This commit is contained in:
parent
f3f70d151d
commit
9e38ca2231
1 changed files with 18 additions and 13 deletions
|
@ -20,32 +20,37 @@ func Test(t *testing.T) { check.TestingT(t) }
|
||||||
func init() {
|
func init() {
|
||||||
accessKey := os.Getenv("AWS_ACCESS_KEY")
|
accessKey := os.Getenv("AWS_ACCESS_KEY")
|
||||||
secretKey := os.Getenv("AWS_SECRET_KEY")
|
secretKey := os.Getenv("AWS_SECRET_KEY")
|
||||||
region := os.Getenv("AWS_REGION")
|
|
||||||
bucket := os.Getenv("S3_BUCKET")
|
bucket := os.Getenv("S3_BUCKET")
|
||||||
encrypt := os.Getenv("S3_ENCRYPT")
|
encrypt := os.Getenv("S3_ENCRYPT")
|
||||||
|
|
||||||
s3DriverConstructor := func() (storagedriver.StorageDriver, error) {
|
s3DriverConstructor := func(region aws.Region) (storagedriver.StorageDriver, error) {
|
||||||
shouldEncrypt, err := strconv.ParseBool(encrypt)
|
shouldEncrypt, err := strconv.ParseBool(encrypt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return New(accessKey, secretKey, aws.GetRegion(region), shouldEncrypt, bucket)
|
return New(accessKey, secretKey, region, shouldEncrypt, bucket)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip S3 storage driver tests if environment variable parameters are not provided
|
// Skip S3 storage driver tests if environment variable parameters are not provided
|
||||||
skipCheck := func() string {
|
skipCheck := func() string {
|
||||||
if accessKey == "" || secretKey == "" || region == "" || bucket == "" || encrypt == "" {
|
if accessKey == "" || secretKey == "" || bucket == "" || encrypt == "" {
|
||||||
return "Must set AWS_ACCESS_KEY, AWS_SECRET_KEY, AWS_REGION, S3_BUCKET, and S3_ENCRYPT to run S3 tests"
|
return "Must set AWS_ACCESS_KEY, AWS_SECRET_KEY, S3_BUCKET, and S3_ENCRYPT to run S3 tests"
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
testsuites.RegisterInProcessSuite(s3DriverConstructor, skipCheck)
|
for _, region := range aws.Regions {
|
||||||
|
if region == aws.USGovWest {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
testsuites.RegisterInProcessSuite(s3DriverConstructor(region), skipCheck)
|
||||||
testsuites.RegisterIPCSuite(driverName, map[string]string{
|
testsuites.RegisterIPCSuite(driverName, map[string]string{
|
||||||
"accesskey": accessKey,
|
"accesskey": accessKey,
|
||||||
"secretkey": secretKey,
|
"secretkey": secretKey,
|
||||||
"region": region,
|
"region": region.Name,
|
||||||
"bucket": bucket,
|
"bucket": bucket,
|
||||||
"encrypt": encrypt,
|
"encrypt": encrypt,
|
||||||
}, skipCheck)
|
}, skipCheck)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue