-
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
Conversation
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.
This is currently not working for me, but it did tease out a Terraform panic that should be fixed
=== RUN TestAccAWSLambdaAlias_routingconfig
panic: interface conversion: interface {} is map[string]interface {}, not float64
goroutine 5188 [running]:
github.com/terraform-providers/terraform-provider-aws/aws.expandFloat64Map(0xc420ba1c20, 0xc420ba1c20)
/Users/bflad/go/src/github.com/terraform-providers/terraform-provider-aws/aws/structure.go:799 +0x1cb
github.com/terraform-providers/terraform-provider-aws/aws.expandLambdaAliasRoutingConfiguration(0xc4207d18a0, 0x1, 0x1, 0x339a8c0)
/Users/bflad/go/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_lambda_alias.go:177 +0xc8
github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsLambdaAliasCreate(0xc4204f1c70, 0x387fda0, 0xc420c34840, 0xc4204f1c70, 0x0)
/Users/bflad/go/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_lambda_alias.go:76 +0x391
Which can be fixed with:
# inside expandLambdaAliasRoutingConfiguration
if v, ok := m["additional_version_weights"]; ok {
aliasRoutingConfiguration.AdditionalVersionWeights = expandFloat64Map(v.(map[string]interface{}))
}
@@ -78,6 +79,35 @@ 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 comment
The reason will be displayed to describe this comment to others. Learn more.
This acceptance test is currently failing for me:
make testacc TEST=./aws TESTARGS='-run=TestAccAWSLambdaAlias_routingconfig'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSLambdaAlias_routingconfig -timeout 120m
=== RUN TestAccAWSLambdaAlias_routingconfig
--- FAIL: TestAccAWSLambdaAlias_routingconfig (86.12s)
testing.go:518: Step 0 error: Error applying: 1 error(s) occurred:
* aws_lambda_alias.lambda_alias_test: 1 error(s) occurred:
* aws_lambda_alias.lambda_alias_test: Error creating Lambda alias: ResourceNotFoundException: Function not found: arn:aws:lambda:us-west-2:187416307283:function:tf_acc_lambda_func_alias_basic_vmhu4b4h:2
status code: 404, request id: 8e743c6f-7e17-11e8-81bb-0f6cecc9e91a
FAIL
FAIL github.com/terraform-providers/terraform-provider-aws/aws 86.161s
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:
* aws_lambda_alias.lambda_alias_test: Error creating Lambda alias: InvalidParameterValueException: Invalid function version 1. Function version 1 is already included in routing configuration.
status code: 400, request id: 6f7ccbcf-7e16-11e8-b729-25d25f4dd472
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.
@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.
=== RUN TestAccAWSLambdaAlias_routingconfig
--- PASS: TestAccAWSLambdaAlias_routingconfig (74.10s)
PASS
ok github.com/eggsbenjamin/terraform-provider-aws/aws 74.131s
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 so much @eggsbenjamin!! Looks good. 🚀
make testacc TEST=./aws TESTARGS='-run=TestAccAWSLambdaAlias'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSLambdaAlias -timeout 120m
=== RUN TestAccAWSLambdaAlias_basic
--- PASS: TestAccAWSLambdaAlias_basic (33.15s)
=== RUN TestAccAWSLambdaAlias_nameupdate
--- PASS: TestAccAWSLambdaAlias_nameupdate (41.00s)
=== RUN TestAccAWSLambdaAlias_routingconfig
--- PASS: TestAccAWSLambdaAlias_routingconfig (51.19s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 125.391s
@@ -190,8 +190,8 @@ func expandLambdaAliasRoutingConfiguration(l []interface{}) *lambda.AliasRouting | |||
|
|||
m := l[0].(map[string]interface{}) | |||
|
|||
if _, ok := m["additional_version_weights"]; ok { | |||
aliasRoutingConfiguration.AdditionalVersionWeights = expandFloat64Map(m) | |||
if v, ok := m["additional_version_weights"]; ok { |
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! 💯
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Unit test got lost when merging with latest master #3316
Re-added.