Skip to content
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

Fix test TestAccIotHubDPS_linkedHubs #18153

Merged
merged 2 commits into from
Sep 2, 2022

Conversation

myc2h6o
Copy link
Contributor

@myc2h6o myc2h6o commented Aug 29, 2022

connection_string is not referencing existing IoT Hubs, causing error "Unable to find the IoThub ...", fixing it by using existing reference.

@myc2h6o
Copy link
Contributor Author

myc2h6o commented Aug 29, 2022

Test result
image

Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test failure, perhapes we need to poll/wait on creation?

------- Stdout: -------
=== RUN   TestAccIotHubDPS_linkedHubs
=== PAUSE TestAccIotHubDPS_linkedHubs
=== CONT  TestAccIotHubDPS_linkedHubs
    testcase.go:110: Step 1/4 error: Error running apply: exit status 1
        
        Error: creating/updating IoT Device Provisioning Service Iot Hub Dps: (Provisioning Service Name "acctestIoTDPS-220829185508492455" / Resource Group "acctestRG-220829185508492455"): iothub.IotDpsResourceClient#CreateOrUpdate: Failure sending request: StatusCode=404 -- Original Error: Code="Failed" Message="The async operation failed." InnerError={"unmarshalError":"json: cannot unmarshal number into Go struct field serviceErrorInternal.code of type string"} AdditionalInfo=[{"code":404002,"httpStatusCode":"NotFound","message":"Unable to find the IoThub `acctestIoTHub2-220829185508492455.azure-devices.net`. Check if the hub exists and the connection information is correct. If you contact a support representative please include this correlation identifier: ef2c3d4b-cd68-4a92-a2a8-4142e277a8f3, timestamp: 2022-08-29 18:58:55Z, errorcode: IH404002."}]
        
          with azurerm_iothub_dps.test,
          on terraform_plugin_test.tf line 61, in resource "azurerm_iothub_dps" "test":
          61: resource "azurerm_iothub_dps" "test" {
        
--- FAIL: TestAccIotHubDPS_linkedHubs (338.94s)
FAIL

@myc2h6o myc2h6o force-pushed the dps_linkedhubs_test_fix branch from c179e49 to ee80b41 Compare August 30, 2022 06:02
@myc2h6o
Copy link
Contributor Author

myc2h6o commented Sep 2, 2022

@katbyte thanks for reviewing the change! I've done some test locally and this issue does happen sometimes. I tried looking at the resource properties, and they are all same during the provisioning failure time whether the issue happens or not, and a retry can create the IotHub DPS correctly. Fortunately, the error code is 404 for this specific issue that linked hubs are not found, I'll add a poll and retry to check the 404 error.

Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎩

@katbyte katbyte merged commit 54c8e67 into hashicorp:main Sep 2, 2022
@github-actions github-actions bot added this to the v3.21.0 milestone Sep 2, 2022
@myc2h6o myc2h6o deleted the dps_linkedhubs_test_fix branch September 2, 2022 02:33
@github-actions
Copy link

github-actions bot commented Sep 2, 2022

This functionality has been released in v3.21.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!

@github-actions
Copy link

github-actions bot commented Oct 5, 2022

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants