-
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
Compute
- Fix failed Acc Test
#27465
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.
Hi @ms-zhenhua - Thanks for this PR. The tests touched here needed a little deeper investigation, so can you take a look at the comments below?
Thanks
@@ -453,7 +453,7 @@ func TestAccVirtualMachine_ChangeAvailabilitySet(t *testing.T) { | |||
data := acceptance.BuildTestData(t, "azurerm_virtual_machine", "test") | |||
r := VirtualMachineResource{} | |||
|
|||
data.ResourceTest(t, r, []acceptance.TestStep{ | |||
data.ResourceTestIgnoreRecreate(t, r, []acceptance.TestStep{ |
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 test doesn't actually test anything in the resource, rather it is testing Terraform's ForceNew
action, so I think the test should actually be removed as it is providing no value to the resource.
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.
Removed
@@ -185,7 +185,7 @@ func TestAccVirtualMachineScaleSet_verify_key_data_changed(t *testing.T) { | |||
data := acceptance.BuildTestData(t, "azurerm_virtual_machine_scale_set", "test") | |||
r := VirtualMachineScaleSetResource{} | |||
|
|||
data.ResourceTest(t, r, []acceptance.TestStep{ | |||
data.ResourceTestIgnoreRecreate(t, r, []acceptance.TestStep{ |
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 test is also invalid. The schema is a set (since it has a max items of 1, it seems it should should be a list). Given this is a deprecated resource, and not receiving any fixes, I believe this test is safe to remove rather than paper over the problem.
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.
Removed
match { | ||
status_code = ["200-399"] | ||
} |
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.
The test this relates to sometimes passes, do we know why this optional property is sometimes returned and sometimes not from the API?
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.
I think this default value was recently added by Azure Team because other azurerm_application_gateway.probe
related testcases like TestAccApplicationGateway_probesWithPort
also failed due to this reason. However, this default value is consistent with the document .
@@ -282,7 +282,7 @@ func TestAccVirtualMachine_deleteVHDOptIn(t *testing.T) { | |||
func TestAccVirtualMachine_ChangeComputerName(t *testing.T) { | |||
data := acceptance.BuildTestData(t, "azurerm_virtual_machine", "test") | |||
r := VirtualMachineResource{} | |||
data.ResourceTest(t, r, []acceptance.TestStep{ | |||
data.ResourceTestIgnoreRecreate(t, r, []acceptance.TestStep{ |
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.
As above, this test just cycles a ForceNew
property, and doesn't provide any resource value since Terraform will always just delete and recreate it. We should remove the test.
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.
Removed
@@ -322,7 +322,7 @@ func TestAccVirtualMachine_changeOSDiskVhdUri(t *testing.T) { | |||
data := acceptance.BuildTestData(t, "azurerm_virtual_machine", "test") | |||
r := VirtualMachineResource{} | |||
|
|||
data.ResourceTest(t, r, []acceptance.TestStep{ | |||
data.ResourceTestIgnoreRecreate(t, r, []acceptance.TestStep{ |
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.
Again here. This test doesn't provide any value to the resource functionality as it just triggers a ForceNew
on the schema, which will always have the same outcome. This test should just be removed.
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.
Removed
Hi @jackofallops, thank you for your review. I have updated the PR. Could you please have another review? |
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.
LGTM 🐙
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. |
Community Note
Description
Fix failed acc tests of VM and VMSS.
PR Checklist
For example: “
resource_name_here
- description of change e.g. adding propertynew_property_name_here
”Changes to existing Resource / Data Source
Testing
Change Log
Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.
Compute
- Fix failed Acc TestThis is a (please select all that apply):
Related Issue(s)
Fixes #0000
Note
If this PR changes meaningfully during the course of review please update the title and description as required.