azurerm_api_management_logger: fixes TestAccApiManagementLogger_update#31537
azurerm_api_management_logger: fixes TestAccApiManagementLogger_update#31537
Conversation
| Config: r.basicEventHub(data), | ||
| Check: acceptance.ComposeTestCheckFunc( | ||
| check.That(data.ResourceName).ExistsInAzure(r), | ||
| check.That(data.ResourceName).Key("buffered").HasValue("true"), | ||
| check.That(data.ResourceName).Key("description").HasValue(""), | ||
| check.That(data.ResourceName).Key("eventhub.#").HasValue("0"), | ||
| check.That(data.ResourceName).Key("application_insights.#").HasValue("1"), | ||
| check.That(data.ResourceName).Key("application_insights.0.instrumentation_key").Exists(), | ||
| check.That(data.ResourceName).Key("eventhub.#").HasValue("1"), | ||
| check.That(data.ResourceName).Key("eventhub.0.name").Exists(), | ||
| check.That(data.ResourceName).Key("eventhub.0.connection_string").Exists(), |
There was a problem hiding this comment.
In application_insights, resource_id is also ForceNew and to test that behaviour I changed order of test configs.
basicApplicationInsights config does not have resource_id field but complete config has resource_id,
hence moved eventhub config -> basicApplicationInsights -> complete to test resource_id change should cause recreation.
catriona-m
left a comment
There was a problem hiding this comment.
Hi @rigalGit thanks for taking a look at this. I think we need to handle this test a bit differently. Since this test is meant to cover updating an existing resource, the fix should be to change or add config that only updates non ForceNew properties, rather than changing the test to expect a ForceNew update.
For a bit of context, these tests weren’t previously checking whether a ForceNew property was being updated. Now that that check is in place, a lot of tests are failing even though they were actually passing incorrectly before. Because of that, the config needs to be updated to reflect a valid update.
thanks @catriona-m , I've created a new config to test update changes. |
catriona-m
left a comment
There was a problem hiding this comment.
Thanks for fixing this up @rigalGit - I just left one comment inline, but otherwise this looks good. Thanks!
| }, | ||
| { | ||
| Config: r.complete(data, "Logger from Terraform test", "false"), | ||
| Config: r.applicationInsightsUpdate(data, "Logger from Terraform test", "false"), |
There was a problem hiding this comment.
since we are only using this config in one place, could we set the description and buffered values directly in the config rather than passing them in here?
There was a problem hiding this comment.
thanks, addressed it.
Initially I thought of having test steps something like this
basicApplicationInsights (unset desc) -> applicationInsightsUpdate (desc_1,buffered)-> applicationInsightsUpdate (desc_2,buffered) -> basicApplicationInsights ( unset desc , buffered)
but current changes ( 1 less step) seems to be sufficient to check functionality.
b0c78c0 to
d4385c1
Compare
|
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. |
…e because of ForceNew attributes
Community Note
Description
TestAccApiManagementLogger_update was failing with replace action error because application_insights, eventhub are mutually exclusive and ForceNew attributes. In application_insights resource_id is also ForceNew and to test that behaviour I changed order of testcase also.
PR Checklist
For example: “
resource_name_here- description of change e.g. adding propertynew_property_name_here”Changes to existing Resource / Data Source
Testing
Local testing
Change Log
Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.
azurerm_resource- support for thething1property [GH-00000]This is a (please select all that apply):
Related Issue(s)
Fixes #0000
AI Assistance Disclosure
Rollback Plan
If a change needs to be reverted, we will publish an updated version of the provider.
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.
Note
If this PR changes meaningfully during the course of review please update the title and description as required.