vmware / go-vcloud-director

Golang SDK for VMware Cloud Director
Other
80 stars 76 forks source link

Bump default API version to V36.0 (VCD 10.3+) #500

Closed Didainius closed 2 years ago

Didainius commented 2 years ago

VCD 10.2 is going EOL for 2022-10-15 and the next release is going to be later than that therefore bumping default API version to V36.0. (for those with explicit needs there is an option to override the default version by using GOVCD_API_VERSION environment variable).

Additionally, this PR removes conditional checks that were being used for versions < 36.0

It should also fix all currently known flaky tests, which should make test run clean:

From

<VersionInfo deprecated="true">
    <Version>35.0</Version>
    <LoginUrl>https://HOST/api/sessions</LoginUrl>
</VersionInfo>

To

<VersionInfo deprecated="false">
  <Version>36.0</Version>
  <LoginUrl>https://HOST/cloudapi/1.0.0/sessions</LoginUrl>
  <ProviderLoginUrl>https://HOST/cloudapi/1.0.0/sessions/provider</ProviderLoginUrl>
</VersionInfo>

Test TestClient_getloginurl started failing immediately because it relied on a matching path which has changed.

FAIL: vm_test.go:610: TestVCD.Test_VMToggleHardwareVirtualization


* VCD introduced new state for VM `PARTIALLY_POWERED_OFF` in 10.3. `Test_VMPowerOnPowerOff` started failing.

START: vm_test.go:666: TestVCD.Test_VMPowerOnPowerOff vm_test.go:710: check.Assert(vmStatus, Equals, "POWERED_OFF") ... obtained string = "PARTIALLY_POWERED_OFF" ... expected string = "POWERED_OFF"

FAIL: vm_test.go:666: TestVCD.Test_VMPowerOnPowerOff


* Fix `Test_RemoveAllNetworks` by ensureing vApp is powered off before removing all networks.

START: vapp_test.go:611: TestVCD.Test_RemoveAllNetworks vapp_test.go:670: check.Assert(err, IsNil) ... value *errors.errorString = &errors.errorString{s:"task did not complete successfully: [409:INVALID_STATE] - [ 35010cb4-48ac-4fe2 -a4c2-f6af984e243c ] The requested operation could not be executed on vApp \"f54723e7-638f-4255-8ca0-0255c9c93e29\". Stop the vApp and try again."} ("task did not complete successfully: [409:INVALID_STATE] - [ 35010cb4-48ac-4fe2-a4c2-f6af984e243c ] The requested oper ation could not be executed on vApp \"f54723e7-638f-4255-8ca0-0255c9c93e29\". Stop the vApp and try again.")

FAIL: vapp_test.go:611: TestVCD.Test_RemoveAllNetworks

Didainius commented 2 years ago

My only request is to see what the whole test suite returns after this change, hopefully, nothing complains :)

Yeah. I am now fixing things up, but tests will take their time before this lands.