-
Notifications
You must be signed in to change notification settings - Fork 453
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
r/virtual_machine: Split disk Diff #481
Conversation
Split virtual disk diff function into validation and normalization. Some normalization tasks should not be performed on new or unmatched virtual disks, but validation should be performed on all.
Hey @bill-rich, the problems that we talked about with the diff validation on new disks is happening because the entire diff validation is happening during the stage where we are comparing resources in state with the current state of configuration, remember. I noticed that Also, I was thinking that We should also throw in some Thanks! |
Move some tasks from general disk diff function to existing disk function as they are only necessary when dealing with disks already in state.
}, | ||
{ | ||
Config: testAccResourceVSphereVirtualMachineConfigMultiHighBusInsufficientBus(), | ||
ExpectError: regexp.MustCompile("unit_number on disk \"disk1\" too high \\(15\\) - maximum value is 14 with 1 SCSI controller\\(s\\)"), |
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.
Can this be in the first step or is there a reason why the VM needs to be created first?
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.
That one is included to make sure the diff validation is working on updates and when there is already a disk present (disk0). This same case is tested at VM creation at: https://github.com/terraform-providers/terraform-provider-vsphere/blob/8027f5e805e92851893755bffa34be1efb9cb2c0/vsphere/resource_vsphere_virtual_machine_test.go#L362
The two tests added in this commit may be a bit overkill as there isn't a specific past bug that I'm trying to check for, but trying to cover other cases where the behavior is slightly different.
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 dropped the two update tests, so its just the original TestAccResourceVSphereVirtualMachine_highDiskUnitInsufficientBus
again.
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.
Good job @bill-rich, LGTM now!
Split virtual disk diff function into validation and normalization. Some
normalization tasks should not be performed on new or unmatched virtual
disks, but validation should be performed on all.