-
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
service/appmesh: update to using typelist #13337
Conversation
Running acceptance tests: $ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSAppmesh/VirtualNode/'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSAppmesh/VirtualNode/ -timeout 120m
=== RUN TestAccAWSAppmesh
=== RUN TestAccAWSAppmesh/VirtualNode
=== RUN TestAccAWSAppmesh/VirtualNode/listenerHealthChecks
=== RUN TestAccAWSAppmesh/VirtualNode/logging
=== RUN TestAccAWSAppmesh/VirtualNode/tags
=== RUN TestAccAWSAppmesh/VirtualNode/basic
=== RUN TestAccAWSAppmesh/VirtualNode/cloudMapServiceDiscovery
--- FAIL: TestAccAWSAppmesh (204.90s)
--- FAIL: TestAccAWSAppmesh/VirtualNode (204.90s)
--- FAIL: TestAccAWSAppmesh/VirtualNode/listenerHealthChecks (13.54s)
testing.go:683: Step 0 error: errors during apply:
Error: error creating App Mesh virtual node: BadRequestException: Service Discovery can't be set without a listener.
on /tmp/tf-test582579556/main.tf line 6:
(source code not available)
--- FAIL: TestAccAWSAppmesh/VirtualNode/logging (13.73s)
testing.go:683: Step 0 error: errors during apply:
Error: error creating App Mesh virtual node: BadRequestException: Service Discovery can't be set without a listener.
on /tmp/tf-test613215798/main.tf line 6:
(source code not available)
--- PASS: TestAccAWSAppmesh/VirtualNode/tags (63.88s)
--- PASS: TestAccAWSAppmesh/VirtualNode/basic (27.90s)
--- FAIL: TestAccAWSAppmesh/VirtualNode/cloudMapServiceDiscovery (85.85s)
testing.go:683: Step 0 error: errors during apply:
Error: error creating App Mesh virtual node: BadRequestException: Service Discovery can't be set without a listener.
on /tmp/tf-test199777152/main.tf line 10:
(source code not available)
FAIL
FAIL github.com/terraform-providers/terraform-provider-aws/aws 204.956s
FAIL
GNUmakefile:26: recipe for target 'testacc' failed
make: *** [testacc] Error 1
$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSAppmesh/VirtualRouter/'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSAppmesh/VirtualRouter/ -timeout 120m
=== RUN TestAccAWSAppmesh
=== RUN TestAccAWSAppmesh/VirtualRouter
=== RUN TestAccAWSAppmesh/VirtualRouter/basic
=== RUN TestAccAWSAppmesh/VirtualRouter/tags
--- FAIL: TestAccAWSAppmesh (35.23s)
--- FAIL: TestAccAWSAppmesh/VirtualRouter (35.23s)
--- FAIL: TestAccAWSAppmesh/VirtualRouter/basic (16.93s)
testing.go:683: Step 0 error: Check failed: Check 5/11 error: aws_appmesh_virtual_router.test: Attribute 'spec.0.listener.#' not found
--- FAIL: TestAccAWSAppmesh/VirtualRouter/tags (18.30s)
testing.go:683: Step 0 error: After applying this step, the plan was not empty:
DIFF:
UPDATE: aws_appmesh_virtual_router.test
arn: "arn:aws:appmesh:us-west-2:123456789012:mesh/tf-acc-test-5724134345005515619/virtualRouter/tf-acc-test-3283401432193133171" => "arn:aws:appmesh:us-west-2:123456789012:mesh/tf-acc-test-5724134345005515619/virtualRouter/tf-acc-test-3283401432193133171"
created_date: "2020-05-18T21:14:54Z" => "2020-05-18T21:14:54Z"
id: "7016275f-4e6c-4612-8dda-7d41f2ec11bc" => "7016275f-4e6c-4612-8dda-7d41f2ec11bc"
last_updated_date: "2020-05-18T21:14:54Z" => "2020-05-18T21:14:54Z"
mesh_name: "tf-acc-test-5724134345005515619" => "tf-acc-test-5724134345005515619"
name: "tf-acc-test-3283401432193133171" => "tf-acc-test-3283401432193133171"
spec.#: "1" => "1"
spec.0.listener.#: "0" => "1"
spec.0.listener.0.port_mapping.#: "" => "1"
spec.0.listener.0.port_mapping.0.port: "" => "8080"
spec.0.listener.0.port_mapping.0.protocol: "" => "http"
spec.0.service_names.#: "" => "0"
tags.foo: "bar" => "bar"
tags.good: "bad" => "bad"
STATE:
aws_appmesh_mesh.test:
ID = tf-acc-test-5724134345005515619
provider = provider.aws
arn = arn:aws:appmesh:us-west-2:123456789012:mesh/tf-acc-test-5724134345005515619
created_date = 2020-05-18T21:14:52Z
last_updated_date = 2020-05-18T21:14:52Z
name = tf-acc-test-5724134345005515619
spec.# = 1
aws_appmesh_virtual_router.test:
ID = 7016275f-4e6c-4612-8dda-7d41f2ec11bc
provider = provider.aws
arn = arn:aws:appmesh:us-west-2:123456789012:mesh/tf-acc-test-5724134345005515619/virtualRouter/tf-acc-test-3283401432193133171
created_date = 2020-05-18T21:14:54Z
last_updated_date = 2020-05-18T21:14:54Z
mesh_name = tf-acc-test-5724134345005515619
name = tf-acc-test-3283401432193133171
spec.# = 1
tags.foo = bar
tags.good = bad
Dependencies:
aws_appmesh_mesh.test
FAIL
FAIL github.com/terraform-providers/terraform-provider-aws/aws 35.261s
FAIL
GNUmakefile:26: recipe for target 'testacc' failed
make: *** [testacc] Error 1 These errors occur because the flatten/expand routines for the changed attributes (in func expandAppmeshVirtualRouterSpec(vSpec []interface{}) *appmesh.VirtualRouterSpec {
spec := &appmesh.VirtualRouterSpec{}
if len(vSpec) == 0 || vSpec[0] == nil {
// Empty Spec is allowed.
return spec
}
mSpec := vSpec[0].(map[string]interface{})
if vListener, ok := mSpec["listener"].([]interface{}); ok && len(vListener) > 0 && vListener[0] != nil {
listener := &appmesh.VirtualRouterListener{}
mListener := vListener[0].(map[string]interface{})
if vPortMapping, ok := mListener["port_mapping"].([]interface{}); ok && len(vPortMapping) > 0 && vPortMapping[0] != nil {
mPortMapping := vPortMapping[0].(map[string]interface{})
listener.PortMapping = &appmesh.PortMapping{}
if vPort, ok := mPortMapping["port"].(int); ok && vPort > 0 {
listener.PortMapping.Port = aws.Int64(int64(vPort))
}
if vProtocol, ok := mPortMapping["protocol"].(string); ok && vProtocol != "" {
listener.PortMapping.Protocol = aws.String(vProtocol)
}
}
spec.Listeners = []*appmesh.VirtualRouterListener{listener}
}
return spec
}
func flattenAppmeshVirtualRouterSpec(spec *appmesh.VirtualRouterSpec) []interface{} {
if spec == nil {
return []interface{}{}
}
mSpec := map[string]interface{}{}
if spec.Listeners != nil && len(spec.Listeners) > 0 {
listener := spec.Listeners[0]
mListener := map[string]interface{}{}
if listener.PortMapping != nil {
mPortMapping := map[string]interface{}{
"port": int(aws.Int64Value(listener.PortMapping.Port)),
"protocol": aws.StringValue(listener.PortMapping.Protocol),
}
mListener["port_mapping"] = []interface{}{mPortMapping}
}
mSpec["listener"] = []interface{}{mListener}
}
return []interface{}{mSpec}
} and re-run, I get: $ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSAppmesh/VirtualRouter/'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSAppmesh/VirtualRouter/ -timeout 120m
=== RUN TestAccAWSAppmesh
=== RUN TestAccAWSAppmesh/VirtualRouter
=== RUN TestAccAWSAppmesh/VirtualRouter/basic
=== RUN TestAccAWSAppmesh/VirtualRouter/tags
--- FAIL: TestAccAWSAppmesh (81.55s)
--- FAIL: TestAccAWSAppmesh/VirtualRouter (81.55s)
--- FAIL: TestAccAWSAppmesh/VirtualRouter/basic (17.28s)
testing.go:683: Step 0 error: Check failed: Check 6/11 error: aws_appmesh_virtual_router.test: Attribute 'spec.0.listener.2279702354.port_mapping.#' not found
--- PASS: TestAccAWSAppmesh/VirtualRouter/tags (64.26s)
FAIL
FAIL github.com/terraform-providers/terraform-provider-aws/aws 81.595s
FAIL
GNUmakefile:26: recipe for target 'testacc' failed
make: *** [testacc] Error 1 and now the tests should pass if the attribute value is tweaked ( |
As I remember, I had these attributes as |
thanks @ewbankkit for running the tests and reviewing! will update as needed |
updated @ewbankkit, with acceptance tests passing |
Verified acceptance tests: $ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSAppmesh'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSAppmesh -timeout 120m
=== RUN TestAccAWSAppmesh
=== RUN TestAccAWSAppmesh/Mesh
=== RUN TestAccAWSAppmesh/Mesh/egressFilter
=== RUN TestAccAWSAppmesh/Mesh/tags
=== RUN TestAccAWSAppmesh/Mesh/basic
=== RUN TestAccAWSAppmesh/Route
=== RUN TestAccAWSAppmesh/Route/tags
=== RUN TestAccAWSAppmesh/Route/httpHeader
=== RUN TestAccAWSAppmesh/Route/httpRoute
=== RUN TestAccAWSAppmesh/Route/tcpRoute
=== RUN TestAccAWSAppmesh/Route/routePriority
=== RUN TestAccAWSAppmesh/VirtualNode
=== RUN TestAccAWSAppmesh/VirtualNode/basic
=== RUN TestAccAWSAppmesh/VirtualNode/cloudMapServiceDiscovery
=== RUN TestAccAWSAppmesh/VirtualNode/listenerHealthChecks
=== RUN TestAccAWSAppmesh/VirtualNode/logging
=== RUN TestAccAWSAppmesh/VirtualNode/tags
=== RUN TestAccAWSAppmesh/VirtualRouter
=== RUN TestAccAWSAppmesh/VirtualRouter/basic
=== RUN TestAccAWSAppmesh/VirtualRouter/tags
=== RUN TestAccAWSAppmesh/VirtualService
=== RUN TestAccAWSAppmesh/VirtualService/virtualNode
=== RUN TestAccAWSAppmesh/VirtualService/virtualRouter
=== RUN TestAccAWSAppmesh/VirtualService/tags
--- PASS: TestAccAWSAppmesh (989.12s)
--- PASS: TestAccAWSAppmesh/Mesh (132.08s)
--- PASS: TestAccAWSAppmesh/Mesh/egressFilter (51.55s)
--- PASS: TestAccAWSAppmesh/Mesh/tags (56.48s)
--- PASS: TestAccAWSAppmesh/Mesh/basic (24.06s)
--- PASS: TestAccAWSAppmesh/Route (278.10s)
--- PASS: TestAccAWSAppmesh/Route/tags (72.96s)
--- PASS: TestAccAWSAppmesh/Route/httpHeader (51.70s)
--- PASS: TestAccAWSAppmesh/Route/httpRoute (51.96s)
--- PASS: TestAccAWSAppmesh/Route/tcpRoute (49.51s)
--- PASS: TestAccAWSAppmesh/Route/routePriority (51.96s)
--- PASS: TestAccAWSAppmesh/VirtualNode (303.57s)
--- PASS: TestAccAWSAppmesh/VirtualNode/basic (28.52s)
--- PASS: TestAccAWSAppmesh/VirtualNode/cloudMapServiceDiscovery (118.19s)
--- PASS: TestAccAWSAppmesh/VirtualNode/listenerHealthChecks (46.55s)
--- PASS: TestAccAWSAppmesh/VirtualNode/logging (45.45s)
--- PASS: TestAccAWSAppmesh/VirtualNode/tags (64.85s)
--- PASS: TestAccAWSAppmesh/VirtualRouter (108.57s)
--- PASS: TestAccAWSAppmesh/VirtualRouter/basic (45.43s)
--- PASS: TestAccAWSAppmesh/VirtualRouter/tags (63.14s)
--- PASS: TestAccAWSAppmesh/VirtualService (166.80s)
--- PASS: TestAccAWSAppmesh/VirtualService/virtualNode (50.30s)
--- PASS: TestAccAWSAppmesh/VirtualService/virtualRouter (46.98s)
--- PASS: TestAccAWSAppmesh/VirtualService/tags (69.50s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 989.185s |
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.
Confirming it looks good to me too. 😄 Thank you Kit for all your help.
Output from acceptance testing:
--- PASS: TestAccAWSAppmesh (337.70s)
--- PASS: TestAccAWSAppmesh/VirtualService (44.60s)
--- PASS: TestAccAWSAppmesh/VirtualService/virtualNode (13.99s)
--- PASS: TestAccAWSAppmesh/VirtualService/virtualRouter (12.48s)
--- PASS: TestAccAWSAppmesh/VirtualService/tags (18.14s)
--- PASS: TestAccAWSAppmesh/Mesh (40.53s)
--- PASS: TestAccAWSAppmesh/Mesh/tags (17.30s)
--- PASS: TestAccAWSAppmesh/Mesh/basic (7.61s)
--- PASS: TestAccAWSAppmesh/Mesh/egressFilter (15.62s)
--- PASS: TestAccAWSAppmesh/Route (71.78s)
--- PASS: TestAccAWSAppmesh/Route/httpHeader (13.04s)
--- PASS: TestAccAWSAppmesh/Route/httpRoute (13.44s)
--- PASS: TestAccAWSAppmesh/Route/tcpRoute (13.25s)
--- PASS: TestAccAWSAppmesh/Route/routePriority (13.46s)
--- PASS: TestAccAWSAppmesh/Route/tags (18.59s)
--- PASS: TestAccAWSAppmesh/VirtualNode (150.62s)
--- PASS: TestAccAWSAppmesh/VirtualNode/basic (8.05s)
--- PASS: TestAccAWSAppmesh/VirtualNode/cloudMapServiceDiscovery (98.88s)
--- PASS: TestAccAWSAppmesh/VirtualNode/listenerHealthChecks (12.98s)
--- PASS: TestAccAWSAppmesh/VirtualNode/logging (13.02s)
--- PASS: TestAccAWSAppmesh/VirtualNode/tags (17.70s)
--- PASS: TestAccAWSAppmesh/VirtualRouter (30.17s)
--- PASS: TestAccAWSAppmesh/VirtualRouter/basic (12.34s)
--- PASS: TestAccAWSAppmesh/VirtualRouter/tags (17.83s)
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! |
Community Note
Relates #9956
Release note for CHANGELOG:
Output from acceptance testing: