Fix the dependency issue (#231)
This commit is contained in:
15
vendor/github.com/vmware/govmomi/vim25/mo/fixtures/cluster_host_property.xml
generated
vendored
15
vendor/github.com/vmware/govmomi/vim25/mo/fixtures/cluster_host_property.xml
generated
vendored
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<RetrievePropertiesResponse xmlns="urn:vim25" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<returnval>
|
||||
<obj type="ClusterComputeResource">domain-c7</obj>
|
||||
<propSet>
|
||||
<name>host</name>
|
||||
<val xsi:type="ArrayOfManagedObjectReference">
|
||||
<ManagedObjectReference type="HostSystem" xsi:type="ManagedObjectReference">host-14</ManagedObjectReference>
|
||||
<ManagedObjectReference type="HostSystem" xsi:type="ManagedObjectReference">host-17</ManagedObjectReference>
|
||||
<ManagedObjectReference type="HostSystem" xsi:type="ManagedObjectReference">host-19</ManagedObjectReference>
|
||||
<ManagedObjectReference type="HostSystem" xsi:type="ManagedObjectReference">host-52</ManagedObjectReference>
|
||||
</val>
|
||||
</propSet>
|
||||
</returnval>
|
||||
</RetrievePropertiesResponse>
|
||||
17
vendor/github.com/vmware/govmomi/vim25/mo/fixtures/hostsystem_list_name_property.xml
generated
vendored
17
vendor/github.com/vmware/govmomi/vim25/mo/fixtures/hostsystem_list_name_property.xml
generated
vendored
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<RetrievePropertiesResponse xmlns="urn:vim25" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<returnval>
|
||||
<obj type="HostSystem">host-10</obj>
|
||||
<propSet>
|
||||
<name>name</name>
|
||||
<val xsi:type="xsd:string">host-01.example.com</val>
|
||||
</propSet>
|
||||
</returnval>
|
||||
<returnval>
|
||||
<obj type="HostSystem">host-30</obj>
|
||||
<propSet>
|
||||
<name>name</name>
|
||||
<val xsi:type="xsd:string">host-02.example.com</val>
|
||||
</propSet>
|
||||
</returnval>
|
||||
</RetrievePropertiesResponse>
|
||||
14
vendor/github.com/vmware/govmomi/vim25/mo/fixtures/nested_property.xml
generated
vendored
14
vendor/github.com/vmware/govmomi/vim25/mo/fixtures/nested_property.xml
generated
vendored
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<RetrievePropertiesResponse xmlns="urn:vim25" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<returnval>
|
||||
<obj type="VirtualMachine">vm-411</obj>
|
||||
<propSet>
|
||||
<name>config.name</name>
|
||||
<val xsi:type="xsd:string">kubernetes-master</val>
|
||||
</propSet>
|
||||
<propSet>
|
||||
<name>config.uuid</name>
|
||||
<val xsi:type="xsd:string">422ec880-ab06-06b4-23f3-beb7a052a4c9</val>
|
||||
</propSet>
|
||||
</returnval>
|
||||
</RetrievePropertiesResponse>
|
||||
42
vendor/github.com/vmware/govmomi/vim25/mo/fixtures/not_authenticated_fault.xml
generated
vendored
42
vendor/github.com/vmware/govmomi/vim25/mo/fixtures/not_authenticated_fault.xml
generated
vendored
@@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<RetrievePropertiesResponse xmlns="urn:vim25" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<returnval>
|
||||
<obj type="SessionManager">SessionManager</obj>
|
||||
<propSet>
|
||||
<name>defaultLocale</name>
|
||||
<val xsi:type="xsd:string">en</val>
|
||||
</propSet>
|
||||
<propSet>
|
||||
<name>messageLocaleList</name>
|
||||
<val xsi:type="ArrayOfString">
|
||||
<string xsi:type="xsd:string">ja</string>
|
||||
<string xsi:type="xsd:string">zh_CN</string>
|
||||
<string xsi:type="xsd:string">en</string>
|
||||
<string xsi:type="xsd:string">de</string>
|
||||
<string xsi:type="xsd:string">zh_TW</string>
|
||||
<string xsi:type="xsd:string">ko</string>
|
||||
<string xsi:type="xsd:string">fr</string>
|
||||
</val>
|
||||
</propSet>
|
||||
<missingSet>
|
||||
<path>message</path>
|
||||
<fault>
|
||||
<fault xsi:type="NotAuthenticated">
|
||||
<object type="Folder">group-d1</object>
|
||||
<privilegeId>System.View</privilegeId>
|
||||
</fault>
|
||||
<localizedMessage/>
|
||||
</fault>
|
||||
</missingSet>
|
||||
<missingSet>
|
||||
<path>sessionList</path>
|
||||
<fault>
|
||||
<fault xsi:type="NotAuthenticated">
|
||||
<object type="Folder">group-d1</object>
|
||||
<privilegeId>Sessions.TerminateSession</privilegeId>
|
||||
</fault>
|
||||
<localizedMessage/>
|
||||
</fault>
|
||||
</missingSet>
|
||||
</returnval>
|
||||
</RetrievePropertiesResponse>
|
||||
15
vendor/github.com/vmware/govmomi/vim25/mo/fixtures/pointer_property.xml
generated
vendored
15
vendor/github.com/vmware/govmomi/vim25/mo/fixtures/pointer_property.xml
generated
vendored
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<RetrievePropertiesResponse xmlns="urn:vim25" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<returnval>
|
||||
<obj type="VirtualMachine">vm-411</obj>
|
||||
<propSet>
|
||||
<name>config.bootOptions</name>
|
||||
<val xsi:type="VirtualMachineBootOptions">
|
||||
<bootDelay>0</bootDelay>
|
||||
<enterBIOSSetup>false</enterBIOSSetup>
|
||||
<bootRetryEnabled>false</bootRetryEnabled>
|
||||
<bootRetryDelay>10000</bootRetryDelay>
|
||||
</val>
|
||||
</propSet>
|
||||
</returnval>
|
||||
</RetrievePropertiesResponse>
|
||||
144
vendor/github.com/vmware/govmomi/vim25/mo/retrieve_test.go
generated
vendored
144
vendor/github.com/vmware/govmomi/vim25/mo/retrieve_test.go
generated
vendored
@@ -1,144 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2014-2015 VMware, Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package mo
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/vmware/govmomi/vim25/soap"
|
||||
"github.com/vmware/govmomi/vim25/types"
|
||||
"github.com/vmware/govmomi/vim25/xml"
|
||||
)
|
||||
|
||||
func load(name string) *types.RetrievePropertiesResponse {
|
||||
f, err := os.Open(name)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
defer f.Close()
|
||||
|
||||
var b types.RetrievePropertiesResponse
|
||||
|
||||
dec := xml.NewDecoder(f)
|
||||
dec.TypeFunc = types.TypeFunc()
|
||||
if err := dec.Decode(&b); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return &b
|
||||
}
|
||||
|
||||
func TestNotAuthenticatedFault(t *testing.T) {
|
||||
var s SessionManager
|
||||
|
||||
err := LoadRetrievePropertiesResponse(load("fixtures/not_authenticated_fault.xml"), &s)
|
||||
if !soap.IsVimFault(err) {
|
||||
t.Errorf("Expected IsVimFault")
|
||||
}
|
||||
|
||||
fault := soap.ToVimFault(err).(*types.NotAuthenticated)
|
||||
if fault.PrivilegeId != "System.View" {
|
||||
t.Errorf("Expected first fault to be returned")
|
||||
}
|
||||
}
|
||||
|
||||
func TestNestedProperty(t *testing.T) {
|
||||
var vm VirtualMachine
|
||||
|
||||
err := LoadRetrievePropertiesResponse(load("fixtures/nested_property.xml"), &vm)
|
||||
if err != nil {
|
||||
t.Fatalf("Expected no error, got: %s", err)
|
||||
}
|
||||
|
||||
self := types.ManagedObjectReference{
|
||||
Type: "VirtualMachine",
|
||||
Value: "vm-411",
|
||||
}
|
||||
|
||||
if vm.Self != self {
|
||||
t.Fatalf("Expected vm.Self to be set")
|
||||
}
|
||||
|
||||
if vm.Config == nil {
|
||||
t.Fatalf("Expected vm.Config to be set")
|
||||
}
|
||||
|
||||
if vm.Config.Name != "kubernetes-master" {
|
||||
t.Errorf("Got: %s", vm.Config.Name)
|
||||
}
|
||||
|
||||
if vm.Config.Uuid != "422ec880-ab06-06b4-23f3-beb7a052a4c9" {
|
||||
t.Errorf("Got: %s", vm.Config.Uuid)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPointerProperty(t *testing.T) {
|
||||
var vm VirtualMachine
|
||||
|
||||
err := LoadRetrievePropertiesResponse(load("fixtures/pointer_property.xml"), &vm)
|
||||
if err != nil {
|
||||
t.Fatalf("Expected no error, got: %s", err)
|
||||
}
|
||||
|
||||
if vm.Config == nil {
|
||||
t.Fatalf("Expected vm.Config to be set")
|
||||
}
|
||||
|
||||
if vm.Config.BootOptions == nil {
|
||||
t.Fatalf("Expected vm.Config.BootOptions to be set")
|
||||
}
|
||||
}
|
||||
|
||||
func TestEmbeddedTypeProperty(t *testing.T) {
|
||||
// Test that we avoid in this case:
|
||||
// panic: reflect.Set: value of type mo.ClusterComputeResource is not assignable to type mo.ComputeResource
|
||||
var cr ComputeResource
|
||||
|
||||
err := LoadRetrievePropertiesResponse(load("fixtures/cluster_host_property.xml"), &cr)
|
||||
if err != nil {
|
||||
t.Fatalf("Expected no error, got: %s", err)
|
||||
}
|
||||
|
||||
if len(cr.Host) != 4 {
|
||||
t.Fatalf("Expected cr.Host to be set")
|
||||
}
|
||||
}
|
||||
|
||||
func TestEmbeddedTypePropertySlice(t *testing.T) {
|
||||
var me []ManagedEntity
|
||||
|
||||
err := LoadRetrievePropertiesResponse(load("fixtures/hostsystem_list_name_property.xml"), &me)
|
||||
if err != nil {
|
||||
t.Fatalf("Expected no error, got: %s", err)
|
||||
}
|
||||
|
||||
if len(me) != 2 {
|
||||
t.Fatalf("Expected 2 elements")
|
||||
}
|
||||
|
||||
for _, m := range me {
|
||||
if m.Name == "" {
|
||||
t.Fatal("Expected Name field to be set")
|
||||
}
|
||||
}
|
||||
|
||||
if me[0].Name == me[1].Name {
|
||||
t.Fatal("Name fields should not be the same")
|
||||
}
|
||||
}
|
||||
37
vendor/github.com/vmware/govmomi/vim25/mo/type_info_test.go
generated
vendored
37
vendor/github.com/vmware/govmomi/vim25/mo/type_info_test.go
generated
vendored
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2014 VMware, Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package mo
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestLoadAll(*testing.T) {
|
||||
for _, typ := range t {
|
||||
newTypeInfo(typ)
|
||||
}
|
||||
}
|
||||
|
||||
// The virtual machine managed object has about 500 nested properties.
|
||||
// It's likely to be indicative of the function's performance in general.
|
||||
func BenchmarkLoadVirtualMachine(b *testing.B) {
|
||||
vmtyp := reflect.TypeOf((*VirtualMachine)(nil)).Elem()
|
||||
for i := 0; i < b.N; i++ {
|
||||
newTypeInfo(vmtyp)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user