Documentation
¶
Overview ¶
Package mock provides test-only in-memory implementations for unit tests. It must not be imported by production code.
Index ¶
- type DenyQuotaTeamStore
- func (d *DenyQuotaTeamStore) AddTeamMember(_ context.Context, _, _, _ string) (*model.TeamMember, error)
- func (d *DenyQuotaTeamStore) CountTeamMembers(_ context.Context, _ []string) (map[string]int, error)
- func (d *DenyQuotaTeamStore) CreateTeam(_ context.Context, _, _, _ string) (*model.Team, error)
- func (d *DenyQuotaTeamStore) GetPersonalTeamByUser(_ context.Context, _ string) (*model.Team, error)
- func (d *DenyQuotaTeamStore) GetTeam(_ context.Context, _ string) (*model.Team, error)
- func (d *DenyQuotaTeamStore) ListAllTeams(_ context.Context, _ string, _, _ int) ([]model.Team, int, error)
- func (d *DenyQuotaTeamStore) ListTeamMembers(_ context.Context, _ string) ([]model.TeamMember, error)
- func (d *DenyQuotaTeamStore) ListTeamsByUser(_ context.Context, _ string) ([]model.Team, error)
- func (d *DenyQuotaTeamStore) RemoveTeamMember(_ context.Context, _, _ string) error
- type DenyQuotaTierStore
- type DenyQuotaUsageReader
- type MockAgentStore
- func (m *MockAgentStore) CreateAgent(_ context.Context, userID, name, description, instructions string) (*model.Agent, error)
- func (m *MockAgentStore) CreateAgentInTeam(_ context.Context, teamID, userID, name, description, instructions string) (*model.Agent, error)
- func (m *MockAgentStore) DeleteAgent(_ context.Context, agentID, userID string) error
- func (m *MockAgentStore) DeleteAgentInTeam(_ context.Context, agentID, teamID string) error
- func (m *MockAgentStore) GetAgent(_ context.Context, agentID string) (*model.Agent, error)
- func (m *MockAgentStore) GetAgentIncludingDeleted(_ context.Context, agentID string) (*model.Agent, error)
- func (m *MockAgentStore) GetAgentRevision(_ context.Context, agentID string, revision int) (*model.AgentRevision, error)
- func (m *MockAgentStore) ListAgentRevisions(_ context.Context, agentID string, limit, offset int) ([]model.AgentRevision, int, error)
- func (m *MockAgentStore) ListAgentsByTeam(_ context.Context, teamID string) ([]model.Agent, error)
- func (m *MockAgentStore) ListAgentsByUser(_ context.Context, userID string) ([]model.Agent, error)
- func (m *MockAgentStore) UpdateAgent(_ context.Context, agentID, userID, name, description, instructions string) (*model.Agent, error)
- func (m *MockAgentStore) UpdateAgentInTeam(_ context.Context, ...) (*model.Agent, error)
- type MockArtifactStorage
- func (m *MockArtifactStorage) ObjectCount() int
- func (m *MockArtifactStorage) OpenArtifact(_ context.Context, ref blob.ArtifactRef) (io.ReadCloser, error)
- func (m *MockArtifactStorage) PutArtifact(_ context.Context, ref blob.ArtifactRef, r io.Reader) (string, error)
- func (m *MockArtifactStorage) RemoveArtifact(_ context.Context, ref blob.ArtifactRef) error
- type MockArtifactStore
- func (m *MockArtifactStore) Count() int
- func (m *MockArtifactStore) CreateArtifact(_ context.Context, in model.CreateArtifactInput) (*model.Artifact, error)
- func (m *MockArtifactStore) GetArtifact(_ context.Context, artifactID string) (*model.Artifact, error)
- func (m *MockArtifactStore) ListArtifactsBySource(_ context.Context, sourceIDs []string) (map[string][]model.Artifact, error)
- func (m *MockArtifactStore) ListArtifactsByTeam(_ context.Context, teamID string, limit, offset int) ([]model.Artifact, int, error)
- func (m *MockArtifactStore) SoftDeleteArtifact(_ context.Context, artifactID string, deletedAt int64) (bool, error)
- type MockAuditStore
- func (m *MockAuditStore) ExportAuditEvents(_ context.Context, filter model.AuditFilter, after model.AuditCursor, ...) ([]model.AuditEvent, error)
- func (m *MockAuditStore) ExportTeamAuditEvents(_ context.Context, teamID string, after model.AuditCursor, limit int) ([]model.AuditEvent, error)
- func (m *MockAuditStore) ListAuditEvents(_ context.Context, teamID string, limit, offset int) ([]model.AuditEvent, int, error)
- func (m *MockAuditStore) OldestAuditEventAt(_ context.Context) (int64, error)
- func (m *MockAuditStore) PruneAuditEvents(_ context.Context, before int64, limit int) (int64, error)
- func (m *MockAuditStore) RecordAuditEvent(_ context.Context, in model.AuditEvent) error
- func (m *MockAuditStore) SearchAuditEvents(_ context.Context, filter model.AuditFilter, limit, offset int) ([]model.AuditEvent, int, error)
- type MockConversationStore
- func (m *MockConversationStore) CreateConversation(_ context.Context, userID, channel, createdBy string) (*model.Conversation, error)
- func (m *MockConversationStore) CreateConversationInTeam(_ context.Context, teamID, userID, channel, createdBy string) (*model.Conversation, error)
- func (m *MockConversationStore) GetConversation(_ context.Context, conversationID string) (*model.Conversation, error)
- func (m *MockConversationStore) ListConversationsByTeam(_ context.Context, teamID string, limit, offset int) ([]model.Conversation, int, error)
- func (m *MockConversationStore) ListConversationsByUser(_ context.Context, userID string, limit, offset int) ([]model.Conversation, int, error)
- func (m *MockConversationStore) UpdateConversationTitle(_ context.Context, conversationID, title string) error
- type MockIssueCommentStore
- func (m *MockIssueCommentStore) CountIssueComments(_ context.Context, issueIDs []string) (map[string]int, error)
- func (m *MockIssueCommentStore) CreateIssueComment(_ context.Context, in model.CreateIssueCommentInput) (*model.IssueComment, error)
- func (m *MockIssueCommentStore) DeleteIssueComment(_ context.Context, commentID string) error
- func (m *MockIssueCommentStore) GetIssueComment(_ context.Context, commentID string) (*model.IssueComment, error)
- func (m *MockIssueCommentStore) ListIssueComments(_ context.Context, issueID string, limit, offset int) ([]model.IssueComment, int, error)
- func (m *MockIssueCommentStore) UpdateIssueComment(_ context.Context, commentID, body string) (*model.IssueComment, error)
- type MockIssueStore
- func (m *MockIssueStore) ChildStatsForIssues(_ context.Context, issueIDs []string) (map[string]model.IssueChildStats, error)
- func (m *MockIssueStore) CreateIssue(_ context.Context, userID string, in model.CreateIssueInput) (*model.Issue, error)
- func (m *MockIssueStore) CreateIssueInTeam(_ context.Context, teamID, createdBy string, in model.CreateIssueInput) (*model.Issue, error)
- func (m *MockIssueStore) GetIssue(_ context.Context, issueID string) (*model.Issue, error)
- func (m *MockIssueStore) ListIssueChildren(_ context.Context, parentIssueID string) ([]model.Issue, error)
- func (m *MockIssueStore) ListIssuesByTeam(_ context.Context, teamID string, filter model.ListIssuesFilter, ...) ([]model.Issue, int, error)
- func (m *MockIssueStore) ListIssuesByUser(_ context.Context, userID string, limit, offset int) ([]model.Issue, int, error)
- func (m *MockIssueStore) UpdateIssue(_ context.Context, issueID, userID string, in model.UpdateIssueInput) (*model.Issue, error)
- func (m *MockIssueStore) UpdateIssueInTeam(_ context.Context, issueID, teamID string, in model.UpdateIssueInput) (*model.Issue, error)
- type MockLLMModelStore
- func (m *MockLLMModelStore) CreateLLMModel(_ context.Context, in model.CreateLLMModelInput) (*model.LLMModel, error)
- func (m *MockLLMModelStore) GetLLMModel(_ context.Context, llmModelID string) (*model.LLMModel, error)
- func (m *MockLLMModelStore) LLMModelCredential(_ context.Context, llmModelID string) (string, error)
- func (m *MockLLMModelStore) ListLLMModels(_ context.Context) ([]model.LLMModel, error)
- func (m *MockLLMModelStore) SetLLMModelEnabled(_ context.Context, llmModelID string, enabled bool) error
- type MockLoginCode
- type MockLoginCodeStore
- type MockPasswordStore
- type MockPersistStorage
- func (m *MockPersistStorage) Get(_ context.Context, _ string, _ string) ([]byte, error)
- func (m *MockPersistStorage) GetRunArtifacts(_ context.Context, ref blob.RunObjectRef) ([]byte, error)
- func (m *MockPersistStorage) GetRunGlobal(_ context.Context, ref blob.RunObjectRef) ([]byte, error)
- func (m *MockPersistStorage) ListFiles(_ context.Context, _ string) ([]string, error)
- func (m *MockPersistStorage) MaterializeToDir(_ context.Context, _ string, _ string) error
- func (m *MockPersistStorage) Put(_ context.Context, _ string, _ string, _ io.Reader) error
- func (m *MockPersistStorage) PutRunArtifacts(_ context.Context, ref blob.RunObjectRef, r io.Reader) error
- func (m *MockPersistStorage) PutRunGlobal(_ context.Context, ref blob.RunObjectRef, r io.Reader) error
- type MockPluginPackageStorage
- type MockPluginStore
- func (f *MockPluginStore) CreatePlugin(_ context.Context, in model.CreatePluginInput) (*model.Plugin, error)
- func (f *MockPluginStore) CreatePluginRelease(_ context.Context, in model.CreatePluginReleaseInput) (*model.PluginRelease, error)
- func (f *MockPluginStore) GetPlugin(_ context.Context, name string) (*model.Plugin, error)
- func (f *MockPluginStore) GetPluginRelease(_ context.Context, name, version string) (*model.PluginRelease, error)
- func (f *MockPluginStore) ListPluginReleases(_ context.Context, name string) ([]model.PluginRelease, error)
- func (f *MockPluginStore) ListPlugins(_ context.Context, includeArchived bool) ([]model.Plugin, error)
- func (f *MockPluginStore) SetPluginArchived(_ context.Context, name string, archived bool) error
- func (f *MockPluginStore) UpdatePlugin(_ context.Context, name string, in model.UpdatePluginInput) (*model.Plugin, error)
- func (f *MockPluginStore) YankPluginRelease(_ context.Context, name, version, actor, reason string) error
- type MockRefreshToken
- type MockRefreshTokenStore
- func (m *MockRefreshTokenStore) Backdate(plaintext string, by time.Duration) bool
- func (m *MockRefreshTokenStore) CountUserSessions(_ context.Context, userID string, now int64) (int, error)
- func (m *MockRefreshTokenStore) CreateRefreshToken(_ context.Context, in model.NewRefreshToken) (string, int64, error)
- func (m *MockRefreshTokenStore) DeleteExpiredRefreshTokens(_ context.Context, before int64) (int64, error)
- func (m *MockRefreshTokenStore) RevokeRefreshTokenSession(_ context.Context, plaintext string, now int64) (string, string, error)
- func (m *MockRefreshTokenStore) RevokeSession(_ context.Context, sessionID string, now int64) (int64, error)
- func (m *MockRefreshTokenStore) RevokeUserSessions(_ context.Context, userID string, now int64) (int64, error)
- func (m *MockRefreshTokenStore) RotateRefreshToken(_ context.Context, plaintext string, now int64, ttl, grace time.Duration) (model.RotatedRefreshToken, error)
- type MockRunOutputLister
- type MockRunOutputStorage
- func (m *MockRunOutputStorage) GetResult(_ context.Context, ref blob.RunRef) ([]byte, error)
- func (m *MockRunOutputStorage) GetRunOutputFile(_ context.Context, ref blob.RunObjectRef) ([]byte, error)
- func (m *MockRunOutputStorage) PutResult(_ context.Context, ref blob.RunRef, data []byte) error
- func (m *MockRunOutputStorage) PutRunOutputFile(_ context.Context, ref blob.RunObjectRef, r io.Reader) error
- type MockSystemGrantStore
- func (m *MockSystemGrantStore) ActiveSystemRoles(_ context.Context, userID string) ([]string, error)
- func (m *MockSystemGrantStore) CountActiveSystemGrants(_ context.Context, role string) (int, error)
- func (m *MockSystemGrantStore) GrantForTest(userID, role string)
- func (m *MockSystemGrantStore) GrantSystemRole(_ context.Context, userID, role, grantedBy string, now int64) (*model.SystemGrant, error)
- func (m *MockSystemGrantStore) ListSystemGrants(_ context.Context, includeRevoked bool) ([]model.SystemGrant, error)
- func (m *MockSystemGrantStore) RevokeSystemRole(_ context.Context, userID, role string, now int64) (bool, error)
- type MockTaskRunStore
- func (m *MockTaskRunStore) ClaimTaskRun(ctx context.Context, in model.ClaimTaskRunInput) (bool, error)
- func (m *MockTaskRunStore) CountTaskRunsByStatus(_ context.Context) (map[string]int, error)
- func (m *MockTaskRunStore) CreateTaskRun(_ context.Context, in model.CreateTaskRunInput) (*model.TaskRun, error)
- func (m *MockTaskRunStore) GetActiveTaskRunByTask(_ context.Context, taskID string) (*model.TaskRun, error)
- func (m *MockTaskRunStore) GetNextPendingTaskRun(_ context.Context) (*model.TaskRun, error)
- func (m *MockTaskRunStore) GetTaskRun(_ context.Context, taskRunID string) (*model.TaskRun, error)
- func (m *MockTaskRunStore) GetTaskRunWithTask(_ context.Context, taskRunID string) (*model.TaskRun, *model.Task, error)
- func (m *MockTaskRunStore) ListTaskRunIDsByTasks(_ context.Context, taskIDs []string) (map[string][]string, error)
- func (m *MockTaskRunStore) OnRunComplete(ctx context.Context, taskRunID string, relativePaths []string) error
- func (m *MockTaskRunStore) RequestTaskRunCancel(_ context.Context, taskRunID, requestedBy string, requestedAt int64) (bool, error)
- func (m *MockTaskRunStore) SyncTaskFromRun(_ context.Context, taskRunID string) error
- func (m *MockTaskRunStore) UpdateRun(ctx context.Context, in model.UpdateTaskRunInput) error
- func (m *MockTaskRunStore) UpdateTaskRunWorkerInfo(_ context.Context, taskRunID, workerType string, k8sJobName *string, ...) error
- type MockTaskStore
- func (m *MockTaskStore) ClaimTask(_ context.Context, in model.ClaimTaskInput) (bool, error)
- func (m *MockTaskStore) CreateTask(_ context.Context, in *model.CreateTaskInput) (*model.Task, error)
- func (m *MockTaskStore) GetTask(_ context.Context, taskID string) (*model.Task, error)
- func (m *MockTaskStore) GetTaskBySessionID(_ context.Context, sessionID string) (*model.Task, error)
- func (m *MockTaskStore) ListTasksByConversation(_ context.Context, conversationID string, order string) ([]model.Task, error)
- func (m *MockTaskStore) ListTasksByConversationPaginated(_ context.Context, conversationID string, executedOnly bool, limit, offset int) ([]model.Task, int, error)
- func (m *MockTaskStore) ListTasksByIssue(_ context.Context, issueID string, limit, offset int) ([]model.Task, int, error)
- func (m *MockTaskStore) UpdateTask(_ context.Context, in model.UpdateTaskInput) error
- type MockTeamStore
- func (m *MockTeamStore) AddTeamMember(_ context.Context, teamID, userID, role string) (*model.TeamMember, error)
- func (m *MockTeamStore) CountTeamMembers(_ context.Context, teamIDs []string) (map[string]int, error)
- func (m *MockTeamStore) CreateTeam(_ context.Context, name, createdBy, quotaTier string) (*model.Team, error)
- func (m *MockTeamStore) GetPersonalTeamByUser(_ context.Context, userID string) (*model.Team, error)
- func (m *MockTeamStore) GetTeam(_ context.Context, teamID string) (*model.Team, error)
- func (m *MockTeamStore) ListAllTeams(_ context.Context, query string, limit, offset int) ([]model.Team, int, error)
- func (m *MockTeamStore) ListTeamMembers(_ context.Context, teamID string) ([]model.TeamMember, error)
- func (m *MockTeamStore) ListTeamsByUser(_ context.Context, userID string) ([]model.Team, error)
- func (m *MockTeamStore) RemoveTeamMember(_ context.Context, teamID, userID string) error
- type MockTierStore
- type MockUsageReader
- type MockUserStore
- func (m *MockUserStore) CreateUser(_ context.Context, email string, defaultQuotaTier string) (*model.User, error)
- func (m *MockUserStore) DisableForTest(userID string, at int64)
- func (m *MockUserStore) GetUser(_ context.Context, userID string) (*model.User, error)
- func (m *MockUserStore) ListUsers(_ context.Context, query string, limit, offset int) ([]model.User, int, error)
- func (m *MockUserStore) SetUserDisabled(_ context.Context, userID string, disabledAt *int64) error
- func (m *MockUserStore) UpdateLoginMeta(_ context.Context, userID string, loginAt int64, platform string) error
- func (m *MockUserStore) UserByEmail(_ context.Context, email string) (*model.User, error)
- type MockUserWebhookKeyStore
- func (m *MockUserWebhookKeyStore) CreateKey(_ context.Context, userID, name string) (string, string, error)
- func (m *MockUserWebhookKeyStore) GetUserIDByKey(_ context.Context, plaintextKey string) (string, error)
- func (m *MockUserWebhookKeyStore) ListKeys(_ context.Context, userID string) ([]model.WebhookKeyMeta, error)
- func (m *MockUserWebhookKeyStore) RevokeKey(_ context.Context, userID, keyID string) error
- type MockWorkflowStore
- func (m *MockWorkflowStore) CreateWorkflow(_ context.Context, teamID, createdBy, name, description, definition string) (*model.Workflow, error)
- func (m *MockWorkflowStore) CreateWorkflowRun(_ context.Context, in model.CreateWorkflowRunInput) (*model.WorkflowRun, error)
- func (m *MockWorkflowStore) CreateWorkflowStepRuns(_ context.Context, workflowRunID string, ...) ([]model.WorkflowStepRun, error)
- func (m *MockWorkflowStore) GetWorkflow(_ context.Context, workflowID string) (*model.Workflow, error)
- func (m *MockWorkflowStore) GetWorkflowRevision(_ context.Context, workflowID string, revision int) (*model.WorkflowRevision, error)
- func (m *MockWorkflowStore) GetWorkflowRun(_ context.Context, workflowRunID string) (*model.WorkflowRun, error)
- func (m *MockWorkflowStore) GetWorkflowStepRunByTaskID(_ context.Context, taskID string) (*model.WorkflowStepRun, error)
- func (m *MockWorkflowStore) GetWorkflowStepRunByTaskRunID(_ context.Context, taskRunID string) (*model.WorkflowStepRun, error)
- func (m *MockWorkflowStore) ListWorkflowRevisions(_ context.Context, workflowID string, limit, offset int) ([]model.WorkflowRevision, int, error)
- func (m *MockWorkflowStore) ListWorkflowRunsByIssue(_ context.Context, issueID string, limit, offset int) ([]model.WorkflowRun, int, error)
- func (m *MockWorkflowStore) ListWorkflowRunsByWorkflow(_ context.Context, workflowID string, limit, offset int) ([]model.WorkflowRun, int, error)
- func (m *MockWorkflowStore) ListWorkflowStepRuns(_ context.Context, workflowRunID string) ([]model.WorkflowStepRun, error)
- func (m *MockWorkflowStore) ListWorkflowsByTeam(_ context.Context, teamID string) ([]model.Workflow, error)
- func (m *MockWorkflowStore) UpdateWorkflow(_ context.Context, workflowID, teamID string, in model.UpdateWorkflowInput) (*model.Workflow, error)
- func (m *MockWorkflowStore) UpdateWorkflowRun(_ context.Context, workflowRunID string, in model.UpdateWorkflowRunInput) (*model.WorkflowRun, error)
- func (m *MockWorkflowStore) UpdateWorkflowStepRun(_ context.Context, stepRunID string, in model.UpdateWorkflowStepRunInput) (*model.WorkflowStepRun, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DenyQuotaTeamStore ¶
DenyQuotaTeamStore is used by quota 429 tests to supply a team with tier.
func (*DenyQuotaTeamStore) AddTeamMember ¶
func (d *DenyQuotaTeamStore) AddTeamMember(_ context.Context, _, _, _ string) (*model.TeamMember, error)
func (*DenyQuotaTeamStore) CountTeamMembers ¶
func (*DenyQuotaTeamStore) CreateTeam ¶
func (*DenyQuotaTeamStore) GetPersonalTeamByUser ¶
func (*DenyQuotaTeamStore) ListAllTeams ¶
func (*DenyQuotaTeamStore) ListTeamMembers ¶
func (d *DenyQuotaTeamStore) ListTeamMembers(_ context.Context, _ string) ([]model.TeamMember, error)
func (*DenyQuotaTeamStore) ListTeamsByUser ¶
func (*DenyQuotaTeamStore) RemoveTeamMember ¶
func (d *DenyQuotaTeamStore) RemoveTeamMember(_ context.Context, _, _ string) error
type DenyQuotaTierStore ¶
DenyQuotaTierStore is used by quota 429 tests.
func (*DenyQuotaTierStore) GetQuotaTier ¶
type DenyQuotaUsageReader ¶
DenyQuotaUsageReader is used by quota 429 tests.
func (*DenyQuotaUsageReader) TeamUsageInWindow ¶
type MockAgentStore ¶
type MockAgentStore struct {
Agents []model.Agent
Revisions []model.AgentRevision
}
MockAgentStore is an in-memory AgentStore for tests. It records revisions the way the database store does, so a test can assert on history.
func (*MockAgentStore) CreateAgent ¶
func (*MockAgentStore) CreateAgentInTeam ¶
func (*MockAgentStore) DeleteAgent ¶
func (m *MockAgentStore) DeleteAgent(_ context.Context, agentID, userID string) error
func (*MockAgentStore) DeleteAgentInTeam ¶
func (m *MockAgentStore) DeleteAgentInTeam(_ context.Context, agentID, teamID string) error
func (*MockAgentStore) GetAgentIncludingDeleted ¶
func (*MockAgentStore) GetAgentRevision ¶
func (m *MockAgentStore) GetAgentRevision(_ context.Context, agentID string, revision int) (*model.AgentRevision, error)
func (*MockAgentStore) ListAgentRevisions ¶
func (m *MockAgentStore) ListAgentRevisions(_ context.Context, agentID string, limit, offset int) ([]model.AgentRevision, int, error)
func (*MockAgentStore) ListAgentsByTeam ¶
func (*MockAgentStore) ListAgentsByUser ¶
func (*MockAgentStore) UpdateAgent ¶
func (*MockAgentStore) UpdateAgentInTeam ¶
type MockArtifactStorage ¶
type MockArtifactStorage struct {
// PutErr, when set, fails every write.
PutErr error
// contains filtered or unexported fields
}
MockArtifactStorage is an in-memory blob.ArtifactStorage for tests.
func NewMockArtifactStorage ¶
func NewMockArtifactStorage() *MockArtifactStorage
NewMockArtifactStorage returns a MockArtifactStorage ready for use.
func (*MockArtifactStorage) ObjectCount ¶
func (m *MockArtifactStorage) ObjectCount() int
ObjectCount reports how many objects are stored, so a test can prove that a failed create left nothing behind.
func (*MockArtifactStorage) OpenArtifact ¶
func (m *MockArtifactStorage) OpenArtifact(_ context.Context, ref blob.ArtifactRef) (io.ReadCloser, error)
func (*MockArtifactStorage) PutArtifact ¶
func (m *MockArtifactStorage) PutArtifact(_ context.Context, ref blob.ArtifactRef, r io.Reader) (string, error)
func (*MockArtifactStorage) RemoveArtifact ¶
func (m *MockArtifactStorage) RemoveArtifact(_ context.Context, ref blob.ArtifactRef) error
type MockArtifactStore ¶
type MockArtifactStore struct {
// CreateErr, when set, fails every create — the case where content is
// already durable and the record is not.
CreateErr error
// contains filtered or unexported fields
}
MockArtifactStore is an in-memory model.ArtifactStore for tests.
func (*MockArtifactStore) Count ¶
func (m *MockArtifactStore) Count() int
Count reports how many records exist, tombstoned ones included. Tests use it to prove that a failed create left none.
func (*MockArtifactStore) CreateArtifact ¶
func (m *MockArtifactStore) CreateArtifact(_ context.Context, in model.CreateArtifactInput) (*model.Artifact, error)
func (*MockArtifactStore) GetArtifact ¶
func (*MockArtifactStore) ListArtifactsBySource ¶
func (*MockArtifactStore) ListArtifactsByTeam ¶
func (*MockArtifactStore) SoftDeleteArtifact ¶
type MockAuditStore ¶
type MockAuditStore struct {
Events []model.AuditEvent
// Err, when set, is returned by RecordAuditEvent so a caller's behaviour
// on a failed write can be exercised.
Err error
}
MockAuditStore is an in-memory model.AuditStore for tests.
func (*MockAuditStore) ExportAuditEvents ¶
func (m *MockAuditStore) ExportAuditEvents(_ context.Context, filter model.AuditFilter, after model.AuditCursor, limit int) ([]model.AuditEvent, error)
ExportAuditEvents walks every team's events newest-first from after.
func (*MockAuditStore) ExportTeamAuditEvents ¶
func (m *MockAuditStore) ExportTeamAuditEvents(_ context.Context, teamID string, after model.AuditCursor, limit int) ([]model.AuditEvent, error)
ExportTeamAuditEvents walks a team's events newest-first from after.
func (*MockAuditStore) ListAuditEvents ¶
func (m *MockAuditStore) ListAuditEvents(_ context.Context, teamID string, limit, offset int) ([]model.AuditEvent, int, error)
func (*MockAuditStore) OldestAuditEventAt ¶
func (m *MockAuditStore) OldestAuditEventAt(_ context.Context) (int64, error)
OldestAuditEventAt returns the earliest recorded timestamp, or zero.
func (*MockAuditStore) PruneAuditEvents ¶
func (m *MockAuditStore) PruneAuditEvents(_ context.Context, before int64, limit int) (int64, error)
PruneAuditEvents removes events older than the cutoff, at most limit of them.
func (*MockAuditStore) RecordAuditEvent ¶
func (m *MockAuditStore) RecordAuditEvent(_ context.Context, in model.AuditEvent) error
func (*MockAuditStore) SearchAuditEvents ¶
func (m *MockAuditStore) SearchAuditEvents(_ context.Context, filter model.AuditFilter, limit, offset int) ([]model.AuditEvent, int, error)
type MockConversationStore ¶
type MockConversationStore struct {
Conversations []model.Conversation
}
MockConversationStore is an in-memory ConversationStore for tests.
func (*MockConversationStore) CreateConversation ¶
func (m *MockConversationStore) CreateConversation(_ context.Context, userID, channel, createdBy string) (*model.Conversation, error)
func (*MockConversationStore) CreateConversationInTeam ¶
func (m *MockConversationStore) CreateConversationInTeam(_ context.Context, teamID, userID, channel, createdBy string) (*model.Conversation, error)
func (*MockConversationStore) GetConversation ¶
func (m *MockConversationStore) GetConversation(_ context.Context, conversationID string) (*model.Conversation, error)
func (*MockConversationStore) ListConversationsByTeam ¶
func (m *MockConversationStore) ListConversationsByTeam(_ context.Context, teamID string, limit, offset int) ([]model.Conversation, int, error)
func (*MockConversationStore) ListConversationsByUser ¶
func (m *MockConversationStore) ListConversationsByUser(_ context.Context, userID string, limit, offset int) ([]model.Conversation, int, error)
func (*MockConversationStore) UpdateConversationTitle ¶
func (m *MockConversationStore) UpdateConversationTitle(_ context.Context, conversationID, title string) error
type MockIssueCommentStore ¶
type MockIssueCommentStore struct {
Comments []model.IssueComment
// CreateErr, when set, is returned by CreateIssueComment. It exists so a
// test can prove a failed comment write does not fail the run that
// triggered it.
CreateErr error
}
MockIssueCommentStore is an in-memory IssueCommentStore for tests.
func (*MockIssueCommentStore) CountIssueComments ¶
func (*MockIssueCommentStore) CreateIssueComment ¶
func (m *MockIssueCommentStore) CreateIssueComment(_ context.Context, in model.CreateIssueCommentInput) (*model.IssueComment, error)
func (*MockIssueCommentStore) DeleteIssueComment ¶
func (m *MockIssueCommentStore) DeleteIssueComment(_ context.Context, commentID string) error
func (*MockIssueCommentStore) GetIssueComment ¶
func (m *MockIssueCommentStore) GetIssueComment(_ context.Context, commentID string) (*model.IssueComment, error)
func (*MockIssueCommentStore) ListIssueComments ¶
func (m *MockIssueCommentStore) ListIssueComments(_ context.Context, issueID string, limit, offset int) ([]model.IssueComment, int, error)
func (*MockIssueCommentStore) UpdateIssueComment ¶
func (m *MockIssueCommentStore) UpdateIssueComment(_ context.Context, commentID, body string) (*model.IssueComment, error)
type MockIssueStore ¶
MockIssueStore is an in-memory IssueStore for tests.
func (*MockIssueStore) ChildStatsForIssues ¶
func (m *MockIssueStore) ChildStatsForIssues(_ context.Context, issueIDs []string) (map[string]model.IssueChildStats, error)
func (*MockIssueStore) CreateIssue ¶
func (m *MockIssueStore) CreateIssue(_ context.Context, userID string, in model.CreateIssueInput) (*model.Issue, error)
func (*MockIssueStore) CreateIssueInTeam ¶
func (m *MockIssueStore) CreateIssueInTeam(_ context.Context, teamID, createdBy string, in model.CreateIssueInput) (*model.Issue, error)
func (*MockIssueStore) ListIssueChildren ¶
func (*MockIssueStore) ListIssuesByTeam ¶
func (*MockIssueStore) ListIssuesByUser ¶
func (*MockIssueStore) UpdateIssue ¶
func (m *MockIssueStore) UpdateIssue(_ context.Context, issueID, userID string, in model.UpdateIssueInput) (*model.Issue, error)
func (*MockIssueStore) UpdateIssueInTeam ¶
func (m *MockIssueStore) UpdateIssueInTeam(_ context.Context, issueID, teamID string, in model.UpdateIssueInput) (*model.Issue, error)
type MockLLMModelStore ¶
type MockLLMModelStore struct {
Models []model.LLMModel
Credentials map[string]string
Err error
// contains filtered or unexported fields
}
MockLLMModelStore is an in-memory LLMModelStore for tests.
Credentials are kept in a separate map, mirroring the real store: reading a model and reading its key are different operations, and a mock that stapled the key onto the record would let a handler test pass while the endpoint serialized it.
func (*MockLLMModelStore) CreateLLMModel ¶
func (m *MockLLMModelStore) CreateLLMModel(_ context.Context, in model.CreateLLMModelInput) (*model.LLMModel, error)
func (*MockLLMModelStore) GetLLMModel ¶
func (*MockLLMModelStore) LLMModelCredential ¶
func (*MockLLMModelStore) ListLLMModels ¶
func (*MockLLMModelStore) SetLLMModelEnabled ¶
type MockLoginCode ¶
MockLoginCode is one issued code in MockLoginCodeStore.
type MockLoginCodeStore ¶
type MockLoginCodeStore struct {
Codes map[string]*MockLoginCode
ConsumeErr error
Issued []string
}
MockLoginCodeStore is an in-memory LoginCodeStore for tests. Seed Codes with the plaintext a test will submit; ConsumeErr forces a store failure.
func (*MockLoginCodeStore) ConsumeLoginCode ¶
func (m *MockLoginCodeStore) ConsumeLoginCode(_ context.Context, plaintext, userID string, now int64) (bool, error)
ConsumeLoginCode mirrors the real store: unknown, spent, expired, and somebody else's codes are all reported the same way, as not redeemed rather than as an error, and only a match is marked used.
type MockPasswordStore ¶
MockPasswordStore is an in-memory PasswordStore for tests. Seed Hashes with the encoded hash a test expects to verify against.
func (*MockPasswordStore) PasswordHash ¶
func (*MockPasswordStore) SetPassword ¶
type MockPersistStorage ¶
type MockPersistStorage struct {
// RunGlobal is keyed by createdBy/conversationID/taskID/taskRunID/relPath.
RunGlobal map[string][]byte
// RunArtifacts uses the same key shape.
RunArtifacts map[string][]byte
}
MockPersistStorage is an in-memory blob.PersistStorage for tests. Only the run-global half is backed by a map; the home-file methods satisfy the interface and are inert, because the handlers that need this mock read run state, not team files.
func NewMockPersistStorage ¶
func NewMockPersistStorage() *MockPersistStorage
NewMockPersistStorage returns a MockPersistStorage ready for use.
func (*MockPersistStorage) GetRunArtifacts ¶
func (m *MockPersistStorage) GetRunArtifacts(_ context.Context, ref blob.RunObjectRef) ([]byte, error)
func (*MockPersistStorage) GetRunGlobal ¶
func (m *MockPersistStorage) GetRunGlobal(_ context.Context, ref blob.RunObjectRef) ([]byte, error)
func (*MockPersistStorage) MaterializeToDir ¶
func (*MockPersistStorage) PutRunArtifacts ¶
func (m *MockPersistStorage) PutRunArtifacts(_ context.Context, ref blob.RunObjectRef, r io.Reader) error
func (*MockPersistStorage) PutRunGlobal ¶
func (m *MockPersistStorage) PutRunGlobal(_ context.Context, ref blob.RunObjectRef, r io.Reader) error
type MockPluginPackageStorage ¶
MockPluginPackageStorage is an in-memory objectstore.PluginPackageStorage.
func NewMockPluginPackageStorage ¶
func NewMockPluginPackageStorage() *MockPluginPackageStorage
NewMockPluginPackageStorage returns empty storage.
func (*MockPluginPackageStorage) Open ¶
func (f *MockPluginPackageStorage) Open(_ context.Context, key string) (io.ReadCloser, int64, error)
type MockPluginStore ¶
type MockPluginStore struct {
// contains filtered or unexported fields
}
MockPluginStore is an in-memory model.PluginStore for tests.
func NewMockPluginStore ¶
func NewMockPluginStore() *MockPluginStore
func (*MockPluginStore) CreatePlugin ¶
func (f *MockPluginStore) CreatePlugin(_ context.Context, in model.CreatePluginInput) (*model.Plugin, error)
func (*MockPluginStore) CreatePluginRelease ¶
func (f *MockPluginStore) CreatePluginRelease(_ context.Context, in model.CreatePluginReleaseInput) (*model.PluginRelease, error)
func (*MockPluginStore) GetPluginRelease ¶
func (f *MockPluginStore) GetPluginRelease(_ context.Context, name, version string) (*model.PluginRelease, error)
func (*MockPluginStore) ListPluginReleases ¶
func (f *MockPluginStore) ListPluginReleases(_ context.Context, name string) ([]model.PluginRelease, error)
func (*MockPluginStore) ListPlugins ¶
func (*MockPluginStore) SetPluginArchived ¶
func (*MockPluginStore) UpdatePlugin ¶
func (f *MockPluginStore) UpdatePlugin(_ context.Context, name string, in model.UpdatePluginInput) (*model.Plugin, error)
func (*MockPluginStore) YankPluginRelease ¶
func (f *MockPluginStore) YankPluginRelease(_ context.Context, name, version, actor, reason string) error
type MockRefreshToken ¶
type MockRefreshToken struct {
UserID string
SessionID string
Platform string
ExpiresAt int64
UsedAt *int64
RevokedAt *int64
}
MockRefreshToken is one issued token in MockRefreshTokenStore.
type MockRefreshTokenStore ¶
type MockRefreshTokenStore struct {
Tokens map[string]*MockRefreshToken
// CreateErr and RotateErr force a store failure.
CreateErr error
RotateErr error
// contains filtered or unexported fields
}
MockRefreshTokenStore is an in-memory RefreshTokenStore for tests.
It reproduces the rotation rules the real store enforces — spend on exchange, a grace window for concurrent callers, revoke the session on reuse — because those rules are what the handlers branch on. A mock that always succeeded would let a handler test pass while the endpoint handed a replayed credential a fresh session.
func (*MockRefreshTokenStore) Backdate ¶
func (m *MockRefreshTokenStore) Backdate(plaintext string, by time.Duration) bool
Backdate moves a spent token's used_at further into the past, so a test can put a token outside the rotation grace window without waiting for the clock. It reports whether the token was there to move.
func (*MockRefreshTokenStore) CountUserSessions ¶
func (*MockRefreshTokenStore) CreateRefreshToken ¶
func (m *MockRefreshTokenStore) CreateRefreshToken(_ context.Context, in model.NewRefreshToken) (string, int64, error)
func (*MockRefreshTokenStore) DeleteExpiredRefreshTokens ¶
func (*MockRefreshTokenStore) RevokeRefreshTokenSession ¶
func (*MockRefreshTokenStore) RevokeSession ¶
func (*MockRefreshTokenStore) RevokeUserSessions ¶
func (*MockRefreshTokenStore) RotateRefreshToken ¶
func (m *MockRefreshTokenStore) RotateRefreshToken(_ context.Context, plaintext string, now int64, ttl, grace time.Duration) (model.RotatedRefreshToken, error)
type MockRunOutputLister ¶
type MockRunOutputLister struct {
List []model.ArtifactWithTask
ListErr error
OutputFiles map[string][]model.TaskRunArtifact
}
MockRunOutputLister is an in-memory RunOutputLister for tests.
func (*MockRunOutputLister) GetTaskRunOutputFiles ¶
func (m *MockRunOutputLister) GetTaskRunOutputFiles(_ context.Context, taskRunID string) ([]model.TaskRunArtifact, error)
func (*MockRunOutputLister) ListRunOutputsByConversation ¶
func (m *MockRunOutputLister) ListRunOutputsByConversation(_ context.Context, conversationID string, taskID *string) ([]model.ArtifactWithTask, error)
type MockRunOutputStorage ¶
MockRunOutputStorage is an in-memory blob.RunOutputStorage for tests.
func NewMockRunOutputStorage ¶
func NewMockRunOutputStorage() *MockRunOutputStorage
NewMockRunOutputStorage returns a MockRunOutputStorage ready for use.
func (*MockRunOutputStorage) GetRunOutputFile ¶
func (m *MockRunOutputStorage) GetRunOutputFile(_ context.Context, ref blob.RunObjectRef) ([]byte, error)
func (*MockRunOutputStorage) PutRunOutputFile ¶
func (m *MockRunOutputStorage) PutRunOutputFile(_ context.Context, ref blob.RunObjectRef, r io.Reader) error
type MockSystemGrantStore ¶
type MockSystemGrantStore struct {
Grants []model.SystemGrant
// Err, when set, is returned by every read so a caller's behaviour on a
// store failure can be exercised. An authorization check that fails open
// on a database error is the bug worth having a test for.
Err error
}
MockSystemGrantStore is an in-memory model.SystemGrantStore for tests.
func (*MockSystemGrantStore) ActiveSystemRoles ¶
func (*MockSystemGrantStore) CountActiveSystemGrants ¶
func (*MockSystemGrantStore) GrantForTest ¶
func (m *MockSystemGrantStore) GrantForTest(userID, role string)
GrantForTest adds an active grant without going through the validation GrantSystemRole applies. Test setup, not a store method.
func (*MockSystemGrantStore) GrantSystemRole ¶
func (m *MockSystemGrantStore) GrantSystemRole(_ context.Context, userID, role, grantedBy string, now int64) (*model.SystemGrant, error)
func (*MockSystemGrantStore) ListSystemGrants ¶
func (m *MockSystemGrantStore) ListSystemGrants(_ context.Context, includeRevoked bool) ([]model.SystemGrant, error)
func (*MockSystemGrantStore) RevokeSystemRole ¶
type MockTaskRunStore ¶
type MockTaskRunStore struct {
Runs []model.TaskRun
TaskList []model.Task
// Artifacts holds the relative paths registered per run, so a test can
// check that a run's files were kept.
Artifacts map[string][]string
}
MockTaskRunStore is an in-memory TaskRunStore for tests.
func (*MockTaskRunStore) ClaimTaskRun ¶
func (m *MockTaskRunStore) ClaimTaskRun(ctx context.Context, in model.ClaimTaskRunInput) (bool, error)
func (*MockTaskRunStore) CountTaskRunsByStatus ¶
func (*MockTaskRunStore) CreateTaskRun ¶
func (m *MockTaskRunStore) CreateTaskRun(_ context.Context, in model.CreateTaskRunInput) (*model.TaskRun, error)
func (*MockTaskRunStore) GetActiveTaskRunByTask ¶
func (*MockTaskRunStore) GetNextPendingTaskRun ¶
func (*MockTaskRunStore) GetTaskRun ¶
func (*MockTaskRunStore) GetTaskRunWithTask ¶
func (*MockTaskRunStore) ListTaskRunIDsByTasks ¶
func (*MockTaskRunStore) OnRunComplete ¶
func (m *MockTaskRunStore) OnRunComplete(ctx context.Context, taskRunID string, relativePaths []string) error
OnRunComplete records the run's artifacts and copies its terminal state onto its task, which is what the real store does for every terminal status that leaves files behind.
func (*MockTaskRunStore) RequestTaskRunCancel ¶
func (*MockTaskRunStore) SyncTaskFromRun ¶
func (m *MockTaskRunStore) SyncTaskFromRun(_ context.Context, taskRunID string) error
SyncTaskFromRun copies the run's terminal state onto its task, which is what the real store does and what callers assert on after a cancel or a failure.
func (*MockTaskRunStore) UpdateRun ¶
func (m *MockTaskRunStore) UpdateRun(ctx context.Context, in model.UpdateTaskRunInput) error
func (*MockTaskRunStore) UpdateTaskRunWorkerInfo ¶
type MockTaskStore ¶
MockTaskStore is an in-memory TaskStore for tests.
func (*MockTaskStore) ClaimTask ¶
func (m *MockTaskStore) ClaimTask(_ context.Context, in model.ClaimTaskInput) (bool, error)
func (*MockTaskStore) CreateTask ¶
func (m *MockTaskStore) CreateTask(_ context.Context, in *model.CreateTaskInput) (*model.Task, error)
func (*MockTaskStore) GetTaskBySessionID ¶
func (*MockTaskStore) ListTasksByConversation ¶
func (*MockTaskStore) ListTasksByConversationPaginated ¶
func (*MockTaskStore) ListTasksByIssue ¶
func (*MockTaskStore) UpdateTask ¶
func (m *MockTaskStore) UpdateTask(_ context.Context, in model.UpdateTaskInput) error
type MockTeamStore ¶
type MockTeamStore struct {
Teams []model.Team
Members []model.TeamMember
}
MockTeamStore is an in-memory TeamStore for tests.
func (*MockTeamStore) AddTeamMember ¶
func (m *MockTeamStore) AddTeamMember(_ context.Context, teamID, userID, role string) (*model.TeamMember, error)
func (*MockTeamStore) CountTeamMembers ¶
func (*MockTeamStore) CreateTeam ¶
func (*MockTeamStore) GetPersonalTeamByUser ¶
func (*MockTeamStore) ListAllTeams ¶
func (*MockTeamStore) ListTeamMembers ¶
func (m *MockTeamStore) ListTeamMembers(_ context.Context, teamID string) ([]model.TeamMember, error)
func (*MockTeamStore) ListTeamsByUser ¶
func (*MockTeamStore) RemoveTeamMember ¶
func (m *MockTeamStore) RemoveTeamMember(_ context.Context, teamID, userID string) error
type MockTierStore ¶
MockTierStore returns a fixed tier for GetQuotaTier.
func (*MockTierStore) GetQuotaTier ¶
type MockUsageReader ¶
MockUsageReader returns fixed run count and token total for TeamUsageInWindow.
func (*MockUsageReader) TeamUsageInWindow ¶
type MockUserStore ¶
type MockUserStore struct {
ByEmail map[string]*model.User
ByID map[string]*model.User
CreateErr error
NextUserID int
}
MockUserStore is an in-memory UserStore for tests. Use ByEmail and ByID to pre-seed users; CreateErr and NextUserID for behavior.
func (*MockUserStore) CreateUser ¶
func (*MockUserStore) DisableForTest ¶
func (m *MockUserStore) DisableForTest(userID string, at int64)
DisableForTest disables a seeded account. Test setup, not a store method.
func (*MockUserStore) SetUserDisabled ¶
func (*MockUserStore) UpdateLoginMeta ¶
func (*MockUserStore) UserByEmail ¶
UserByEmail matches without regard to case, the way the real store's utf8mb4_0900_ai_ci email column does. Login resolves the account by address and nothing compares the two strings afterwards, so a case-sensitive mock would let a regression in that lookup pass here.
type MockUserWebhookKeyStore ¶
type MockUserWebhookKeyStore struct {
Keys map[string]string
Metas map[string][]model.WebhookKeyMeta
// contains filtered or unexported fields
}
MockUserWebhookKeyStore is an in-memory UserWebhookKeyStore for tests. Keys maps a plaintext key to the user that owns it.
func (*MockUserWebhookKeyStore) GetUserIDByKey ¶
func (*MockUserWebhookKeyStore) ListKeys ¶
func (m *MockUserWebhookKeyStore) ListKeys(_ context.Context, userID string) ([]model.WebhookKeyMeta, error)
type MockWorkflowStore ¶
type MockWorkflowStore struct {
Workflows []model.Workflow
Revisions []model.WorkflowRevision
Runs []model.WorkflowRun
StepRuns []model.WorkflowStepRun
}
MockWorkflowStore is an in-memory WorkflowStore for tests. It records revisions the way the database store does, so a test can assert on history.
func (*MockWorkflowStore) CreateWorkflow ¶
func (*MockWorkflowStore) CreateWorkflowRun ¶
func (m *MockWorkflowStore) CreateWorkflowRun(_ context.Context, in model.CreateWorkflowRunInput) (*model.WorkflowRun, error)
func (*MockWorkflowStore) CreateWorkflowStepRuns ¶
func (m *MockWorkflowStore) CreateWorkflowStepRuns(_ context.Context, workflowRunID string, steps []model.CreateWorkflowStepRunInput) ([]model.WorkflowStepRun, error)
func (*MockWorkflowStore) GetWorkflow ¶
func (*MockWorkflowStore) GetWorkflowRevision ¶
func (m *MockWorkflowStore) GetWorkflowRevision(_ context.Context, workflowID string, revision int) (*model.WorkflowRevision, error)
func (*MockWorkflowStore) GetWorkflowRun ¶
func (m *MockWorkflowStore) GetWorkflowRun(_ context.Context, workflowRunID string) (*model.WorkflowRun, error)
func (*MockWorkflowStore) GetWorkflowStepRunByTaskID ¶
func (m *MockWorkflowStore) GetWorkflowStepRunByTaskID(_ context.Context, taskID string) (*model.WorkflowStepRun, error)
func (*MockWorkflowStore) GetWorkflowStepRunByTaskRunID ¶
func (m *MockWorkflowStore) GetWorkflowStepRunByTaskRunID(_ context.Context, taskRunID string) (*model.WorkflowStepRun, error)
func (*MockWorkflowStore) ListWorkflowRevisions ¶
func (m *MockWorkflowStore) ListWorkflowRevisions(_ context.Context, workflowID string, limit, offset int) ([]model.WorkflowRevision, int, error)
func (*MockWorkflowStore) ListWorkflowRunsByIssue ¶
func (m *MockWorkflowStore) ListWorkflowRunsByIssue(_ context.Context, issueID string, limit, offset int) ([]model.WorkflowRun, int, error)
func (*MockWorkflowStore) ListWorkflowRunsByWorkflow ¶
func (m *MockWorkflowStore) ListWorkflowRunsByWorkflow(_ context.Context, workflowID string, limit, offset int) ([]model.WorkflowRun, int, error)
func (*MockWorkflowStore) ListWorkflowStepRuns ¶
func (m *MockWorkflowStore) ListWorkflowStepRuns(_ context.Context, workflowRunID string) ([]model.WorkflowStepRun, error)
func (*MockWorkflowStore) ListWorkflowsByTeam ¶
func (*MockWorkflowStore) UpdateWorkflow ¶
func (m *MockWorkflowStore) UpdateWorkflow(_ context.Context, workflowID, teamID string, in model.UpdateWorkflowInput) (*model.Workflow, error)
func (*MockWorkflowStore) UpdateWorkflowRun ¶
func (m *MockWorkflowStore) UpdateWorkflowRun(_ context.Context, workflowRunID string, in model.UpdateWorkflowRunInput) (*model.WorkflowRun, error)
func (*MockWorkflowStore) UpdateWorkflowStepRun ¶
func (m *MockWorkflowStore) UpdateWorkflowStepRun(_ context.Context, stepRunID string, in model.UpdateWorkflowStepRunInput) (*model.WorkflowStepRun, error)