testfakes

package
Version: v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 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(`{"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"},
			Args: []string{
				"a=b",
				"c",
			},
		},
		CloudId:    "cloud-config.tmpl",
		IgnitionId: "ignition.tmpl",
		GenericId:  "generic.tmpl",
	}

	// IgnitionYAMLName is an Ignition template name for testing.
	IgnitionYAMLName = "ignition.tmpl"

	// IgnitionYAML is an Ignition template for testing.
	IgnitionYAML = `ignition_version: 1
systemd:
  units:
    - name: etcd2.service
      enable: true
`

	// GenericName is a Generic template name for testing.
	GenericName = "generic.tmpl"

	// Generic is a Generic template for testing.
	Generic = `
This is a generic template.
`
)

Functions

This section is empty.

Types

type BrokenStore

type BrokenStore struct{}

BrokenStore returns errors for testing purposes.

func (*BrokenStore) CloudGet

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

CloudGet returns an error.

func (*BrokenStore) GenericDelete added in v0.7.0

func (s *BrokenStore) GenericDelete(name string) error

GenericDelete returns an error.

func (*BrokenStore) GenericGet

func (s *BrokenStore) GenericGet(name string) (string, error)

GenericGet returns an error.

func (*BrokenStore) GenericPut added in v0.7.0

func (s *BrokenStore) GenericPut(name string, config []byte) error

GenericPut returns an error.

func (*BrokenStore) GroupDelete added in v0.6.0

func (s *BrokenStore) GroupDelete(id string) error

GroupDelete 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) IgnitionDelete added in v0.6.0

func (s *BrokenStore) IgnitionDelete(name string) error

IgnitionDelete returns an error.

func (*BrokenStore) IgnitionGet

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

IgnitionGet returns an error.

func (*BrokenStore) IgnitionPut

func (s *BrokenStore) IgnitionPut(name string, config []byte) error

IgnitionPut returns an error.

func (*BrokenStore) ProfileDelete added in v0.6.0

func (s *BrokenStore) ProfileDelete(id string) error

ProfileDelete 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(name string) (string, error)

CloudGet returns a Cloud-config template not found error.

func (*EmptyStore) GenericDelete added in v0.7.0

func (s *EmptyStore) GenericDelete(name string) error

GenericDelete returns a nil error (successful deletion).

func (*EmptyStore) GenericGet

func (s *EmptyStore) GenericGet(name string) (string, error)

GenericGet get returns an Generic template not found error.

func (*EmptyStore) GenericPut added in v0.7.0

func (s *EmptyStore) GenericPut(name string, config []byte) error

GenericPut returns an error writing any Generic template.

func (*EmptyStore) GroupDelete added in v0.6.0

func (s *EmptyStore) GroupDelete(id string) error

GroupDelete returns a nil error (successful deletion).

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) IgnitionDelete added in v0.6.0

func (s *EmptyStore) IgnitionDelete(name string) error

IgnitionDelete returns a nil error (successful deletion).

func (*EmptyStore) IgnitionGet

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

IgnitionGet get returns an Ignition template not found error.

func (*EmptyStore) IgnitionPut

func (s *EmptyStore) IgnitionPut(name string, config []byte) error

IgnitionPut returns an error writing any Ignition template.

func (*EmptyStore) ProfileDelete added in v0.6.0

func (s *EmptyStore) ProfileDelete(id string) error

ProfileDelete returns a nil error (successful deletion).

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
	GenericConfigs  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(name string) (string, error)

CloudGet returns a Cloud-config template by name.

func (*FixedStore) GenericDelete added in v0.7.0

func (s *FixedStore) GenericDelete(name string) error

GenericDelete deletes an Generic template by name.

func (*FixedStore) GenericGet

func (s *FixedStore) GenericGet(name string) (string, error)

GenericGet returns an Generic template by name.

func (*FixedStore) GenericPut added in v0.7.0

func (s *FixedStore) GenericPut(name string, config []byte) error

GenericPut create or updates an Generic template.

func (*FixedStore) GroupDelete added in v0.6.0

func (s *FixedStore) GroupDelete(id string) error

GroupDelete deletes the Group from the Groups map 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) IgnitionDelete added in v0.6.0

func (s *FixedStore) IgnitionDelete(name string) error

IgnitionDelete deletes an Ignition template by name.

func (*FixedStore) IgnitionGet

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

IgnitionGet returns an Ignition template by name.

func (*FixedStore) IgnitionPut

func (s *FixedStore) IgnitionPut(name string, config []byte) error

IgnitionPut create or updates an Ignition template.

func (*FixedStore) ProfileDelete added in v0.6.0

func (s *FixedStore) ProfileDelete(id string) error

ProfileDelete deletes the Profile from the Profiles map 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