bufmoduletesting

package
v1.32.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewModuleSet added in v1.32.0

func NewModuleSet(
	moduleDatas ...ModuleData,
) (bufmodule.ModuleSet, error)

NewModuleSet returns a new ModuleSet.

This can be used in cases where ModuleKeyProviders and ModuleDataProviders are not needed, and when ModuleFullNames do not matter.

Note the ModuleDatas must be self-contained, that is they only import from each other.

func NewModuleSetForBucket added in v1.32.0

func NewModuleSetForBucket(
	bucket storage.ReadBucket,
) (bufmodule.ModuleSet, error)

NewModuleSetForBucket returns a new ModuleSet for the Bucket.

This can be used in cases where ModuleKeyProviders and ModuleDataProviders are not needed, and when ModuleFullNames do not matter.

Note that this Module cannot have any dependencies.

func NewModuleSetForDirPath added in v1.32.0

func NewModuleSetForDirPath(
	dirPath string,
) (bufmodule.ModuleSet, error)

NewModuleSetForDirPath returns a new ModuleSet for the directory path.

This can be used in cases where ModuleKeyProviders and ModuleDataProviders are not needed, and when ModuleFullNames do not matter.

Note that this Module cannot have any dependencies.

func NewModuleSetForPathToData added in v1.32.0

func NewModuleSetForPathToData(
	pathToData map[string][]byte,
) (bufmodule.ModuleSet, error)

NewModuleSetForPathToData returns a new ModuleSet for the path to data map.

This can be used in cases where ModuleKeyProviders and ModuleDataProviders are not needed, and when ModuleFullNames do not matter.

Note that this Module cannot have any dependencies.

Types

type ModuleData added in v1.32.0

type ModuleData struct {
	Name                     string
	CommitID                 uuid.UUID
	CreateTime               time.Time
	DirPath                  string
	PathToData               map[string][]byte
	Bucket                   storage.ReadBucket
	NotTargeted              bool
	BufYAMLObjectData        bufmodule.ObjectData
	BufLockObjectData        bufmodule.ObjectData
	ReadObjectDataFromBucket bool
}

ModuleData is the data needed to construct a Module in test.

Exactly one of PathToData, Bucket, DirPath must be set.

Name is the ModuleFullName string. When creating an OmniProvider, Name is required.

CommitID is optional, but it must be unique across all ModuleDatas. If CommitID is not set, a mock commitID is created if Name is set.

CreateTime is optional. If CreateTime is not set, a mock create Time is created. This create time is the same for all data without a Time.

If ReadObjectDataFromBucket is true, buf.yamls and buf.locks will attempt to be read from PathToData, Bucket, or DirPath. Otherwise, BufYAMLObjectData and BufLockObjectData will be used. It is an error to both set ReadObjectDataFromBucket and set Buf.*ObjectData.

type OmniProvider added in v1.32.0

OmniProvider is a ModuleKeyProvider, ModuleDataProvider, GraphProvider, CommitProvider, and ModuleSet for testing.

func NewOmniProvider added in v1.32.0

func NewOmniProvider(
	moduleDatas ...ModuleData,
) (OmniProvider, error)

NewOmniProvider returns a new OmniProvider.

Note the ModuleDatas must be self-contained, that is they only import from each other.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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