-
Notifications
You must be signed in to change notification settings - Fork 9.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
re-added tests #5049
re-added tests #5049
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ func TestAccAWSLambdaAlias_basic(t *testing.T) { | |
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckAwsLambdaAliasExists("aws_lambda_alias.lambda_alias_test", &conf), | ||
testAccCheckAwsLambdaAttributes(&conf), | ||
testAccCheckAwsLambdaAliasRoutingConfigDoesNotExist(&conf), | ||
resource.TestMatchResourceAttr("aws_lambda_alias.lambda_alias_test", "arn", | ||
regexp.MustCompile(`^arn:aws:lambda:[a-z]+-[a-z]+-[0-9]+:\d{12}:function:`+funcName+`:`+aliasName+`$`)), | ||
), | ||
|
@@ -78,6 +79,54 @@ func TestAccAWSLambdaAlias_nameupdate(t *testing.T) { | |
}) | ||
} | ||
|
||
func TestAccAWSLambdaAlias_routingconfig(t *testing.T) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This acceptance test is currently failing for me:
Its complaining because version 2 of the Lambda function (newly created in the test) does not exist. I'm not sure its possible to create this configuration without at least two versions of the Lambda function existing already. When trying to set the routing configuration in the existing test configuration to: routing_config = {
additional_version_weights = {
"1" = 0.5
}
} I get:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bflad my poor merge resulted in this test getting lost sorry. It creates multiple versions in order for traffic shifting to be possible and tests that the routing config can be added an removed. Acceptance tests passing.
|
||
var conf lambda.AliasConfiguration | ||
|
||
rString := acctest.RandString(8) | ||
roleName := fmt.Sprintf("tf_acc_role_lambda_alias_basic_%s", rString) | ||
policyName := fmt.Sprintf("tf_acc_policy_lambda_alias_basic_%s", rString) | ||
attachmentName := fmt.Sprintf("tf_acc_attachment_%s", rString) | ||
funcName := fmt.Sprintf("tf_acc_lambda_func_alias_basic_%s", rString) | ||
aliasName := fmt.Sprintf("tf_acc_lambda_alias_basic_%s", rString) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
CheckDestroy: testAccCheckAwsLambdaAliasDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccAwsLambdaAliasConfig(roleName, policyName, attachmentName, funcName, aliasName), | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckAwsLambdaAliasExists("aws_lambda_alias.lambda_alias_test", &conf), | ||
testAccCheckAwsLambdaAttributes(&conf), | ||
resource.TestMatchResourceAttr("aws_lambda_alias.lambda_alias_test", "arn", | ||
regexp.MustCompile(`^arn:aws:lambda:[a-z]+-[a-z]+-[0-9]+:\d{12}:function:`+funcName+`:`+aliasName+`$`)), | ||
), | ||
}, | ||
{ | ||
Config: testAccAwsLambdaAliasConfigWithRoutingConfig(roleName, policyName, attachmentName, funcName, aliasName), | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckAwsLambdaAliasExists("aws_lambda_alias.lambda_alias_test", &conf), | ||
testAccCheckAwsLambdaAttributes(&conf), | ||
testAccCheckAwsLambdaAliasRoutingConfigExists(&conf), | ||
resource.TestMatchResourceAttr("aws_lambda_alias.lambda_alias_test", "arn", | ||
regexp.MustCompile(`^arn:aws:lambda:[a-z]+-[a-z]+-[0-9]+:\d{12}:function:`+funcName+`:`+aliasName+`$`)), | ||
), | ||
}, | ||
{ | ||
Config: testAccAwsLambdaAliasConfig(roleName, policyName, attachmentName, funcName, aliasName), | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckAwsLambdaAliasExists("aws_lambda_alias.lambda_alias_test", &conf), | ||
testAccCheckAwsLambdaAttributes(&conf), | ||
testAccCheckAwsLambdaAliasRoutingConfigDoesNotExist(&conf), | ||
resource.TestMatchResourceAttr("aws_lambda_alias.lambda_alias_test", "arn", | ||
regexp.MustCompile(`^arn:aws:lambda:[a-z]+-[a-z]+-[0-9]+:\d{12}:function:`+funcName+`:`+aliasName+`$`)), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccCheckAwsLambdaAliasDestroy(s *terraform.State) error { | ||
conn := testAccProvider.Meta().(*AWSClient).lambdaconn | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this! 💯