Documentation ¶
Overview ¶
Package fake provides a fake version of the GCE struct to return canned responses in unit tests.
Index ¶
- type GetAddressByIPArguments
- type GetDiskArguments
- type GetForwardingRuleArguments
- type TestGCE
- func (g *TestGCE) GetAddress(project, location, name string) (*compute.Address, error)
- func (g *TestGCE) GetAddressByIP(project, region, address string) (*compute.Address, error)
- func (g *TestGCE) GetDisk(project, zone, disk string) (*compute.Disk, error)
- func (g *TestGCE) GetFilestoreByIP(project, location, ip string) (*file.ListInstancesResponse, error)
- func (g *TestGCE) GetForwardingRule(project, location, name string) (*compute.ForwardingRule, error)
- func (g *TestGCE) GetInstance(project, zone, instance string) (*compute.Instance, error)
- func (g *TestGCE) GetInstanceByIP(project, ip string) (*compute.Instance, error)
- func (g *TestGCE) GetInstanceGroup(project, zone, name string) (*compute.InstanceGroup, error)
- func (g *TestGCE) GetRegionalBackendService(project, region, name string) (*compute.BackendService, error)
- func (g *TestGCE) GetSecret(ctx context.Context, projectID, secretName string) (string, error)
- func (g *TestGCE) GetURIForIP(project, ip string) (string, error)
- func (g *TestGCE) ListInstanceGroupInstances(project, zone, name string) (*compute.InstanceGroupsListInstances, error)
- func (g *TestGCE) ListZoneOperations(project, zone, filter string, maxResults int64) (*compute.OperationList, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GetAddressByIPArguments ¶
type GetAddressByIPArguments struct{ Project, Region, Address string }
GetAddressByIPArguments is a struct to match arguments passed in to the GetAddressbyIP function for validation.
type GetDiskArguments ¶
type GetDiskArguments struct{ Project, Zone, DiskName string }
GetDiskArguments is a struct to match arguments passed in to the GetDisk function for validation.
type GetForwardingRuleArguments ¶
type GetForwardingRuleArguments struct{ Project, Location, Name string }
GetForwardingRuleArguments is a struct to match arguments passed in to the GetForwardingRule function for validation.
type TestGCE ¶
type TestGCE struct { T *testing.T GetInstanceResp []*compute.Instance GetInstanceErr []error GetInstanceCallCount int GetInstanceByIPResp []*compute.Instance GetInstanceByIPErr []error GetInstanceByIPCallCount int GetDiskResp []*compute.Disk GetDiskArgs []*GetDiskArguments GetDiskErr []error GetDiskCallCount int ListZoneOperationsResp []*compute.OperationList ListZoneOperationsErr []error ListZoneOperationsCallCount int GetAddressResp []*compute.Address GetAddressErr []error GetAddressCallCount int GetAddressByIPResp []*compute.Address GetAddressByIPArgs []*GetAddressByIPArguments GetAddressByIPErr []error GetAddressByIPCallCount int GetRegionalBackendServiceResp []*compute.BackendService GetRegionalBackendServiceErr []error GetRegionalBackendServiceCallCount int GetForwardingRuleResp []*compute.ForwardingRule GetForwardingRuleErr []error GetForwardingRuleArgs []*GetForwardingRuleArguments GetForwardingRulleCallCount int GetInstanceGroupResp []*compute.InstanceGroup GetInstanceGroupErr []error GetInstanceGroupCallCount int ListInstanceGroupInstancesResp []*compute.InstanceGroupsListInstances ListInstanceGroupInstancesErr []error ListInstanceGroupInstancesCallCount int GetFilestoreByIPResp []*file.ListInstancesResponse GetFilestoreByIPErr []error GetFilestoreByIPCallCount int GetURIForIPResp []string GetURIForIPErr []error GetURIForIPCallCount int GetSecretResp []string GetSecretErr []error GetSecretCallCount int }
TestGCE implements GCE interfaces. A new TestGCE instance should be used per iteration of the test.
func (*TestGCE) GetAddress ¶
GetAddress fakes a call to the compute API to retrieve a list of addresses.
func (*TestGCE) GetAddressByIP ¶
GetAddressByIP fakes a call to the compute API to retrieve a list of addresses.
func (*TestGCE) GetDisk ¶
GetDisk fakes a call to the compute API to retrieve a GCE Persistent Disk.
func (*TestGCE) GetFilestoreByIP ¶
func (g *TestGCE) GetFilestoreByIP(project, location, ip string) (*file.ListInstancesResponse, error)
GetFilestoreByIP fakes a call to the compute API to retrieve a filestore instance by its IP address.
func (*TestGCE) GetForwardingRule ¶
func (g *TestGCE) GetForwardingRule(project, location, name string) (*compute.ForwardingRule, error)
GetForwardingRule fakes a call to the compute API to retrieve a forwarding rule.
func (*TestGCE) GetInstance ¶
GetInstance fakes a call to the compute API to retrieve a GCE Instance.
func (*TestGCE) GetInstanceByIP ¶
GetInstanceByIP fakes a call to the compute API to retrieve a compute instance by its IP address.
func (*TestGCE) GetInstanceGroup ¶
func (g *TestGCE) GetInstanceGroup(project, zone, name string) (*compute.InstanceGroup, error)
GetInstanceGroup fakes a call to the compute API to retrieve an Instance Group.
func (*TestGCE) GetRegionalBackendService ¶
func (g *TestGCE) GetRegionalBackendService(project, region, name string) (*compute.BackendService, error)
GetRegionalBackendService fakes a call to the compute API to retrieve a regional backend service.
func (*TestGCE) GetURIForIP ¶
GetURIForIP fakes calls to compute APIs to locate an object URI related to the IP address provided.
func (*TestGCE) ListInstanceGroupInstances ¶
func (g *TestGCE) ListInstanceGroupInstances(project, zone, name string) (*compute.InstanceGroupsListInstances, error)
ListInstanceGroupInstances fakes a call to the compute API to retrieve a list of instances in an instance group.
func (*TestGCE) ListZoneOperations ¶
func (g *TestGCE) ListZoneOperations(project, zone, filter string, maxResults int64) (*compute.OperationList, error)
ListZoneOperations fakes a call to the compute API to retrieve a list of Operations resources.