-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
azurerm_api_management_api_schema - prevent plan not empty after apply for json definitions #12039
Conversation
I'd welcome any guidance on how to prepare test cases for that issue. It's not clear for me, how to test for specific value in nested structures currently. |
Looks like we have some test failures now:
|
azurerm/internal/services/apimanagement/api_management_api_schema_resource.go
Outdated
Show resolved
Hide resolved
@tombuildsstuff I reviewed Azure docs and added necessary logic |
cd107ba
to
eda4023
Compare
I see that the tests were fixed, I've rebased the changes to recent master. |
Thanks @wiktorn - looks like we have a different type of test failure now:
|
Sorry, linting fixes broke the acceptance tests and I didn't rerun the tests (my bad).
|
@katbyte And one more idea come to my mind, as in this area - there Consumption based instance is enough to test, maybe it's worth to use it? It reduces dramatically time needed to run the tests. In my recent run it took 267 seconds with Consumption tier compared to 4378 seconds with Developer tier. The only drawback is, that you need more comprehensive knowledge about specific service to know, when Consumption tier is enough and when you need to use Developer tier. Are such optimizations welcomed? |
azurerm/internal/services/apimanagement/api_management_api_schema_resource.go
Outdated
Show resolved
Hide resolved
@wiktorn - i'm not very familiar with the api management service, what is the difference between the two tiers and would it compromise the test integrity? if it is still testing the exact same thing optimizations are always welcome 🙂 (looks like i had this in an open tab and forgotten to hit comment! 😅 ) |
So the difference is, that
And if I remember correctly, the IP address of the instance is differently returned. And I'm not sure, if you can set your own CA certificates. The plan then would be, to use the |
* add tests, that verify contents of the schema * add test for Swagger/OpenAPI based schemas * add fetching schema definition either from `value` or `definitions` based on content type * add Json supress diff function, that allows ignoring insignificant changes, e.g. in white spaces * use Json supress diff function when the content type is json based
Retry client.Get in resourceApiManagementApiSchemaCreateUpdate in case that schema was not yet created.
For unknown content-types use the same logic as for application/vnd.ms-azure-apim.xsd+xml and others. In case new content types will appear, there is some chance, that this will be desired behaviour. If future prove us wrong, then it will be easy to identify place requiring change due to WARN logging.
oh 100% if |
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 @wiktorn - LGTM and provided tests pass will merge shortly 🚀
This functionality has been released in v2.64.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Add support for Swagger based schema definitions.
Additional changes:
resourceApiManagementApiSchemaCreateUpdate
until resource is created to avoid race with following GET, which results in inconsistent state (resource created but not present in state)Fixes #12002.
Test results: