testfakes

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2016 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package testfakes provides shared storage implementations for testing.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Group is a machine group for testing.
	Group = &storagepb.Group{
		Id:       "test-group",
		Name:     "test group",
		Profile:  "g1h2i3j4",
		Selector: map[string]string{"uuid": "a1b2c3d4"},
		Metadata: []byte(`{"k8s_version":"v1.1.2","pod_network":"10.2.0.0/16","service_name":"etcd2"}`),
	}

	// GroupNoMetadata is a Group without any metadata.
	GroupNoMetadata = &storagepb.Group{
		Id:       "group-no-metadata",
		Selector: map[string]string{"uuid": "a1b2c3d4"},
		Metadata: nil,
	}

	// Profile is a machine profile for testing.
	Profile = &storagepb.Profile{
		Id: "g1h2i3j4",
		Boot: &storagepb.NetBoot{
			Kernel: "/image/kernel",
			Initrd: []string{"/image/initrd_a", "/image/initrd_b"},
			Cmdline: map[string]string{
				"a": "b",
				"c": "",
			},
		},
		CloudId:    "cloud-config.yml",
		IgnitionId: "ignition.json",
	}
)

Functions

This section is empty.

Types

type BrokenStore

type BrokenStore struct{}

BrokenStore returns errors for testing purposes.

func (*BrokenStore) CloudGet

func (s *BrokenStore) CloudGet(id string) (string, error)

CloudGet returns an error.

func (*BrokenStore) GroupGet

func (s *BrokenStore) GroupGet(id string) (*storagepb.Group, error)

GroupGet returns an error.

func (*BrokenStore) GroupList

func (s *BrokenStore) GroupList() (groups []*storagepb.Group, err error)

GroupList returns an error.

func (*BrokenStore) GroupPut

func (s *BrokenStore) GroupPut(group *storagepb.Group) error

GroupPut returns an error.

func (*BrokenStore) IgnitionGet

func (s *BrokenStore) IgnitionGet(id string) (string, error)

IgnitionGet returns an error.

func (*BrokenStore) ProfileGet

func (s *BrokenStore) ProfileGet(id string) (*storagepb.Profile, error)

ProfileGet returns an error.

func (*BrokenStore) ProfileList

func (s *BrokenStore) ProfileList() (profiles []*storagepb.Profile, err error)

ProfileList returns an error.

func (*BrokenStore) ProfilePut

func (s *BrokenStore) ProfilePut(profile *storagepb.Profile) error

ProfilePut returns an error.

type EmptyStore

type EmptyStore struct{}

EmptyStore is used for testing purposes.

func (*EmptyStore) CloudGet

func (s *EmptyStore) CloudGet(id string) (string, error)

CloudGet returns a Cloud config not found error.

func (*EmptyStore) GroupGet

func (s *EmptyStore) GroupGet(id string) (*storagepb.Group, error)

GroupGet returns a group not found error.

func (*EmptyStore) GroupList

func (s *EmptyStore) GroupList() (groups []*storagepb.Group, err error)

GroupList returns an empty list of groups.

func (*EmptyStore) GroupPut

func (s *EmptyStore) GroupPut(group *storagepb.Group) error

GroupPut returns an error writing any Group.

func (*EmptyStore) IgnitionGet

func (s *EmptyStore) IgnitionGet(id string) (string, error)

IgnitionGet get returns an Ignition config not found error.

func (*EmptyStore) ProfileGet

func (s *EmptyStore) ProfileGet(id string) (*storagepb.Profile, error)

ProfileGet returns a profile not found error.

func (*EmptyStore) ProfileList

func (s *EmptyStore) ProfileList() (profiles []*storagepb.Profile, err error)

ProfileList returns an empty list of profiles.

func (*EmptyStore) ProfilePut

func (s *EmptyStore) ProfilePut(profile *storagepb.Profile) error

ProfilePut returns an error writing any Profile.

type FixedStore

type FixedStore struct {
	Groups          map[string]*storagepb.Group
	Profiles        map[string]*storagepb.Profile
	IgnitionConfigs map[string]string
	CloudConfigs    map[string]string
}

FixedStore is used for testing purposes.

func NewFixedStore

func NewFixedStore() *FixedStore

NewFixedStore returns a new FixedStore.

func (*FixedStore) CloudGet

func (s *FixedStore) CloudGet(id string) (string, error)

CloudGet returns the Cloud config with the given id.

func (*FixedStore) GroupGet

func (s *FixedStore) GroupGet(id string) (*storagepb.Group, error)

GroupGet returns the Group from the Groups map with the given id.

func (*FixedStore) GroupList

func (s *FixedStore) GroupList() ([]*storagepb.Group, error)

GroupList returns the groups in the Groups map.

func (*FixedStore) GroupPut

func (s *FixedStore) GroupPut(group *storagepb.Group) error

GroupPut write the given Group the Groups map.

func (*FixedStore) IgnitionGet

func (s *FixedStore) IgnitionGet(id string) (string, error)

IgnitionGet returns the Ignition config with the given id.

func (*FixedStore) ProfileGet

func (s *FixedStore) ProfileGet(id string) (*storagepb.Profile, error)

ProfileGet returns the Profile from the Profiles map with the given id.

func (*FixedStore) ProfileList

func (s *FixedStore) ProfileList() ([]*storagepb.Profile, error)

ProfileList returns the profiles in the Profiles map.

func (*FixedStore) ProfilePut

func (s *FixedStore) ProfilePut(profile *storagepb.Profile) error

ProfilePut writes the given Profile to the Profiles map.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL