Documentation
¶
Overview ¶
Package fakes contains fake implementations to be used in unit tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GCE ¶
type GCE struct { // Images represents the images present in the project. Images *compute.ImageList // Deprecated represents the set of deprecated images in the project. Deprecated map[string]*compute.DeprecationStatus // Operations is the sequence of operations that the fake GCE server should return. Operations []*compute.Operation Instances []*compute.Instance // contains filtered or unexported fields }
GCE is a fake GCE implementation. It is intended to be constructed with NewGCEServer.
The GCE struct represents the state of the fake GCE instance. Fields on this struct can be modified to influence the return values of GCE API calls.
GCE should not be considered concurrency-safe. Do not use this struct in a concurrent way.
func GCEForTest ¶
GCEForTest encapsulates boilerplate needed for many test cases.
func NewGCEServer ¶
NewGCEServer constructs a fake GCE implementation for a given GCE project.
type GCS ¶
type GCS struct { // Objects represents the collection of objects that exist in the fake GCS server. // Keys are strings of the form "/<bucket>/<object path>". Values are data that belong // in each object. Objects map[string][]byte // Client is the client to use when accessing the fake GCS server. Client *storage.Client // Server is the fake GCS server. It uses state from this struct for serving requests. Server *httptest.Server Delay time.Duration LogMissing bool }
GCS contains data and functionality for a fake GCS server. It is intended to be constructed with NewGCSServer.
The GCS struct represents the state of the fake GCS instance. Fields on this struct can be modified to influence the return values of GCS API calls.
The fake GCS server implements a small part of the API discussed here: https://godoc.org/cloud.google.com/go/storage. Only the parts that we need for testing are implemented here. Documentation for the GCS JSON API is here: https://cloud.google.com/storage/docs/json_api/v1/
This struct should not be considered concurrency safe.
func GCSForTest ¶
GCSForTest encapsulates boilerplate for getting a GCS object in tests.
func NewGCSServer ¶
NewGCSServer constructs a fake GCS implementation.
type MDS ¶
type MDS struct { // Attributes represents attributes for the GCE instance stored by the metadata // server. Attributes map[string]string // Client is the client to use when accessing the fake MDS. Client *metadata.Client // Server is the fake MDS. It uses state from this struct for serving requests. Server *httptest.Server }
MDS contains data and functionality for a fake compute Metadata Server. It is intended to be constructed with NewMetadataServer.
The MDS struct represents the state of the fake MDS instance. Fields on this struct can be modified to influence the return values of MDS API calls.
The fake MDS server implements a small part of the API discussed here: https://cloud.google.com/compute/docs/metadata/overview#instance-metadata. Only the parts that we need for testing are implemented here.
This struct should not be considered concurrency safe.