mock

package
v1.57.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package mock implements a VersionResolver implementation for use in testing. This implementation returns static data only and is not meant to be used outside of testing environments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

Types

type VersionResolver

type VersionResolver struct {
	// Version is the version the resolver will return
	Version string

	// GetLatestVersionReturnsErr return an error when calling the mock function
	// GetLatestVersion
	GetLatestVersionReturnsErr bool

	// GetLatestVersionErrorMsg error message to return if GetLatestVersionReturnsErr
	// is set to true
	GetLatestVersionErrorMsg string

	// GetVersionResolverConfigReturnsErr returns an error when calling the mock function
	// GetVersionResolverConfig
	GetVersionResolverConfigReturnsErr bool

	// GetVersionResolverConfigErrorMsg error message to return if GetVersionResolverConfigReturnsErr
	// is set to true
	GetVersionResolverConfigErrorMsg string

	// SearchMockVersionResolverList searches the map of mock resolvers rather than returning
	// the current instance
	SearchMockVersionResolverList bool

	// MockVersionResolverList is a list of version resolvers we want to mock
	MockVersionResolverList map[string]VersionResolver
}

func (*VersionResolver) GetLatestVersion

func (v *VersionResolver) GetLatestVersion(ctx context.Context, log logrus.FieldLogger, appName, applicationType string) (string, error)

GetLatestVersion mocks the function the retrieves the latest version from a resolver

func (*VersionResolver) MockGetVersionResolverConfig

func (v *VersionResolver) MockGetVersionResolverConfig(versionResolverType types.VersionResolverName) (types.VersionResolver, error)

MockGetVersionResolverConfig mocks the function that gets the resolver

Jump to

Keyboard shortcuts

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