func init() { if os.Getenv("DEBUG") != "" { defaults.DefaultConfig.LogLevel = aws.LogLevel(aws.LogDebug) } if os.Getenv("DEBUG_SIGNING") != "" { defaults.DefaultConfig.LogLevel = aws.LogLevel(aws.LogDebugWithSigning) } if os.Getenv("DEBUG_BODY") != "" { defaults.DefaultConfig.LogLevel = aws.LogLevel(aws.LogDebugWithSigning | aws.LogDebugWithHTTPBody) } if aws.StringValue(defaults.DefaultConfig.Region) == "" { panic("AWS_REGION must be configured to run integration tests") } }
func copyConfig(config *Config) *aws.Config { if config == nil { config = &Config{} } c := &aws.Config{ Credentials: credentials.AnonymousCredentials, Endpoint: config.Endpoint, HTTPClient: config.HTTPClient, Logger: config.Logger, LogLevel: config.LogLevel, MaxRetries: config.MaxRetries, } if c.HTTPClient == nil { c.HTTPClient = http.DefaultClient } if c.Logger == nil { c.Logger = aws.NewDefaultLogger() } if c.LogLevel == nil { c.LogLevel = aws.LogLevel(aws.LogOff) } if c.MaxRetries == nil { c.MaxRetries = aws.Int(DefaultRetries) } return c }
func init() { if os.Getenv("DEBUG") != "" { defaults.DefaultConfig.LogLevel = aws.LogLevel(aws.LogDebug) } if os.Getenv("DEBUG_SIGNING") != "" { defaults.DefaultConfig.LogLevel = aws.LogLevel(aws.LogDebugWithSigning) } if os.Getenv("DEBUG_BODY") != "" { defaults.DefaultConfig.LogLevel = aws.LogLevel(aws.LogDebugWithSigning | aws.LogDebugWithHTTPBody) } When(`^I call the "(.+?)" API$`, func(op string) { call(op, nil, false) }) When(`^I call the "(.+?)" API with:$`, func(op string, args [][]string) { call(op, args, false) }) Then(`^the value at "(.+?)" should be a list$`, func(member string) { vals := awsutil.ValuesAtAnyPath(World["response"], member) assert.NotEmpty(T, vals) }) Then(`^the response should contain a "(.+?)"$`, func(member string) { vals := awsutil.ValuesAtAnyPath(World["response"], member) assert.NotEmpty(T, vals) }) When(`^I attempt to call the "(.+?)" API with:$`, func(op string, args [][]string) { call(op, args, true) }) Then(`^I expect the response error code to be "(.+?)"$`, func(code string) { err, ok := World["error"].(awserr.Error) assert.True(T, ok, "no error returned") if ok { assert.Equal(T, code, err.Code()) } }) And(`^I expect the response error message to include:$`, func(data string) { err, ok := World["error"].(awserr.Error) assert.True(T, ok, "no error returned") if ok { assert.Contains(T, err.Message(), data) } }) And(`^I expect the response error message to include one of:$`, func(table [][]string) { err, ok := World["error"].(awserr.Error) assert.True(T, ok, "no error returned") if ok { found := false for _, row := range table { if strings.Contains(err.Message(), row[0]) { found = true break } } assert.True(T, found, fmt.Sprintf("no error messages matched: \"%s\"", err.Message())) } }) }