info

package
v0.54.2 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommitMetadata

type CommitMetadata struct {
	Sha     string
	Author  string
	Message string
}

type Provider

type Provider interface {
	GetProjectRepository(project *v1alpha1.Project) string
	GetProjectSourceDir(project *v1alpha1.Project) (string, error)
	GetCommitsMetadata(projectDir, fromTag, toTag string) ([]*CommitMetadata, error)
	GetCommitsGitHubAuthors(project *v1alpha1.Project, fromTag, toTag string) (map[string]string, error)
	GetReleaseGitTag(release *v1alpha1.Release) (string, error)
}

func NewProvider

func NewProvider(gitHubOrganization, defaultGitTagTemplate, repositoriesCacheDir, joyCacheDir string) Provider

type ProviderMock

type ProviderMock struct {
	// GetCommitsGitHubAuthorsFunc mocks the GetCommitsGitHubAuthors method.
	GetCommitsGitHubAuthorsFunc func(project *v1alpha1.Project, fromTag string, toTag string) (map[string]string, error)

	// GetCommitsMetadataFunc mocks the GetCommitsMetadata method.
	GetCommitsMetadataFunc func(projectDir string, fromTag string, toTag string) ([]*CommitMetadata, error)

	// GetProjectRepositoryFunc mocks the GetProjectRepository method.
	GetProjectRepositoryFunc func(project *v1alpha1.Project) string

	// GetProjectSourceDirFunc mocks the GetProjectSourceDir method.
	GetProjectSourceDirFunc func(project *v1alpha1.Project) (string, error)

	// GetReleaseGitTagFunc mocks the GetReleaseGitTag method.
	GetReleaseGitTagFunc func(release *v1alpha1.Release) (string, error)
	// contains filtered or unexported fields
}

ProviderMock is a mock implementation of Provider.

func TestSomethingThatUsesProvider(t *testing.T) {

	// make and configure a mocked Provider
	mockedProvider := &ProviderMock{
		GetCommitsGitHubAuthorsFunc: func(project *v1alpha1.Project, fromTag string, toTag string) (map[string]string, error) {
			panic("mock out the GetCommitsGitHubAuthors method")
		},
		GetCommitsMetadataFunc: func(projectDir string, fromTag string, toTag string) ([]*CommitMetadata, error) {
			panic("mock out the GetCommitsMetadata method")
		},
		GetProjectRepositoryFunc: func(project *v1alpha1.Project) string {
			panic("mock out the GetProjectRepository method")
		},
		GetProjectSourceDirFunc: func(project *v1alpha1.Project) (string, error) {
			panic("mock out the GetProjectSourceDir method")
		},
		GetReleaseGitTagFunc: func(release *v1alpha1.Release) (string, error) {
			panic("mock out the GetReleaseGitTag method")
		},
	}

	// use mockedProvider in code that requires Provider
	// and then make assertions.

}

func (*ProviderMock) GetCommitsGitHubAuthors

func (mock *ProviderMock) GetCommitsGitHubAuthors(project *v1alpha1.Project, fromTag string, toTag string) (map[string]string, error)

GetCommitsGitHubAuthors calls GetCommitsGitHubAuthorsFunc.

func (*ProviderMock) GetCommitsGitHubAuthorsCalls

func (mock *ProviderMock) GetCommitsGitHubAuthorsCalls() []struct {
	Project *v1alpha1.Project
	FromTag string
	ToTag   string
}

GetCommitsGitHubAuthorsCalls gets all the calls that were made to GetCommitsGitHubAuthors. Check the length with:

len(mockedProvider.GetCommitsGitHubAuthorsCalls())

func (*ProviderMock) GetCommitsMetadata

func (mock *ProviderMock) GetCommitsMetadata(projectDir string, fromTag string, toTag string) ([]*CommitMetadata, error)

GetCommitsMetadata calls GetCommitsMetadataFunc.

func (*ProviderMock) GetCommitsMetadataCalls

func (mock *ProviderMock) GetCommitsMetadataCalls() []struct {
	ProjectDir string
	FromTag    string
	ToTag      string
}

GetCommitsMetadataCalls gets all the calls that were made to GetCommitsMetadata. Check the length with:

len(mockedProvider.GetCommitsMetadataCalls())

func (*ProviderMock) GetProjectRepository

func (mock *ProviderMock) GetProjectRepository(project *v1alpha1.Project) string

GetProjectRepository calls GetProjectRepositoryFunc.

func (*ProviderMock) GetProjectRepositoryCalls

func (mock *ProviderMock) GetProjectRepositoryCalls() []struct {
	Project *v1alpha1.Project
}

GetProjectRepositoryCalls gets all the calls that were made to GetProjectRepository. Check the length with:

len(mockedProvider.GetProjectRepositoryCalls())

func (*ProviderMock) GetProjectSourceDir

func (mock *ProviderMock) GetProjectSourceDir(project *v1alpha1.Project) (string, error)

GetProjectSourceDir calls GetProjectSourceDirFunc.

func (*ProviderMock) GetProjectSourceDirCalls

func (mock *ProviderMock) GetProjectSourceDirCalls() []struct {
	Project *v1alpha1.Project
}

GetProjectSourceDirCalls gets all the calls that were made to GetProjectSourceDir. Check the length with:

len(mockedProvider.GetProjectSourceDirCalls())

func (*ProviderMock) GetReleaseGitTag

func (mock *ProviderMock) GetReleaseGitTag(release *v1alpha1.Release) (string, error)

GetReleaseGitTag calls GetReleaseGitTagFunc.

func (*ProviderMock) GetReleaseGitTagCalls

func (mock *ProviderMock) GetReleaseGitTagCalls() []struct {
	Release *v1alpha1.Release
}

GetReleaseGitTagCalls gets all the calls that were made to GetReleaseGitTag. Check the length with:

len(mockedProvider.GetReleaseGitTagCalls())

Jump to

Keyboard shortcuts

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