fake

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Mocks = newFakeBuilderMocks()

Mocks objects to inject Fake resources from SyncFromCloud.

Warning: this is operates on global variables, which means that tests that depend on this CANNOT be run in parallel.

Functions

func ID

func ID(project string, key *meta.Key) *cloud.ResourceID

ID for the resource.

Types

type Builder

type Builder struct {
	rnode.BuilderBase

	FakeOutRefs []rnode.ResourceRef
	OutRefsErr  error

	FakeSyncError error
	// contains filtered or unexported fields
}

Builder for Fake resource. Used only for testing.

func NewBuilder

func NewBuilder(id *cloud.ResourceID) *Builder

NewBuilder returns a Node builder.

func (*Builder) Build

func (b *Builder) Build() (rnode.Node, error)

func (*Builder) OutRefs

func (b *Builder) OutRefs() ([]rnode.ResourceRef, error)

func (*Builder) Resource

func (b *Builder) Resource() rnode.UntypedResource

func (*Builder) SetResource

func (b *Builder) SetResource(u rnode.UntypedResource) error

func (*Builder) SyncFromCloud

func (b *Builder) SyncFromCloud(ctx context.Context, gcp cloud.Cloud) error

type Fake

Fake resource for testing.

type FakeBuilderMocks

type FakeBuilderMocks struct {
	// contains filtered or unexported fields
}

func (*FakeBuilderMocks) Add

func (m *FakeBuilderMocks) Add(b *Builder) bool

Add the mocked fake. Returns true if the mock exists for the given b.ID().

Warning: this is a global, which means that tests that depend on this CANNOT be run in parallel.

func (*FakeBuilderMocks) Clear

func (m *FakeBuilderMocks) Clear()

Clear the mocked Fake objects.

Warning: this is operates on global variables, which means that tests that depend on this CANNOT be run in parallel.

type FakeResource

type FakeResource struct {
	Name string
	// Value is compared in Diff.
	Value string
	// Dependencies are URLs to other resources i.e. OutRefs.
	Dependencies    []string
	NullFields      []string
	ForceSendFields []string
}

FakeResource is a resource used only for testing.

type MutableFake

func NewMutableFake

func NewMutableFake(project string, key *meta.Key) MutableFake

Jump to

Keyboard shortcuts

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