vsphere: govmomi rest API simulator requires authentication
This commit is contained in:
		@@ -22,6 +22,7 @@ import (
 | 
				
			|||||||
	"crypto/x509"
 | 
						"crypto/x509"
 | 
				
			||||||
	"io/ioutil"
 | 
						"io/ioutil"
 | 
				
			||||||
	"log"
 | 
						"log"
 | 
				
			||||||
 | 
						"net/url"
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
	"reflect"
 | 
						"reflect"
 | 
				
			||||||
	"sort"
 | 
						"sort"
 | 
				
			||||||
@@ -40,7 +41,7 @@ import (
 | 
				
			|||||||
	"github.com/vmware/govmomi/vapi/tags"
 | 
						"github.com/vmware/govmomi/vapi/tags"
 | 
				
			||||||
	"github.com/vmware/govmomi/vim25/mo"
 | 
						"github.com/vmware/govmomi/vim25/mo"
 | 
				
			||||||
	vmwaretypes "github.com/vmware/govmomi/vim25/types"
 | 
						vmwaretypes "github.com/vmware/govmomi/vim25/types"
 | 
				
			||||||
	"k8s.io/api/core/v1"
 | 
						v1 "k8s.io/api/core/v1"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/types"
 | 
						"k8s.io/apimachinery/pkg/types"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/util/rand"
 | 
						"k8s.io/apimachinery/pkg/util/rand"
 | 
				
			||||||
	cloudprovider "k8s.io/cloud-provider"
 | 
						cloudprovider "k8s.io/cloud-provider"
 | 
				
			||||||
@@ -381,6 +382,10 @@ func TestZones(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// Tag manager instance
 | 
						// Tag manager instance
 | 
				
			||||||
	m := tags.NewManager(rest.NewClient(vsi.conn.Client))
 | 
						m := tags.NewManager(rest.NewClient(vsi.conn.Client))
 | 
				
			||||||
 | 
						user := url.UserPassword(vsi.conn.Username, vsi.conn.Password)
 | 
				
			||||||
 | 
						if err = m.Login(ctx, user); err != nil {
 | 
				
			||||||
 | 
							t.Fatal(err)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Create a region category
 | 
						// Create a region category
 | 
				
			||||||
	regionID, err := m.CreateCategory(ctx, &tags.Category{Name: vs.cfg.Labels.Region})
 | 
						regionID, err := m.CreateCategory(ctx, &tags.Category{Name: vs.cfg.Labels.Region})
 | 
				
			||||||
@@ -560,6 +565,10 @@ func TestGetZoneToHosts(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// Tag manager instance
 | 
						// Tag manager instance
 | 
				
			||||||
	m := tags.NewManager(rest.NewClient(vsi.conn.Client))
 | 
						m := tags.NewManager(rest.NewClient(vsi.conn.Client))
 | 
				
			||||||
 | 
						user := url.UserPassword(vsi.conn.Username, vsi.conn.Password)
 | 
				
			||||||
 | 
						if err = m.Login(ctx, user); err != nil {
 | 
				
			||||||
 | 
							t.Fatal(err)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Create a region category
 | 
						// Create a region category
 | 
				
			||||||
	regionCat, err := m.CreateCategory(ctx, &tags.Category{Name: vs.cfg.Labels.Region})
 | 
						regionCat, err := m.CreateCategory(ctx, &tags.Category{Name: vs.cfg.Labels.Region})
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user