testing

package
v0.20.6 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTestProject

func NewTestProject(name string) *projectv1beta1.Project

NewTestProject creates a test Project resource

func NewTestRobot

func NewTestRobot(name string) *robotv1beta1.Robot

NewTestRobot creates a test Robot resource

func NewTestUser

func NewTestUser(name string) *v1beta1.User

NewTestUser creates a test User resource

Types

type MockHarborClient

type MockHarborClient struct {
	// Base client methods
	GetBaseURLFunc         func() string
	CloseFunc              func() error
	TestConnectionFunc     func(ctx context.Context) error
	GetVersionFunc         func(ctx context.Context) (string, error)
	GetMemoryFootprintFunc func() string

	// User operations
	GetUserFunc    func(ctx context.Context, username string) (*harborclients.UserStatus, error)
	CreateUserFunc func(ctx context.Context, spec *harborclients.UserSpec) (*harborclients.UserStatus, error)
	UpdateUserFunc func(ctx context.Context, username string, spec *harborclients.UserSpec) (*harborclients.UserStatus, error)
	DeleteUserFunc func(ctx context.Context, username string) error

	// Project operations
	GetProjectFunc    func(ctx context.Context, projectName string) (*harborclients.ProjectStatus, error)
	CreateProjectFunc func(ctx context.Context, spec *harborclients.ProjectSpec) (*harborclients.ProjectStatus, error)
	UpdateProjectFunc func(ctx context.Context, projectID string, spec *harborclients.ProjectSpec) (*harborclients.ProjectStatus, error)
	DeleteProjectFunc func(ctx context.Context, projectID string) error
	ListProjectsFunc  func(ctx context.Context) ([]*harborclients.ProjectStatus, error)

	// Scanner operations
	CreateScannerRegistrationFunc func(ctx context.Context, spec *harborclients.ScannerSpec) (*harborclients.ScannerStatus, error)
	GetScannerRegistrationFunc    func(ctx context.Context, scannerID string) (*harborclients.ScannerStatus, error)
	UpdateScannerRegistrationFunc func(ctx context.Context, scannerID string, spec *harborclients.ScannerSpec) (*harborclients.ScannerStatus, error)
	DeleteScannerRegistrationFunc func(ctx context.Context, scannerID string) error
	ListScannerRegistrationsFunc  func(ctx context.Context) ([]*harborclients.ScannerStatus, error)

	// Registry operations
	CreateRegistryFunc func(ctx context.Context, spec *harborclients.RegistrySpec) (*harborclients.RegistryStatus, error)
	GetRegistryFunc    func(ctx context.Context, registryName string) (*harborclients.RegistryStatus, error)
	UpdateRegistryFunc func(ctx context.Context, registryName string, spec *harborclients.RegistrySpec) (*harborclients.RegistryStatus, error)
	DeleteRegistryFunc func(ctx context.Context, registryName string) error

	// Repository operations
	ListRepositoriesFunc func(ctx context.Context, projectID string) ([]*harborclients.RepositoryStatus, error)
	GetRepositoryFunc    func(ctx context.Context, projectID, repoName string) (*harborclients.RepositoryStatus, error)
	UpdateRepositoryFunc func(ctx context.Context, projectID, repoName string, spec *harborclients.RepositorySpec) (*harborclients.RepositoryStatus, error)
	DeleteRepositoryFunc func(ctx context.Context, projectID, repoName string) error

	// Artifact operations
	ListArtifactsFunc              func(ctx context.Context, projectID, repoName string) ([]*harborclients.ArtifactStatus, error)
	GetArtifactFunc                func(ctx context.Context, projectID, repoName, reference string) (*harborclients.ArtifactStatus, error)
	DeleteArtifactFunc             func(ctx context.Context, projectID, repoName, reference string) error
	GetArtifactVulnerabilitiesFunc func(ctx context.Context, projectID, repoName, reference string) (*harborclients.ArtifactStatus, error)

	// Member operations
	AddProjectMemberFunc    func(ctx context.Context, projectID, username, role string) error
	ListProjectMembersFunc  func(ctx context.Context, projectID string) ([]*harborclients.MemberStatus, error)
	GetProjectMemberFunc    func(ctx context.Context, projectID, username string) (*harborclients.MemberStatus, error)
	UpdateProjectMemberFunc func(ctx context.Context, projectID, username, role string) error
	DeleteProjectMemberFunc func(ctx context.Context, projectID, username string) error

	// Scan operations
	TriggerScanFunc func(ctx context.Context, projectID, repoName, reference string) error
	ListScansFunc   func(ctx context.Context, projectID, repoName string) ([]*harborclients.ScanStatus, error)
	GetScanFunc     func(ctx context.Context, projectID, repoName, reference string) (*harborclients.ScanStatus, error)
	StopScanFunc    func(ctx context.Context, projectID, repoName, reference string) error

	// Robot operations
	CreateRobotFunc func(ctx context.Context, spec *harborclients.RobotSpec) (*harborclients.RobotStatus, error)
	ListRobotsFunc  func(ctx context.Context, projectID *string) ([]*harborclients.RobotStatus, error)
	GetRobotFunc    func(ctx context.Context, robotID string) (*harborclients.RobotStatus, error)
	UpdateRobotFunc func(ctx context.Context, robotID string, spec *harborclients.RobotSpec) (*harborclients.RobotStatus, error)
	DeleteRobotFunc func(ctx context.Context, robotID string) error

	// Webhook operations
	CreateWebhookFunc func(ctx context.Context, spec *harborclients.WebhookSpec) (*harborclients.WebhookStatus, error)
	ListWebhooksFunc  func(ctx context.Context, projectID string) ([]*harborclients.WebhookStatus, error)
	GetWebhookFunc    func(ctx context.Context, projectID, webhookID string) (*harborclients.WebhookStatus, error)
	UpdateWebhookFunc func(ctx context.Context, projectID, webhookID string, spec *harborclients.WebhookSpec) (*harborclients.WebhookStatus, error)
	DeleteWebhookFunc func(ctx context.Context, projectID, webhookID string) error

	// Replication operations
	CreateReplicationPolicyFunc   func(ctx context.Context, spec *harborclients.ReplicationPolicySpec) (*harborclients.ReplicationPolicyStatus, error)
	ListReplicationPoliciesFunc   func(ctx context.Context) ([]*harborclients.ReplicationPolicyStatus, error)
	GetReplicationPolicyFunc      func(ctx context.Context, policyID string) (*harborclients.ReplicationPolicyStatus, error)
	UpdateReplicationPolicyFunc   func(ctx context.Context, policyID string, spec *harborclients.ReplicationPolicySpec) (*harborclients.ReplicationPolicyStatus, error)
	DeleteReplicationPolicyFunc   func(ctx context.Context, policyID string) error
	TriggerReplicationFunc        func(ctx context.Context, policyID string) (*harborclients.ReplicationExecution, error)
	ListReplicationExecutionsFunc func(ctx context.Context, policyID string) ([]*harborclients.ReplicationExecution, error)

	// Retention operations
	CreateRetentionPolicyFunc func(ctx context.Context, spec *harborclients.RetentionPolicySpec) (*harborclients.RetentionPolicyStatus, error)
	ListRetentionPoliciesFunc func(ctx context.Context, projectID string) ([]*harborclients.RetentionPolicyStatus, error)
	GetRetentionPolicyFunc    func(ctx context.Context, projectID, policyID string) (*harborclients.RetentionPolicyStatus, error)
	UpdateRetentionPolicyFunc func(ctx context.Context, projectID, policyID string, spec *harborclients.RetentionPolicySpec) (*harborclients.RetentionPolicyStatus, error)
	DeleteRetentionPolicyFunc func(ctx context.Context, projectID, policyID string) error
}

MockHarborClient is a mock implementation of the Harbor client for testing

func (*MockHarborClient) AddProjectMember

func (m *MockHarborClient) AddProjectMember(ctx context.Context, projectID, username, role string) error

AddProjectMember calls AddProjectMemberFunc

func (*MockHarborClient) Close

func (m *MockHarborClient) Close() error

Close calls CloseFunc

func (*MockHarborClient) CreateProject

CreateProject calls CreateProjectFunc

func (*MockHarborClient) CreateRegistry

CreateRegistry calls CreateRegistryFunc

func (*MockHarborClient) CreateReplicationPolicy

CreateReplicationPolicy calls CreateReplicationPolicyFunc

func (*MockHarborClient) CreateRetentionPolicy

CreateRetentionPolicy calls CreateRetentionPolicyFunc

func (*MockHarborClient) CreateRobot

CreateRobot calls CreateRobotFunc

func (*MockHarborClient) CreateScannerRegistration

func (m *MockHarborClient) CreateScannerRegistration(ctx context.Context, spec *harborclients.ScannerSpec) (*harborclients.ScannerStatus, error)

CreateScannerRegistration calls CreateScannerRegistrationFunc

func (*MockHarborClient) CreateUser

CreateUser calls CreateUserFunc

func (*MockHarborClient) CreateWebhook

CreateWebhook calls CreateWebhookFunc

func (*MockHarborClient) DeleteArtifact

func (m *MockHarborClient) DeleteArtifact(ctx context.Context, projectID, repoName, reference string) error

DeleteArtifact calls DeleteArtifactFunc

func (*MockHarborClient) DeleteProject

func (m *MockHarborClient) DeleteProject(ctx context.Context, projectID string) error

DeleteProject calls DeleteProjectFunc

func (*MockHarborClient) DeleteProjectMember

func (m *MockHarborClient) DeleteProjectMember(ctx context.Context, projectID, username string) error

DeleteProjectMember calls DeleteProjectMemberFunc

func (*MockHarborClient) DeleteRegistry

func (m *MockHarborClient) DeleteRegistry(ctx context.Context, registryName string) error

DeleteRegistry calls DeleteRegistryFunc

func (*MockHarborClient) DeleteReplicationPolicy

func (m *MockHarborClient) DeleteReplicationPolicy(ctx context.Context, policyID string) error

DeleteReplicationPolicy calls DeleteReplicationPolicyFunc

func (*MockHarborClient) DeleteRepository

func (m *MockHarborClient) DeleteRepository(ctx context.Context, projectID, repoName string) error

DeleteRepository calls DeleteRepositoryFunc

func (*MockHarborClient) DeleteRetentionPolicy

func (m *MockHarborClient) DeleteRetentionPolicy(ctx context.Context, projectID, policyID string) error

DeleteRetentionPolicy calls DeleteRetentionPolicyFunc

func (*MockHarborClient) DeleteRobot

func (m *MockHarborClient) DeleteRobot(ctx context.Context, robotID string) error

DeleteRobot calls DeleteRobotFunc

func (*MockHarborClient) DeleteScannerRegistration

func (m *MockHarborClient) DeleteScannerRegistration(ctx context.Context, scannerID string) error

DeleteScannerRegistration calls DeleteScannerRegistrationFunc

func (*MockHarborClient) DeleteUser

func (m *MockHarborClient) DeleteUser(ctx context.Context, username string) error

DeleteUser calls DeleteUserFunc

func (*MockHarborClient) DeleteWebhook

func (m *MockHarborClient) DeleteWebhook(ctx context.Context, projectID, webhookID string) error

DeleteWebhook calls DeleteWebhookFunc

func (*MockHarborClient) GetArtifact

func (m *MockHarborClient) GetArtifact(ctx context.Context, projectID, repoName, reference string) (*harborclients.ArtifactStatus, error)

GetArtifact calls GetArtifactFunc

func (*MockHarborClient) GetArtifactVulnerabilities

func (m *MockHarborClient) GetArtifactVulnerabilities(ctx context.Context, projectID, repoName, reference string) (*harborclients.ArtifactStatus, error)

GetArtifactVulnerabilities calls GetArtifactVulnerabilitiesFunc

func (*MockHarborClient) GetBaseURL

func (m *MockHarborClient) GetBaseURL() string

GetBaseURL calls GetBaseURLFunc

func (*MockHarborClient) GetMemoryFootprint

func (m *MockHarborClient) GetMemoryFootprint() string

GetMemoryFootprint calls GetMemoryFootprintFunc

func (*MockHarborClient) GetProject

func (m *MockHarborClient) GetProject(ctx context.Context, projectName string) (*harborclients.ProjectStatus, error)

GetProject calls GetProjectFunc

func (*MockHarborClient) GetProjectMember

func (m *MockHarborClient) GetProjectMember(ctx context.Context, projectID, username string) (*harborclients.MemberStatus, error)

GetProjectMember calls GetProjectMemberFunc

func (*MockHarborClient) GetRegistry

func (m *MockHarborClient) GetRegistry(ctx context.Context, registryName string) (*harborclients.RegistryStatus, error)

GetRegistry calls GetRegistryFunc

func (*MockHarborClient) GetReplicationPolicy

func (m *MockHarborClient) GetReplicationPolicy(ctx context.Context, policyID string) (*harborclients.ReplicationPolicyStatus, error)

GetReplicationPolicy calls GetReplicationPolicyFunc

func (*MockHarborClient) GetRepository

func (m *MockHarborClient) GetRepository(ctx context.Context, projectID, repoName string) (*harborclients.RepositoryStatus, error)

GetRepository calls GetRepositoryFunc

func (*MockHarborClient) GetRetentionPolicy

func (m *MockHarborClient) GetRetentionPolicy(ctx context.Context, projectID, policyID string) (*harborclients.RetentionPolicyStatus, error)

GetRetentionPolicy calls GetRetentionPolicyFunc

func (*MockHarborClient) GetRobot

func (m *MockHarborClient) GetRobot(ctx context.Context, robotID string) (*harborclients.RobotStatus, error)

GetRobot calls GetRobotFunc

func (*MockHarborClient) GetScan

func (m *MockHarborClient) GetScan(ctx context.Context, projectID, repoName, reference string) (*harborclients.ScanStatus, error)

GetScan calls GetScanFunc

func (*MockHarborClient) GetScannerRegistration

func (m *MockHarborClient) GetScannerRegistration(ctx context.Context, scannerID string) (*harborclients.ScannerStatus, error)

GetScannerRegistration calls GetScannerRegistrationFunc

func (*MockHarborClient) GetUser

func (m *MockHarborClient) GetUser(ctx context.Context, username string) (*harborclients.UserStatus, error)

GetUser calls GetUserFunc

func (*MockHarborClient) GetVersion

func (m *MockHarborClient) GetVersion(ctx context.Context) (string, error)

GetVersion calls GetVersionFunc

func (*MockHarborClient) GetWebhook

func (m *MockHarborClient) GetWebhook(ctx context.Context, projectID, webhookID string) (*harborclients.WebhookStatus, error)

GetWebhook calls GetWebhookFunc

func (*MockHarborClient) ListArtifacts

func (m *MockHarborClient) ListArtifacts(ctx context.Context, projectID, repoName string) ([]*harborclients.ArtifactStatus, error)

ListArtifacts calls ListArtifactsFunc

func (*MockHarborClient) ListProjectMembers

func (m *MockHarborClient) ListProjectMembers(ctx context.Context, projectID string) ([]*harborclients.MemberStatus, error)

ListProjectMembers calls ListProjectMembersFunc

func (*MockHarborClient) ListProjects

func (m *MockHarborClient) ListProjects(ctx context.Context) ([]*harborclients.ProjectStatus, error)

ListProjects calls ListProjectsFunc

func (*MockHarborClient) ListReplicationExecutions

func (m *MockHarborClient) ListReplicationExecutions(ctx context.Context, policyID string) ([]*harborclients.ReplicationExecution, error)

ListReplicationExecutions calls ListReplicationExecutionsFunc

func (*MockHarborClient) ListReplicationPolicies

func (m *MockHarborClient) ListReplicationPolicies(ctx context.Context) ([]*harborclients.ReplicationPolicyStatus, error)

ListReplicationPolicies calls ListReplicationPoliciesFunc

func (*MockHarborClient) ListRepositories

func (m *MockHarborClient) ListRepositories(ctx context.Context, projectID string) ([]*harborclients.RepositoryStatus, error)

ListRepositories calls ListRepositoriesFunc

func (*MockHarborClient) ListRetentionPolicies

func (m *MockHarborClient) ListRetentionPolicies(ctx context.Context, projectID string) ([]*harborclients.RetentionPolicyStatus, error)

ListRetentionPolicies calls ListRetentionPoliciesFunc

func (*MockHarborClient) ListRobots

func (m *MockHarborClient) ListRobots(ctx context.Context, projectID *string) ([]*harborclients.RobotStatus, error)

ListRobots calls ListRobotsFunc

func (*MockHarborClient) ListScannerRegistrations

func (m *MockHarborClient) ListScannerRegistrations(ctx context.Context) ([]*harborclients.ScannerStatus, error)

ListScannerRegistrations calls ListScannerRegistrationsFunc

func (*MockHarborClient) ListScans

func (m *MockHarborClient) ListScans(ctx context.Context, projectID, repoName string) ([]*harborclients.ScanStatus, error)

ListScans calls ListScansFunc

func (*MockHarborClient) ListWebhooks

func (m *MockHarborClient) ListWebhooks(ctx context.Context, projectID string) ([]*harborclients.WebhookStatus, error)

ListWebhooks calls ListWebhooksFunc

func (*MockHarborClient) StopScan

func (m *MockHarborClient) StopScan(ctx context.Context, projectID, repoName, reference string) error

StopScan calls StopScanFunc

func (*MockHarborClient) TestConnection

func (m *MockHarborClient) TestConnection(ctx context.Context) error

TestConnection calls TestConnectionFunc

func (*MockHarborClient) TriggerReplication

func (m *MockHarborClient) TriggerReplication(ctx context.Context, policyID string) (*harborclients.ReplicationExecution, error)

TriggerReplication calls TriggerReplicationFunc

func (*MockHarborClient) TriggerScan

func (m *MockHarborClient) TriggerScan(ctx context.Context, projectID, repoName, reference string) error

TriggerScan calls TriggerScanFunc

func (*MockHarborClient) UpdateProject

func (m *MockHarborClient) UpdateProject(ctx context.Context, projectID string, spec *harborclients.ProjectSpec) (*harborclients.ProjectStatus, error)

UpdateProject calls UpdateProjectFunc

func (*MockHarborClient) UpdateProjectMember

func (m *MockHarborClient) UpdateProjectMember(ctx context.Context, projectID, username, role string) error

UpdateProjectMember calls UpdateProjectMemberFunc

func (*MockHarborClient) UpdateRegistry

func (m *MockHarborClient) UpdateRegistry(ctx context.Context, registryName string, spec *harborclients.RegistrySpec) (*harborclients.RegistryStatus, error)

UpdateRegistry calls UpdateRegistryFunc

func (*MockHarborClient) UpdateReplicationPolicy

UpdateReplicationPolicy calls UpdateReplicationPolicyFunc

func (*MockHarborClient) UpdateRepository

func (m *MockHarborClient) UpdateRepository(ctx context.Context, projectID, repoName string, spec *harborclients.RepositorySpec) (*harborclients.RepositoryStatus, error)

UpdateRepository calls UpdateRepositoryFunc

func (*MockHarborClient) UpdateRetentionPolicy

func (m *MockHarborClient) UpdateRetentionPolicy(ctx context.Context, projectID, policyID string, spec *harborclients.RetentionPolicySpec) (*harborclients.RetentionPolicyStatus, error)

UpdateRetentionPolicy calls UpdateRetentionPolicyFunc

func (*MockHarborClient) UpdateRobot

UpdateRobot calls UpdateRobotFunc

func (*MockHarborClient) UpdateScannerRegistration

func (m *MockHarborClient) UpdateScannerRegistration(ctx context.Context, scannerID string, spec *harborclients.ScannerSpec) (*harborclients.ScannerStatus, error)

UpdateScannerRegistration calls UpdateScannerRegistrationFunc

func (*MockHarborClient) UpdateUser

func (m *MockHarborClient) UpdateUser(ctx context.Context, username string, spec *harborclients.UserSpec) (*harborclients.UserStatus, error)

UpdateUser calls UpdateUserFunc

func (*MockHarborClient) UpdateWebhook

func (m *MockHarborClient) UpdateWebhook(ctx context.Context, projectID, webhookID string, spec *harborclients.WebhookSpec) (*harborclients.WebhookStatus, error)

UpdateWebhook calls UpdateWebhookFunc

Jump to

Keyboard shortcuts

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