Documentation
¶
Overview ¶
Adding to the Connector
The Connector is a very large interface that defines how to access the main state of the database and data central to Evergreen's function. All methods of the Connector are contained in the data package in files depending on the main type they allow access to (i.e. all test access is contained in data/test.go).
Extending Connector should only be done when the desired functionality cannot be performed using a combination of the methods it already contains or when such combination would be unseemingly slow or expensive.
To add to the Connector, add the method signature into the interface in data/data.go. Next, add the implementation that interacts with the database to the database backed object. These objects are named by the resource they allow access to. The object that allows access to Hosts is called DBHostConnector. Finally, add a mock implementation to the mock object. For Hosts again, this object would be called MockHostConnector.
Implementing database backed methods requires using methods in Evergreen's model package. As much database specific information as possible should be kept out of the these methods. For example, if a new aggregation pipeline is needed to complete the request, it should be defined in the Evergreen model package and used only to aggregate in the method.
Index ¶
- func FindRecentTaskList(minutes int, key string) (*model.APIRecentTaskStatsList, error)
- func LogConfigChanges(newSettings *evergreen.Settings, oldSettings *evergreen.Settings, ...) error
- type CLIUpdateConnector
- type Connector
- type DBAdminConnector
- func (ac *DBAdminConnector) GetAdminEventLog(before time.Time, n int) ([]restModel.APIAdminEvent, error)
- func (ac *DBAdminConnector) GetBanner() (string, string, error)
- func (ac *DBAdminConnector) GetEvergreenSettings() (*evergreen.Settings, error)
- func (ac *DBAdminConnector) MapLDAPGroupToRole(group, roleID string) error
- func (ac *DBAdminConnector) RestartFailedCommitQueueVersions(opts model.RestartOptions) (*restModel.RestartResponse, error)
- func (ac *DBAdminConnector) RestartFailedTasks(queue amboy.Queue, opts model.RestartOptions) (*restModel.RestartResponse, error)
- func (ac *DBAdminConnector) RevertConfigTo(guid string, user string) error
- func (ac *DBAdminConnector) SetAdminBanner(text string, u *user.DBUser) error
- func (ac *DBAdminConnector) SetBannerTheme(themeString string, u *user.DBUser) error
- func (ac *DBAdminConnector) SetEvergreenSettings(changes *restModel.APIAdminSettings, oldSettings *evergreen.Settings, ...) (*evergreen.Settings, error)
- func (ac *DBAdminConnector) SetServiceFlags(flags evergreen.ServiceFlags, u *user.DBUser) error
- func (ac *DBAdminConnector) UnmapLDAPGroupToRole(group string) error
- type DBAliasConnector
- func (d *DBAliasConnector) CopyProjectAliases(oldProjectId, newProjectId string) error
- func (d *DBAliasConnector) FindProjectAliases(projectId string) ([]restModel.APIProjectAlias, error)
- func (d *DBAliasConnector) HasMatchingGitTagAliasAndRemotePath(projectId, tag string) (bool, string, error)
- func (d *DBAliasConnector) UpdateProjectAliases(projectId string, aliases []restModel.APIProjectAlias) error
- type DBBuildConnector
- func (bc *DBBuildConnector) AbortBuild(buildId string, user string) error
- func (bc *DBBuildConnector) FindBuildById(buildId string) (*build.Build, error)
- func (bc *DBBuildConnector) RestartBuild(buildId string, user string) error
- func (bc *DBBuildConnector) SetBuildActivated(buildId string, user string, activated bool) error
- func (bc *DBBuildConnector) SetBuildPriority(buildId string, priority int64, caller string) error
- type DBCommitQueueConnector
- func (pc *DBCommitQueueConnector) CommitQueueClearAll() (int, error)
- func (pc *DBCommitQueueConnector) CommitQueueRemoveItem(id, issue, user string) (bool, error)
- func (pc *DBCommitQueueConnector) EnqueueItem(projectID string, item restModel.APICommitQueueItem, enqueueNext bool) (int, error)
- func (pc *DBCommitQueueConnector) FindCommitQueueByID(id string) (*restModel.APICommitQueue, error)
- func (pc *DBCommitQueueConnector) GetGitHubPR(ctx context.Context, owner, repo string, PRNum int) (*github.PullRequest, error)
- func (pc *DBCommitQueueConnector) IsAuthorizedToPatchAndMerge(ctx context.Context, settings *evergreen.Settings, args UserRepoInfo) (bool, error)
- func (pc *DBCommitQueueConnector) IsItemOnCommitQueue(id, item string) (bool, error)
- type DBConnector
- type DBContextConnector
- type DBCreateHostConnector
- func (dc *DBCreateHostConnector) CreateHostsFromTask(t *task.Task, user user.DBUser, keyNameOrVal string) error
- func (dc *DBCreateHostConnector) GetDockerLogs(ctx context.Context, containerId string, parent *host.Host, ...) (io.Reader, error)
- func (db *DBCreateHostConnector) GetDockerStatus(ctx context.Context, containerId string, parent *host.Host, ...) (*cloud.ContainerStatus, error)
- func (dc *DBCreateHostConnector) ListHostsForTask(ctx context.Context, taskID string) ([]host.Host, error)
- func (dc *DBCreateHostConnector) MakeIntentHost(taskID, userID, publicKey string, createHost apimodels.CreateHost) (*host.Host, error)
- type DBDistroConnector
- func (tc *DBDistroConnector) ClearTaskQueue(distroId string) error
- func (dc *DBDistroConnector) CreateDistro(distro *distro.Distro) error
- func (dc *DBDistroConnector) DeleteDistroById(distroId string) error
- func (dc *DBDistroConnector) FindAllDistros() ([]distro.Distro, error)
- func (tc *DBDistroConnector) FindCostByDistroId(distroId string, starttime time.Time, duration time.Duration) (*task.DistroCost, error)
- func (dc *DBDistroConnector) FindDistroById(distroId string) (*distro.Distro, error)
- func (dc *DBDistroConnector) UpdateDistro(old, new *distro.Distro) error
- type DBHostConnector
- func (hc *DBHostConnector) AggregateSpawnhostData() (*host.SpawnHostUsage, error)
- func (hc *DBHostConnector) CheckHostSecret(hostID string, r *http.Request) (int, error)
- func (hc *DBHostConnector) FindHostById(id string) (*host.Host, error)
- func (hc *DBHostConnector) FindHostWithVolume(volumeID string) (*host.Host, error)
- func (hc *DBHostConnector) FindHostsByDistro(distro string) ([]host.Host, error)
- func (hc *DBHostConnector) FindHostsById(id, status, user string, limit int) ([]host.Host, error)
- func (hc *DBHostConnector) FindHostsInRange(apiParams restmodel.APIHostParams, username string) ([]host.Host, error)
- func (hc *DBHostConnector) FindVolumeById(volumeID string) (*host.Volume, error)
- func (hc *DBHostConnector) FindVolumesByUser(user string) ([]host.Volume, error)
- func (hc *DBHostConnector) NewIntentHost(ctx context.Context, options *restmodel.HostRequestOptions, user *user.DBUser, ...) (*host.Host, error)
- func (hc *DBHostConnector) SetHostExpirationTime(host *host.Host, newExp time.Time) error
- func (hc *DBHostConnector) SetHostStatus(host *host.Host, status, user string) error
- func (hc *DBHostConnector) SetVolumeName(v *host.Volume, name string) error
- func (hc *DBHostConnector) TerminateHost(ctx context.Context, host *host.Host, user string) error
- type DBPatchConnector
- func (pc *DBPatchConnector) AbortPatch(patchId string, user string) error
- func (p *DBPatchConnector) AbortPatchesFromPullRequest(event *github.PullRequestEvent) error
- func (pc *DBPatchConnector) FindPatchById(patchId string) (*restModel.APIPatch, error)
- func (pc *DBPatchConnector) FindPatchesByIds(patchIds []string) ([]restModel.APIPatch, error)
- func (pc *DBPatchConnector) FindPatchesByProject(projectId string, ts time.Time, limit int) ([]restModel.APIPatch, error)
- func (pc *DBPatchConnector) FindPatchesByUser(user string, ts time.Time, limit int) ([]restModel.APIPatch, error)
- func (pc *DBPatchConnector) FindPatchesByUserPatchNameStatusesCommitQueue(user string, patchName string, statuses []string, includeCommitQueue bool, ...) ([]restModel.APIPatch, *int, error)
- func (p *DBPatchConnector) IsPatchEmpty(id string) (bool, error)
- func (pc *DBPatchConnector) SetPatchActivated(ctx context.Context, patchId string, user string, activated bool, ...) error
- func (pc *DBPatchConnector) SetPatchPriority(patchId string, priority int64, caller string) error
- type DBPatchIntentConnector
- type DBProjectConnector
- func (pc *DBProjectConnector) CopyProjectVars(oldProjectId, newProjectId string) error
- func (pc *DBProjectConnector) CreateProject(projectRef *model.ProjectRef, u *user.DBUser) error
- func (pc *DBProjectConnector) EnableCommitQueue(projectRef *model.ProjectRef, commitQueueParams model.CommitQueueParams) error
- func (pc *DBProjectConnector) EnablePRTesting(projectRef *model.ProjectRef) error
- func (pc *DBProjectConnector) EnableWebhooks(ctx context.Context, projectRef *model.ProjectRef) (bool, error)
- func (ac *DBProjectConnector) FindEnabledProjectRefsByOwnerAndRepo(owner, repo string) ([]model.ProjectRef, error)
- func (pc *DBProjectConnector) FindProjectById(id string) (*model.ProjectRef, error)
- func (pc *DBProjectConnector) FindProjectVarsById(id string, redact bool) (*restModel.APIProjectVars, error)
- func (pc *DBProjectConnector) FindProjects(key string, limit int, sortDir int) ([]model.ProjectRef, error)
- func (ac *DBProjectConnector) GetProjectEventLog(id string, before time.Time, n int) ([]restModel.APIProjectEvent, error)
- func (pc *DBProjectConnector) GetProjectFromFile(ctx context.Context, pRef model.ProjectRef, file string, token string) (*model.Project, *model.ParserProject, error)
- func (pc *DBProjectConnector) GetProjectSettingsEvent(p *model.ProjectRef) (*model.ProjectSettingsEvent, error)
- func (ac *DBProjectConnector) GetProjectWithCommitQueueByOwnerRepoAndBranch(owner, repo, branch string) (*model.ProjectRef, error)
- func (ac *DBProjectConnector) GetVersionsInProject(project, requester string, limit, startOrder int) ([]restModel.APIVersion, error)
- func (pc *DBProjectConnector) UpdateAdminRoles(project *model.ProjectRef, toAdd, toDelete []string) error
- func (pc *DBProjectConnector) UpdateProject(projectRef *model.ProjectRef) error
- func (pc *DBProjectConnector) UpdateProjectRevision(projectID, revision string) error
- func (pc *DBProjectConnector) UpdateProjectVars(projectId string, varsModel *restModel.APIProjectVars, overwrite bool) error
- type DBProjectTagConnector
- type DBStatusConnector
- func (c *DBStatusConnector) FindRecentTaskListAgentVersion(minutes int) (*model.APIRecentTaskStatsList, error)
- func (c *DBStatusConnector) FindRecentTaskListDistro(minutes int) (*model.APIRecentTaskStatsList, error)
- func (c *DBStatusConnector) FindRecentTaskListProject(minutes int) (*model.APIRecentTaskStatsList, error)
- func (c *DBStatusConnector) FindRecentTasks(minutes int) ([]task.Task, *task.ResultCounts, error)
- func (c *DBStatusConnector) GetHostStatsByDistro() ([]host.StatsByDistro, error)
- type DBSubscriptionConnector
- func (dc *DBSubscriptionConnector) CopyProjectSubscriptions(oldProject, newProject string) error
- func (dc *DBSubscriptionConnector) DeleteSubscriptions(owner string, ids []string) error
- func (dc *DBSubscriptionConnector) GetSubscriptions(owner string, ownerType event.OwnerType) ([]restModel.APISubscription, error)
- func (dc *DBSubscriptionConnector) SaveSubscriptions(owner string, subscriptions []restModel.APISubscription) error
- type DBTaskConnector
- func (tc *DBTaskConnector) AbortTask(taskId string, user string) error
- func (tc *DBTaskConnector) CheckTaskSecret(taskID string, r *http.Request) (int, error)
- func (tc *DBTaskConnector) FindCostTaskByProject(project, taskId string, starttime, endtime time.Time, limit, sortDir int) ([]task.Task, error)
- func (tc *DBTaskConnector) FindOldTasksByIDWithDisplayTasks(id string) ([]task.Task, error)
- func (tc *DBTaskConnector) FindTaskById(taskId string) (*task.Task, error)
- func (tc *DBTaskConnector) FindTaskWithinTimePeriod(startedAfter, finishedBefore time.Time, project string, statuses []string) ([]task.Task, error)
- func (tc *DBTaskConnector) FindTasksByBuildId(buildId, taskId, status string, limit int, sortDir int) ([]task.Task, error)
- func (tc *DBTaskConnector) FindTasksByIds(ids []string) ([]task.Task, error)
- func (tc *DBTaskConnector) FindTasksByProjectAndCommit(projectId, commitHash, taskId, status string, limit int) ([]task.Task, error)
- func (tc *DBTaskConnector) FindTasksByVersion(versionID, sortBy string, statuses []string, variant string, taskName string, ...) ([]task.Task, int, error)
- func (tc *DBTaskConnector) GetManifestByTask(taskId string) (*manifest.Manifest, error)
- func (tc *DBTaskConnector) ResetTask(taskId, username string) error
- func (tc *DBTaskConnector) SetTaskActivated(taskId, user string, activated bool) error
- func (tc *DBTaskConnector) SetTaskPriority(t *task.Task, user string, priority int64) error
- type DBTestConnector
- func (tc *DBTestConnector) FindTestsByTaskId(taskId, testId, testName, status string, limit, execution int) ([]testresult.TestResult, error)
- func (tc *DBTestConnector) FindTestsByTaskIdFilterSortPaginate(taskId, testName string, statuses []string, sortBy string, ...) ([]testresult.TestResult, error)
- func (tc *DBTestConnector) GetTestCountByTaskIdAndFilters(taskId, testName string, statuses []string, execution int) (int, error)
- type DBUserConnector
- func (u *DBUserConnector) AddPublicKey(user *user.DBUser, keyName, keyValue string) error
- func (u *DBUserConnector) DeletePublicKey(user *user.DBUser, keyName string) error
- func (tc *DBUserConnector) FindUserByGithubName(name string) (gimlet.User, error)
- func (tc *DBUserConnector) FindUserById(userId string) (gimlet.User, error)
- func (u *DBUserConnector) SubmitFeedback(in restModel.APIFeedbackSubmission) error
- func (u *DBUserConnector) UpdateSettings(dbUser *user.DBUser, settings user.UserSettings) error
- type DBVersionConnector
- func (vc *DBVersionConnector) AbortVersion(versionId, caller string) error
- func (vc *DBVersionConnector) AddGitTagToVersion(versionId string, gitTag model.GitTag) error
- func (vc *DBVersionConnector) CreateVersionFromConfig(ctx context.Context, projectInfo *model.ProjectInfo, ...) (*model.Version, error)
- func (vc *DBVersionConnector) FindCostByVersionId(versionId string) (*task.VersionCost, error)
- func (vc *DBVersionConnector) FindVersionById(versionId string) (*model.Version, error)
- func (vc *DBVersionConnector) FindVersionByProjectAndRevision(projectId, revision string) (*model.Version, error)
- func (vc *DBVersionConnector) GetVersionsAndVariants(skip, numVersionElements int, project *model.Project) (*restModel.VersionVariantData, error)
- func (bc *DBVersionConnector) LoadProjectForVersion(v *model.Version, projectId string) (*model.Project, *model.ParserProject, error)
- func (vc *DBVersionConnector) RestartVersion(versionId string, caller string) error
- type GenerateConnector
- type MockAdminConnector
- func (ac *MockAdminConnector) GetAdminEventLog(before time.Time, n int) ([]restModel.APIAdminEvent, error)
- func (ac *MockAdminConnector) GetBanner() (string, string, error)
- func (ac *MockAdminConnector) GetEvergreenSettings() (*evergreen.Settings, error)
- func (ac *MockAdminConnector) MapLDAPGroupToRole(group, roleID string) error
- func (ac *MockAdminConnector) RestartFailedCommitQueueVersions(opts model.RestartOptions) (*restModel.RestartResponse, error)
- func (ac *MockAdminConnector) RestartFailedTasks(queue amboy.Queue, opts model.RestartOptions) (*restModel.RestartResponse, error)
- func (ac *MockAdminConnector) RevertConfigTo(guid string, user string) error
- func (ac *MockAdminConnector) SetAdminBanner(text string, u *user.DBUser) error
- func (ac *MockAdminConnector) SetBannerTheme(themeString string, u *user.DBUser) error
- func (ac *MockAdminConnector) SetEvergreenSettings(changes *restModel.APIAdminSettings, oldSettings *evergreen.Settings, ...) (*evergreen.Settings, error)
- func (ac *MockAdminConnector) SetServiceFlags(flags evergreen.ServiceFlags, u *user.DBUser) error
- func (ac *MockAdminConnector) UnmapLDAPGroupToRole(group string) error
- type MockAliasConnector
- func (d *MockAliasConnector) CopyProjectAliases(oldProjectId, newProjectId string) error
- func (d *MockAliasConnector) FindProjectAliases(projectId string) ([]restModel.APIProjectAlias, error)
- func (d *MockAliasConnector) HasMatchingGitTagAliasAndRemotePath(projectId, tag string) (bool, string, error)
- func (d *MockAliasConnector) UpdateProjectAliases(projectId string, aliases []restModel.APIProjectAlias) error
- type MockBuildConnector
- func (bc *MockBuildConnector) AbortBuild(buildId string, user string) error
- func (bc *MockBuildConnector) FindBuildById(buildId string) (*build.Build, error)
- func (bc *MockBuildConnector) RestartBuild(buildId string, user string) error
- func (bc *MockBuildConnector) SetBuildActivated(buildId string, user string, activated bool) error
- func (bc *MockBuildConnector) SetBuildPriority(buildId string, priority int64, caller string) error
- type MockCLIUpdateConnector
- type MockCommitQueueConnector
- func (pc *MockCommitQueueConnector) CommitQueueClearAll() (int, error)
- func (pc *MockCommitQueueConnector) CommitQueueRemoveItem(id, item, user string) (bool, error)
- func (pc *MockCommitQueueConnector) EnqueueItem(projectID string, item restModel.APICommitQueueItem, enqueueNext bool) (int, error)
- func (pc *MockCommitQueueConnector) FindCommitQueueByID(id string) (*restModel.APICommitQueue, error)
- func (pc *MockCommitQueueConnector) GetGitHubPR(ctx context.Context, owner, repo string, PRNum int) (*github.PullRequest, error)
- func (pc *MockCommitQueueConnector) IsAuthorizedToPatchAndMerge(context.Context, *evergreen.Settings, UserRepoInfo) (bool, error)
- func (pc *MockCommitQueueConnector) IsItemOnCommitQueue(id, item string) (bool, error)
- type MockConnector
- func (hc *MockConnector) AggregateSpawnhostData() (*host.SpawnHostUsage, error)
- func (dbc *MockConnector) FindHostByIdWithOwner(hostID string, user gimlet.User) (*host.Host, error)
- func (hc *MockConnector) FindHostWithVolume(volumeID string) (*host.Host, error)
- func (hc *MockConnector) FindVolumeById(volumeID string) (*host.Volume, error)
- func (hc *MockConnector) FindVolumesByUser(user string) ([]host.Volume, error)
- func (ctx *MockConnector) GetPrefix() string
- func (ctx *MockConnector) GetURL() string
- func (ctx *MockConnector) SetPrefix(prefix string)
- func (ctx *MockConnector) SetURL(url string)
- func (hc *MockConnector) SetVolumeName(volume *host.Volume, name string) error
- type MockContextConnector
- type MockCreateHostConnector
- func (*MockCreateHostConnector) CreateHostsFromTask(t *task.Task, user user.DBUser, keyNameOrVal string) error
- func (dc *MockCreateHostConnector) GetDockerLogs(ctx context.Context, containerId string, parent *host.Host, ...) (io.Reader, error)
- func (dc *MockCreateHostConnector) GetDockerStatus(ctx context.Context, containerId string, parent *host.Host, ...) (*cloud.ContainerStatus, error)
- func (*MockCreateHostConnector) ListHostsForTask(ctx context.Context, taskID string) ([]host.Host, error)
- func (*MockCreateHostConnector) MakeIntentHost(taskID, userID, publicKey string, createHost apimodels.CreateHost) (*host.Host, error)
- type MockDistroConnector
- func (mdc *MockDistroConnector) ClearTaskQueue(distroId string) error
- func (mdc *MockDistroConnector) CreateDistro(distro *distro.Distro) error
- func (mdc *MockDistroConnector) DeleteDistroById(distroId string) error
- func (mdc *MockDistroConnector) FindAllDistros() ([]distro.Distro, error)
- func (mdc *MockDistroConnector) FindCostByDistroId(distroId string, starttime time.Time, duration time.Duration) (*task.DistroCost, error)
- func (mdc *MockDistroConnector) FindDistroById(distroId string) (*distro.Distro, error)
- func (mdc *MockDistroConnector) UpdateDistro(old, new *distro.Distro) error
- type MockGenerateConnector
- type MockHostConnector
- func (hc *MockHostConnector) CheckHostSecret(hostID string, r *http.Request) (int, error)
- func (hc *MockHostConnector) FindHostById(id string) (*host.Host, error)
- func (hc *MockHostConnector) FindHostsByDistro(distro string) ([]host.Host, error)
- func (hc *MockHostConnector) FindHostsById(id, status, user string, limit int) ([]host.Host, error)
- func (hc *MockHostConnector) FindHostsByIdOnly(id, status, user string, limit int) ([]host.Host, error)
- func (hc *MockHostConnector) FindHostsInRange(params restmodel.APIHostParams, username string) ([]host.Host, error)
- func (hc *MockHostConnector) NewIntentHost(ctx context.Context, options *restmodel.HostRequestOptions, user *user.DBUser, ...) (*host.Host, error)
- func (hc *MockHostConnector) SetHostExpirationTime(host *host.Host, newExp time.Time) error
- func (hc *MockHostConnector) SetHostStatus(host *host.Host, status, user string) error
- func (hc *MockHostConnector) TerminateHost(ctx context.Context, host *host.Host, user string) error
- type MockNotificationConnector
- type MockPatchConnector
- func (pc *MockPatchConnector) AbortPatch(patchId string, user string) error
- func (c *MockPatchConnector) AbortPatchesFromPullRequest(event *github.PullRequestEvent) error
- func (pc *MockPatchConnector) FindPatchById(patchId string) (*restModel.APIPatch, error)
- func (pc *MockPatchConnector) FindPatchesByIds(patchIds []string) ([]restModel.APIPatch, error)
- func (hp *MockPatchConnector) FindPatchesByProject(projectId string, ts time.Time, limit int) ([]restModel.APIPatch, error)
- func (hp *MockPatchConnector) FindPatchesByUser(user string, ts time.Time, limit int) ([]restModel.APIPatch, error)
- func (hp *MockPatchConnector) FindPatchesByUserPatchNameStatusesCommitQueue(user string, patchName string, statuses []string, includeCommitQueue bool, ...) ([]restModel.APIPatch, *int, error)
- func (pc *MockPatchConnector) IsPatchEmpty(id string) (bool, error)
- func (pc *MockPatchConnector) SetPatchActivated(ctx context.Context, patchId string, user string, activated bool, ...) error
- func (pc *MockPatchConnector) SetPatchPriority(patchId string, priority int64, caller string) error
- type MockPatchIntentConnector
- type MockPatchIntentKey
- type MockProjectConnector
- func (pc *MockProjectConnector) CopyProjectVars(oldProjectId, newProjectId string) error
- func (pc *MockProjectConnector) CreateProject(projectRef *model.ProjectRef, u *user.DBUser) error
- func (pc *MockProjectConnector) EnableCommitQueue(projectRef *model.ProjectRef, commitQueueParams model.CommitQueueParams) error
- func (pc *MockProjectConnector) EnablePRTesting(projectRef *model.ProjectRef) error
- func (pc *MockProjectConnector) EnableWebhooks(ctx context.Context, projectRef *model.ProjectRef) (bool, error)
- func (pc *MockProjectConnector) FindEnabledProjectRefsByOwnerAndRepo(owner, repo string) ([]model.ProjectRef, error)
- func (pc *MockProjectConnector) FindProjectById(projectId string) (*model.ProjectRef, error)
- func (pc *MockProjectConnector) FindProjectVarsById(id string, redact bool) (*restModel.APIProjectVars, error)
- func (pc *MockProjectConnector) FindProjects(key string, limit int, sortDir int) ([]model.ProjectRef, error)
- func (pc *MockProjectConnector) GetProjectEventLog(id string, before time.Time, n int) ([]restModel.APIProjectEvent, error)
- func (pc *MockProjectConnector) GetProjectFromFile(ctx context.Context, pRef model.ProjectRef, file string, token string) (*model.Project, *model.ParserProject, error)
- func (pc *MockProjectConnector) GetProjectSettingsEvent(p *model.ProjectRef) (*model.ProjectSettingsEvent, error)
- func (pc *MockProjectConnector) GetProjectWithCommitQueueByOwnerRepoAndBranch(owner, repo, branch string) (*model.ProjectRef, error)
- func (ac *MockProjectConnector) GetVersionsInProject(project, requester string, limit, startOrder int) ([]restModel.APIVersion, error)
- func (pc *MockProjectConnector) UpdateAdminRoles(project *model.ProjectRef, toAdd, toDelete []string) error
- func (pc *MockProjectConnector) UpdateProject(projectRef *model.ProjectRef) error
- func (pc *MockProjectConnector) UpdateProjectRevision(projectID, revision string) error
- func (pc *MockProjectConnector) UpdateProjectVars(projectId string, varsModel *restModel.APIProjectVars, overwrite bool) error
- type MockProjectTagConnector
- type MockRepoTrackerConnector
- type MockStatsConnector
- func (msc *MockStatsConnector) GetTaskStats(filter stats.StatsFilter) ([]model.APITaskStats, error)
- func (msc *MockStatsConnector) GetTestStats(filter stats.StatsFilter) ([]model.APITestStats, error)
- func (msc *MockStatsConnector) SetTaskStats(baseTaskName string, numStats int)
- func (msc *MockStatsConnector) SetTestStats(baseTestName string, numStats int)
- type MockStatusConnector
- func (c *MockStatusConnector) FindRecentTaskListAgentVersion(minutes int) (*model.APIRecentTaskStatsList, error)
- func (c *MockStatusConnector) FindRecentTaskListDistro(minutes int) (*model.APIRecentTaskStatsList, error)
- func (c *MockStatusConnector) FindRecentTaskListProject(minutes int) (*model.APIRecentTaskStatsList, error)
- func (c *MockStatusConnector) FindRecentTasks(minutes int) ([]task.Task, *task.ResultCounts, error)
- func (c *MockStatusConnector) GetHostStatsByDistro() ([]host.StatsByDistro, error)
- type MockSubscriptionConnector
- func (mc *MockSubscriptionConnector) CopyProjectSubscriptions(oldProject, newProject string) error
- func (mc *MockSubscriptionConnector) DeleteSubscriptions(owner string, ids []string) error
- func (mc *MockSubscriptionConnector) GetSubscriptions(owner string, ownerType event.OwnerType) ([]restModel.APISubscription, error)
- func (mc *MockSubscriptionConnector) SaveSubscriptions(owner string, subscriptions []restModel.APISubscription) error
- type MockTaskConnector
- func (tc *MockTaskConnector) AbortTask(taskId, user string) error
- func (tc *MockTaskConnector) CheckTaskSecret(taskID string, r *http.Request) (int, error)
- func (mtc *MockTaskConnector) FindCostTaskByProject(project, taskId string, starttime, endtime time.Time, limit, sortDir int) ([]task.Task, error)
- func (mtc *MockTaskConnector) FindOldTasksByIDWithDisplayTasks(id string) ([]task.Task, error)
- func (mtc *MockTaskConnector) FindTaskById(taskId string) (*task.Task, error)
- func (mtc *MockTaskConnector) FindTaskWithinTimePeriod(startedAfter, finishedBefore time.Time, project string, status []string) ([]task.Task, error)
- func (mtc *MockTaskConnector) FindTasksByBuildId(buildId, startTaskId, status string, limit, sortDir int) ([]task.Task, error)
- func (mtc *MockTaskConnector) FindTasksByIds(taskIds []string) ([]task.Task, error)
- func (mtc *MockTaskConnector) FindTasksByProjectAndCommit(projectId, commitHash, taskId, status string, limit int) ([]task.Task, error)
- func (tc *MockTaskConnector) FindTasksByVersion(versionID, sortBy string, statuses []string, variant string, taskName string, ...) ([]task.Task, int, error)
- func (tc *MockTaskConnector) GetManifestByTask(taskId string) (*manifest.Manifest, error)
- func (mtc *MockTaskConnector) ResetTask(taskId, username string) error
- func (mtc *MockTaskConnector) SetTaskActivated(taskId, user string, activated bool) error
- func (mtc *MockTaskConnector) SetTaskPriority(it *task.Task, user string, priority int64) error
- type MockTaskReliabilityConnector
- type MockTestConnector
- func (mtc *MockTestConnector) FindTestsByTaskId(taskId, testId, testName, status string, limit, execution int) ([]testresult.TestResult, error)
- func (tc *MockTestConnector) FindTestsByTaskIdFilterSortPaginate(taskId, filter string, statuses []string, sortBy string, ...) ([]testresult.TestResult, error)
- func (tc *MockTestConnector) GetTestCountByTaskIdAndFilters(taskId, testName string, statuses []string, execution int) (int, error)
- type MockUserConnector
- func (muc *MockUserConnector) AddPublicKey(dbuser *user.DBUser, keyName, keyValue string) error
- func (muc *MockUserConnector) DeletePublicKey(u *user.DBUser, keyName string) error
- func (muc *MockUserConnector) FindUserByGithubName(name string) (gimlet.User, error)
- func (muc *MockUserConnector) FindUserById(userId string) (gimlet.User, error)
- func (u *MockUserConnector) SubmitFeedback(feedback restModel.APIFeedbackSubmission) error
- func (muc *MockUserConnector) UpdateSettings(user *user.DBUser, settings user.UserSettings) error
- type MockVersionConnector
- func (mvc *MockVersionConnector) AbortVersion(versionId, caller string) error
- func (mvc *MockVersionConnector) AddGitTagToVersion(versionId string, gitTag model.GitTag) error
- func (mvc *MockVersionConnector) CreateVersionFromConfig(ctx context.Context, projectInfo *model.ProjectInfo, ...) (*model.Version, error)
- func (mvc *MockVersionConnector) FindCostByVersionId(versionId string) (*task.VersionCost, error)
- func (mvc *MockVersionConnector) FindVersionById(versionId string) (*model.Version, error)
- func (mvc *MockVersionConnector) FindVersionByProjectAndRevision(projectId, revision string) (*model.Version, error)
- func (mvc *MockVersionConnector) GetVersionsAndVariants(skip, numVersionElements int, project *model.Project) (*restModel.VersionVariantData, error)
- func (mvc *MockVersionConnector) LoadProjectForVersion(v *model.Version, projectId string) (*model.Project, *model.ParserProject, error)
- func (mvc *MockVersionConnector) RestartVersion(versionId string, caller string) error
- type NotificationConnector
- type RepoTrackerConnector
- type StatsConnector
- type TaskReliabilityConnector
- type UserRepoInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindRecentTaskList ¶
func FindRecentTaskList(minutes int, key string) (*model.APIRecentTaskStatsList, error)
Types ¶
type CLIUpdateConnector ¶
type CLIUpdateConnector struct{}
func (*CLIUpdateConnector) GetCLIUpdate ¶
func (c *CLIUpdateConnector) GetCLIUpdate() (*model.APICLIUpdate, error)
type Connector ¶
type Connector interface {
// Get and Set URL provide access to the main url string of the API.
GetURL() string
SetURL(string)
// Get and Set Prefix provide access to the prefix that prepends all of the
// URL paths.
GetPrefix() string
SetPrefix(string)
// FindTaskById is a method to find a specific task given its ID.
FindTaskById(string) (*task.Task, error)
FindTaskWithinTimePeriod(time.Time, time.Time, string, []string) ([]task.Task, error)
FindOldTasksByIDWithDisplayTasks(string) ([]task.Task, error)
FindTasksByIds([]string) ([]task.Task, error)
SetTaskPriority(*task.Task, string, int64) error
SetTaskActivated(string, string, bool) error
ResetTask(string, string) error
AbortTask(string, string) error
CheckTaskSecret(string, *http.Request) (int, error)
// FindTasksByBuildId is a method to find a set of tasks which all have the same
// BuildId. It takes the buildId being queried for as its first parameter,
// as well as a taskId, status, and limit for paginating through the results.
FindTasksByBuildId(string, string, string, int, int) ([]task.Task, error)
// FindBuildById is a method to find the build matching the same BuildId.
FindBuildById(string) (*build.Build, error)
// GetManifestByTask is a method to get the manifest for the given task.
GetManifestByTask(string) (*manifest.Manifest, error)
// SetBuildPriority and SetBuildActivated change the status of the input build
SetBuildPriority(string, int64, string) error
SetBuildActivated(string, string, bool) error
// AbortBuild is a method to abort the build matching the same BuildId.
AbortBuild(string, string) error
// RestartBuild is a method to restart the build matching the same BuildId.
RestartBuild(string, string) error
// Find project variables matching given projectId. If bool is set, also return private variables.
FindProjectVarsById(string, bool) (*restModel.APIProjectVars, error)
// UpdateProjectVars updates the project using the variables given
// in the model (removing old variables if overwrite is set).
// If successful, updates the given projectVars with the updated projectVars.
UpdateProjectVars(string, *restModel.APIProjectVars, bool) error
// CopyProjectVars copies the variables for the first project to the second
CopyProjectVars(string, string) error
// Find the project matching the given ProjectId.
FindProjectById(string) (*model.ProjectRef, error)
// Create/Update a project the given projectRef
CreateProject(*model.ProjectRef, *user.DBUser) error
UpdateProject(*model.ProjectRef) error
// GetProjectFromFile finds the file for the projectRef and returns the translated project, using the given token
GetProjectFromFile(context.Context, model.ProjectRef, string, string) (*model.Project, *model.ParserProject, error)
// EnableWebhooks creates a webhook for the project's owner/repo if one does not exist.
// If unable to setup the new webhook, returns false but no error.
EnableWebhooks(context.Context, *model.ProjectRef) (bool, error)
// EnablePRTesting determines if PR testing can be enabled for the given project.
EnablePRTesting(*model.ProjectRef) error
// UpdateProjectRevision updates the given project's revision
UpdateProjectRevision(string, string) error
// FindProjects is a method to find projects as ordered by name
FindProjects(string, int, int) ([]model.ProjectRef, error)
GetProjectWithCommitQueueByOwnerRepoAndBranch(string, string, string) (*model.ProjectRef, error)
FindEnabledProjectRefsByOwnerAndRepo(string, string) ([]model.ProjectRef, error)
FindProjectsByTag(string) ([]restModel.APIProjectRef, error)
AddTagsToProject(string, ...string) error
RemoveTagFromProject(string, string) error
// GetVersionsAndVariants returns recent versions for a project
GetVersionsAndVariants(int, int, *model.Project) (*restModel.VersionVariantData, error)
GetProjectEventLog(string, time.Time, int) ([]restModel.APIProjectEvent, error)
CreateVersionFromConfig(context.Context, *model.ProjectInfo, model.VersionMetadata, bool) (*model.Version, error)
GetVersionsInProject(string, string, int, int) ([]restModel.APIVersion, error)
// Given a version and a project ID, return the translated project and the intermediate project.
LoadProjectForVersion(*model.Version, string) (*model.Project, *model.ParserProject, error)
// FindByProjectAndCommit is a method to find a set of tasks which ran as part of
// certain version in a project. It takes the projectId, commit hash, and a taskId
// for paginating through the results.
FindTasksByProjectAndCommit(string, string, string, string, int) ([]task.Task, error)
// FindTestsByTaskId is a method to find a set of tests that correspond to
// a given task. It takes a taskId, testId to start from, test name and status to filter,
// limit, and sort to provide additional control over the results.
FindTestsByTaskId(string, string, string, string, int, int) ([]testresult.TestResult, error)
FindTestsByTaskIdFilterSortPaginate(string, string, []string, string, int, int, int, int) ([]testresult.TestResult, error)
GetTestCountByTaskIdAndFilters(string, string, []string, int) (int, error)
FindTasksByVersion(string, string, []string, string, string, int, int, int, []string) ([]task.Task, int, error)
// FindUserById is a method to find a specific user given its ID.
FindUserById(string) (gimlet.User, error)
//FindUserByGithubName is a method to find a user given their Github name, if configured.
FindUserByGithubName(string) (gimlet.User, error)
// FindHostsById is a method to find a sorted list of hosts given an ID to
// start from.
FindHostsById(string, string, string, int) ([]host.Host, error)
// FindHostsInRange is a method to find a filtered list of hosts
FindHostsInRange(restModel.APIHostParams, string) ([]host.Host, error)
FindHostById(string) (*host.Host, error)
// FindHostByIdWithOwner finds a host with given host ID that was
// started by the given user. If the given user is a super-user,
// the host will also be returned regardless of who the host was
// started by
FindHostByIdWithOwner(string, gimlet.User) (*host.Host, error)
// FindHostsByDistro finds all hosts that have either a matching distro ID
// or distro alias.
FindHostsByDistro(string) ([]host.Host, error)
// FindHostWithVolume returns the host that has the given volume attached
FindHostWithVolume(string) (*host.Host, error)
// NewIntentHost is a method to insert an intent host given a distro and the name of a saved public key
NewIntentHost(context.Context, *restModel.HostRequestOptions, *user.DBUser, *evergreen.Settings) (*host.Host, error)
FindVolumeById(string) (*host.Volume, error)
FindVolumesByUser(string) ([]host.Volume, error)
SetVolumeName(*host.Volume, string) error
// AggregateSpawnhostData returns basic metrics on spawn host/volume usage.
AggregateSpawnhostData() (*host.SpawnHostUsage, error)
// FetchContext is a method to fetch a context given a series of identifiers.
FetchContext(string, string, string, string, string) (model.Context, error)
// FindDistroById is a method to find the distro matching the given distroId.
FindDistroById(string) (*distro.Distro, error)
// FindAllDistros is a method to find a sorted list of all distros.
FindAllDistros() ([]distro.Distro, error)
// UpdateDistro is a method that updates a given distro
UpdateDistro(*distro.Distro, *distro.Distro) error
// FindDistroById is a method to delete the distro matching the given distroId.
DeleteDistroById(string) error
// CreateDistro is a method to insert a given distro.
CreateDistro(distro *distro.Distro) error
// FindCostByVersionId returns cost data of a version given its ID.
FindCostByVersionId(string) (*task.VersionCost, error)
// FindCostByDistroId returns cost data of a distro given its ID and a time range.
// Interested time range is given as a start time and duration.
FindCostByDistroId(string, time.Time, time.Duration) (*task.DistroCost, error)
// ClearTaskQueue deletes all tasks from the task queue for a distro
ClearTaskQueue(string) error
// FindVersionById returns version given its ID.
FindVersionById(string) (*model.Version, error)
// FindVersionByProjectAndRevision returns the version with this project and revision
FindVersionByProjectAndRevision(string, string) (*model.Version, error)
// AddGitTagToVersion adds a git tag to a version document
AddGitTagToVersion(string, model.GitTag) error
// FindPatchesByProject provides access to the patches corresponding to the input project ID
// as ordered by creation time.
FindPatchesByProject(string, time.Time, int) ([]restModel.APIPatch, error)
// FindPatchByUser finds patches for the input user as ordered by creation time
FindPatchesByUser(string, time.Time, int) ([]restModel.APIPatch, error)
// FindPatchesByUser fetches a page of patches for the input user ordered by creation
// time and filters when given statuses, patch name, and commit queue parameters
FindPatchesByUserPatchNameStatusesCommitQueue(string, string, []string, bool, int, int) ([]restModel.APIPatch, *int, error)
// FindPatchById fetches the patch corresponding to the input patch ID.
FindPatchById(string) (*restModel.APIPatch, error)
//FindPatchesByIds fetches an array of patches that corresponding to the input patch IDs
FindPatchesByIds([]string) ([]restModel.APIPatch, error)
// AbortVersion aborts all tasks of a version given its ID.
AbortVersion(string, string) error
// AbortPatch aborts the patch corresponding to the input patch ID and deletes if not finalized.
AbortPatch(string, string) error
// AbortPatchesFromPullRequest aborts patches with the same PR Number,
// in the same repository, at the pull request's close time
AbortPatchesFromPullRequest(*github.PullRequestEvent) error
// RestartVersion restarts all completed tasks of a version given its ID and the caller.
RestartVersion(string, string) error
// SetPatchPriority and SetPatchActivated change the status of the input patch
SetPatchPriority(string, int64, string) error
SetPatchActivated(context.Context, string, string, bool, *evergreen.Settings) error
// GetEvergreenSettings/SetEvergreenSettings retrieves/sets the system-wide settings document
GetEvergreenSettings() (*evergreen.Settings, error)
GetBanner() (string, string, error)
SetEvergreenSettings(*restModel.APIAdminSettings, *evergreen.Settings, *user.DBUser, bool) (*evergreen.Settings, error)
// SetAdminBanner sets set the banner in the system-wide settings document
SetAdminBanner(string, *user.DBUser) error
// SetBannerTheme sets set the banner theme in the system-wide settings document
SetBannerTheme(string, *user.DBUser) error
// SetAdminBanner sets set the service flags in the system-wide settings document
SetServiceFlags(evergreen.ServiceFlags, *user.DBUser) error
RestartFailedTasks(amboy.Queue, model.RestartOptions) (*restModel.RestartResponse, error)
//RestartFailedCommitQueueVersions takes in a time range
RestartFailedCommitQueueVersions(opts model.RestartOptions) (*restModel.RestartResponse, error)
RevertConfigTo(string, string) error
GetAdminEventLog(time.Time, int) ([]restModel.APIAdminEvent, error)
MapLDAPGroupToRole(string, string) error
UnmapLDAPGroupToRole(string) error
FindCostTaskByProject(string, string, time.Time, time.Time, int, int) ([]task.Task, error)
// FindRecentTasks finds tasks that have recently finished.
FindRecentTasks(int) ([]task.Task, *task.ResultCounts, error)
FindRecentTaskListDistro(int) (*restModel.APIRecentTaskStatsList, error)
FindRecentTaskListProject(int) (*restModel.APIRecentTaskStatsList, error)
FindRecentTaskListAgentVersion(int) (*restModel.APIRecentTaskStatsList, error)
// GetHostStatsByDistro returns host stats broken down by distro
GetHostStatsByDistro() ([]host.StatsByDistro, error)
AddPublicKey(*user.DBUser, string, string) error
DeletePublicKey(*user.DBUser, string) error
UpdateSettings(*user.DBUser, user.UserSettings) error
SubmitFeedback(restModel.APIFeedbackSubmission) error
AddPatchIntent(patch.Intent, amboy.Queue) error
SetHostStatus(*host.Host, string, string) error
SetHostExpirationTime(*host.Host, time.Time) error
// TerminateHost terminates the given host via the cloud provider's API
TerminateHost(context.Context, *host.Host, string) error
CheckHostSecret(string, *http.Request) (int, error)
// FindProjectAliases queries the database to find all aliases.
FindProjectAliases(string) ([]restModel.APIProjectAlias, error)
// CopyProjectAliases copies aliases from the first project for the second project.
CopyProjectAliases(string, string) error
// UpdateProjectAliases upserts/deletes aliases for the given project
UpdateProjectAliases(string, []restModel.APIProjectAlias) error
// HasMatchingGitTagAliasAndRemotePath returns true if the project has aliases defined that match the given tag, and
// returns the remote path if applicable
HasMatchingGitTagAliasAndRemotePath(string, string) (bool, string, error)
// TriggerRepotracker creates an amboy job to get the commits from a
// Github Push Event
TriggerRepotracker(amboy.Queue, string, *github.PushEvent) error
// GetCLIUpdate fetches the current cli version and the urls to download
GetCLIUpdate() (*restModel.APICLIUpdate, error)
// GenerateTasks parses JSON files for `generate.tasks` and creates the new builds and tasks.
GenerateTasks(context.Context, string, []json.RawMessage, amboy.QueueGroup) error
// GeneratePoll checks to see if a `generate.tasks` job has finished.
GeneratePoll(context.Context, string, amboy.QueueGroup) (bool, []string, error)
// SaveSubscriptions saves a set of notification subscriptions
SaveSubscriptions(string, []restModel.APISubscription) error
// GetSubscriptions returns the subscriptions that belong to a user
GetSubscriptions(string, event.OwnerType) ([]restModel.APISubscription, error)
DeleteSubscriptions(string, []string) error
// CopyProjectSubscriptions copies subscriptions from the first project for the second project.
CopyProjectSubscriptions(string, string) error
UpdateAdminRoles(*model.ProjectRef, []string, []string) error
// Notifications
GetNotificationsStats() (*restModel.APIEventStats, error)
// ListHostsForTask lists running hosts scoped to the task or the task's build.
ListHostsForTask(context.Context, string) ([]host.Host, error)
MakeIntentHost(string, string, string, apimodels.CreateHost) (*host.Host, error)
CreateHostsFromTask(*task.Task, user.DBUser, string) error
// Get test execution statistics
GetTestStats(stats.StatsFilter) ([]restModel.APITestStats, error)
GetTaskStats(stats.StatsFilter) ([]restModel.APITaskStats, error)
// Get task reliability scores
GetTaskReliabilityScores(reliability.TaskReliabilityFilter) ([]restModel.APITaskReliability, error)
// Commit queue methods
// GetGithubPR takes the owner, repo, and PR number.
GetGitHubPR(context.Context, string, string, int) (*github.PullRequest, error)
// if bool is true, move the commit queue item to be processed next.
EnqueueItem(string, restModel.APICommitQueueItem, bool) (int, error)
FindCommitQueueByID(string) (*restModel.APICommitQueue, error)
EnableCommitQueue(*model.ProjectRef, model.CommitQueueParams) error
CommitQueueRemoveItem(string, string, string) (bool, error)
IsItemOnCommitQueue(string, string) (bool, error)
CommitQueueClearAll() (int, error)
IsPatchEmpty(string) (bool, error)
IsAuthorizedToPatchAndMerge(context.Context, *evergreen.Settings, UserRepoInfo) (bool, error)
// GetDockerLogs returns logs for the given docker container
GetDockerLogs(context.Context, string, *host.Host, *evergreen.Settings, types.ContainerLogsOptions) (io.Reader, error)
// GetDockerStatus returns the status of the given docker container
GetDockerStatus(context.Context, string, *host.Host, *evergreen.Settings) (*cloud.ContainerStatus, error)
//GetProjectSettingsEvent returns the ProjectSettingsEvents of the given identifier and ProjectRef
GetProjectSettingsEvent(p *model.ProjectRef) (*model.ProjectSettingsEvent, error)
}
Connector is an interface that contains all of the methods which connect to the service layer of evergreen. These methods abstract the link between the service and the API layers, allowing for changes in the service architecture without forcing changes to the API.
type DBAdminConnector ¶
type DBAdminConnector struct{}
func (*DBAdminConnector) GetAdminEventLog ¶
func (ac *DBAdminConnector) GetAdminEventLog(before time.Time, n int) ([]restModel.APIAdminEvent, error)
func (*DBAdminConnector) GetBanner ¶
func (ac *DBAdminConnector) GetBanner() (string, string, error)
func (*DBAdminConnector) GetEvergreenSettings ¶
func (ac *DBAdminConnector) GetEvergreenSettings() (*evergreen.Settings, error)
GetEvergreenSettings retrieves the admin settings document from the DB
func (*DBAdminConnector) MapLDAPGroupToRole ¶
func (ac *DBAdminConnector) MapLDAPGroupToRole(group, roleID string) error
func (*DBAdminConnector) RestartFailedCommitQueueVersions ¶
func (ac *DBAdminConnector) RestartFailedCommitQueueVersions(opts model.RestartOptions) (*restModel.RestartResponse, error)
func (*DBAdminConnector) RestartFailedTasks ¶
func (ac *DBAdminConnector) RestartFailedTasks(queue amboy.Queue, opts model.RestartOptions) (*restModel.RestartResponse, error)
RestartFailedTasks attempts to restart failed tasks that started between 2 times
func (*DBAdminConnector) RevertConfigTo ¶
func (ac *DBAdminConnector) RevertConfigTo(guid string, user string) error
func (*DBAdminConnector) SetAdminBanner ¶
func (ac *DBAdminConnector) SetAdminBanner(text string, u *user.DBUser) error
SetAdminBanner sets the admin banner in the DB and event logs it
func (*DBAdminConnector) SetBannerTheme ¶
func (ac *DBAdminConnector) SetBannerTheme(themeString string, u *user.DBUser) error
SetBannerTheme sets the banner theme in the DB and event logs it
func (*DBAdminConnector) SetEvergreenSettings ¶
func (ac *DBAdminConnector) SetEvergreenSettings(changes *restModel.APIAdminSettings, oldSettings *evergreen.Settings, u *user.DBUser, persist bool) (*evergreen.Settings, error)
SetEvergreenSettings sets the admin settings document in the DB and event logs it
func (*DBAdminConnector) SetServiceFlags ¶
func (ac *DBAdminConnector) SetServiceFlags(flags evergreen.ServiceFlags, u *user.DBUser) error
SetServiceFlags sets the service flags in the DB and event logs it
func (*DBAdminConnector) UnmapLDAPGroupToRole ¶
func (ac *DBAdminConnector) UnmapLDAPGroupToRole(group string) error
type DBAliasConnector ¶
type DBAliasConnector struct{}
DBAliasConnector is a struct that implements the Alias related methods from the Connector through interactions with the backing database.
func (*DBAliasConnector) CopyProjectAliases ¶
func (d *DBAliasConnector) CopyProjectAliases(oldProjectId, newProjectId string) error
CopyProjectAliases finds the aliases for a given project and inserts them for the new project.
func (*DBAliasConnector) FindProjectAliases ¶
func (d *DBAliasConnector) FindProjectAliases(projectId string) ([]restModel.APIProjectAlias, error)
FindProjectAliases queries the database to find all aliases.
func (*DBAliasConnector) HasMatchingGitTagAliasAndRemotePath ¶
func (d *DBAliasConnector) HasMatchingGitTagAliasAndRemotePath(projectId, tag string) (bool, string, error)
GetMatchingGitTagAliasesForProject returns matching git tag aliases that match the given git tag
func (*DBAliasConnector) UpdateProjectAliases ¶
func (d *DBAliasConnector) UpdateProjectAliases(projectId string, aliases []restModel.APIProjectAlias) error
type DBBuildConnector ¶
type DBBuildConnector struct{}
DBBuildConnector is a struct that implements the Build related methods from the Connector through interactions with the backing database.
func (*DBBuildConnector) AbortBuild ¶
func (bc *DBBuildConnector) AbortBuild(buildId string, user string) error
AbortBuild wraps the service level AbortBuild
func (*DBBuildConnector) FindBuildById ¶
func (bc *DBBuildConnector) FindBuildById(buildId string) (*build.Build, error)
FindBuildById uses the service layer's build type to query the backing database for a specific build.
func (*DBBuildConnector) RestartBuild ¶
func (bc *DBBuildConnector) RestartBuild(buildId string, user string) error
RestartBuild wraps the service level RestartBuild
func (*DBBuildConnector) SetBuildActivated ¶
func (bc *DBBuildConnector) SetBuildActivated(buildId string, user string, activated bool) error
SetBuildActivated wraps the service level method
func (*DBBuildConnector) SetBuildPriority ¶
func (bc *DBBuildConnector) SetBuildPriority(buildId string, priority int64, caller string) error
SetBuildPriority wraps the service level method
type DBCommitQueueConnector ¶
type DBCommitQueueConnector struct{}
func (*DBCommitQueueConnector) CommitQueueClearAll ¶
func (pc *DBCommitQueueConnector) CommitQueueClearAll() (int, error)
func (*DBCommitQueueConnector) CommitQueueRemoveItem ¶
func (pc *DBCommitQueueConnector) CommitQueueRemoveItem(id, issue, user string) (bool, error)
func (*DBCommitQueueConnector) EnqueueItem ¶
func (pc *DBCommitQueueConnector) EnqueueItem(projectID string, item restModel.APICommitQueueItem, enqueueNext bool) (int, error)
func (*DBCommitQueueConnector) FindCommitQueueByID ¶
func (pc *DBCommitQueueConnector) FindCommitQueueByID(id string) (*restModel.APICommitQueue, error)
func (*DBCommitQueueConnector) GetGitHubPR ¶
func (pc *DBCommitQueueConnector) GetGitHubPR(ctx context.Context, owner, repo string, PRNum int) (*github.PullRequest, error)
func (*DBCommitQueueConnector) IsAuthorizedToPatchAndMerge ¶
func (pc *DBCommitQueueConnector) IsAuthorizedToPatchAndMerge(ctx context.Context, settings *evergreen.Settings, args UserRepoInfo) (bool, error)
func (*DBCommitQueueConnector) IsItemOnCommitQueue ¶
func (pc *DBCommitQueueConnector) IsItemOnCommitQueue(id, item string) (bool, error)
type DBConnector ¶
type DBConnector struct {
URL string
Prefix string
DBUserConnector
DBTaskConnector
DBContextConnector
DBDistroConnector
DBHostConnector
DBTestConnector
DBBuildConnector
DBVersionConnector
DBPatchConnector
DBPatchIntentConnector
DBProjectConnector
DBAdminConnector
DBStatusConnector
DBAliasConnector
RepoTrackerConnector
CLIUpdateConnector
GenerateConnector
DBSubscriptionConnector
NotificationConnector
DBCreateHostConnector
StatsConnector
TaskReliabilityConnector
DBCommitQueueConnector
DBProjectTagConnector
}
DBConnector is a struct that implements all of the methods which connect to the service layer of evergreen. These methods abstract the link between the service and the API layers, allowing for changes in the service architecture without forcing changes to the API.
func (*DBConnector) FindHostByIdWithOwner ¶
func (*DBConnector) GetPrefix ¶
func (ctx *DBConnector) GetPrefix() string
func (*DBConnector) GetURL ¶
func (ctx *DBConnector) GetURL() string
func (*DBConnector) SetPrefix ¶
func (ctx *DBConnector) SetPrefix(prefix string)
func (*DBConnector) SetURL ¶
func (ctx *DBConnector) SetURL(url string)
type DBContextConnector ¶
type DBContextConnector struct{}
DBContextConnector is a struct that implements the Context related functions of the ServiceConnector interface through interactions with the backing database.
func (*DBContextConnector) FetchContext ¶
func (dc *DBContextConnector) FetchContext(taskId, buildId, versionId, patchId, projectId string) (model.Context, error)
LoadContext fetches the context through a call to the service layer.
type DBCreateHostConnector ¶
type DBCreateHostConnector struct{}
DBCreateHostConnector supports `host.create` commands from the agent.
func (*DBCreateHostConnector) CreateHostsFromTask ¶
func (*DBCreateHostConnector) GetDockerLogs ¶
func (dc *DBCreateHostConnector) GetDockerLogs(ctx context.Context, containerId string, parent *host.Host, settings *evergreen.Settings, options types.ContainerLogsOptions) (io.Reader, error)
GetDockerLogs is used by the /host/{host_id}/logs route to retrieve the logs for the given container.
func (*DBCreateHostConnector) GetDockerStatus ¶
func (*DBCreateHostConnector) ListHostsForTask ¶
func (dc *DBCreateHostConnector) ListHostsForTask(ctx context.Context, taskID string) ([]host.Host, error)
ListHostsForTask lists running hosts scoped to the task or the task's build.
func (*DBCreateHostConnector) MakeIntentHost ¶
func (dc *DBCreateHostConnector) MakeIntentHost(taskID, userID, publicKey string, createHost apimodels.CreateHost) (*host.Host, error)
type DBDistroConnector ¶
type DBDistroConnector struct{}
DBDistroConnector is a struct that implements the Distro related methods from the Connector through interactions with the backing database.
func (*DBDistroConnector) ClearTaskQueue ¶
func (tc *DBDistroConnector) ClearTaskQueue(distroId string) error
ClearTaskQueue deletes all tasks from the task queue for a distro
func (*DBDistroConnector) CreateDistro ¶
func (dc *DBDistroConnector) CreateDistro(distro *distro.Distro) error
CreateDistro inserts the given distro.Distro.
func (*DBDistroConnector) DeleteDistroById ¶
func (dc *DBDistroConnector) DeleteDistroById(distroId string) error
DeleteDistroById removes a given distro from the database based on its id.
func (*DBDistroConnector) FindAllDistros ¶
func (dc *DBDistroConnector) FindAllDistros() ([]distro.Distro, error)
FindAllDistros queries the database to find all distros.
func (*DBDistroConnector) FindCostByDistroId ¶
func (tc *DBDistroConnector) FindCostByDistroId(distroId string, starttime time.Time, duration time.Duration) (*task.DistroCost, error)
FindCostByDistroId queries the backing database for cost data associated with the given distroId. This is done by aggregating TimeTaken over all tasks of the given distro that match the time range.
func (*DBDistroConnector) FindDistroById ¶
func (dc *DBDistroConnector) FindDistroById(distroId string) (*distro.Distro, error)
FindDistroById queries the database to find a given distros.
func (*DBDistroConnector) UpdateDistro ¶
func (dc *DBDistroConnector) UpdateDistro(old, new *distro.Distro) error
UpdateDistro updates the given distro.Distro.
type DBHostConnector ¶
type DBHostConnector struct{}
DBHostConnector is a struct that implements the Host related methods from the Connector through interactions with the backing database.
func (*DBHostConnector) AggregateSpawnhostData ¶
func (hc *DBHostConnector) AggregateSpawnhostData() (*host.SpawnHostUsage, error)
func (*DBHostConnector) CheckHostSecret ¶
func (*DBHostConnector) FindHostById ¶
func (hc *DBHostConnector) FindHostById(id string) (*host.Host, error)
FindHostById queries the database for the host with id matching the hostId
func (*DBHostConnector) FindHostWithVolume ¶
func (hc *DBHostConnector) FindHostWithVolume(volumeID string) (*host.Host, error)
func (*DBHostConnector) FindHostsByDistro ¶
func (hc *DBHostConnector) FindHostsByDistro(distro string) ([]host.Host, error)
func (*DBHostConnector) FindHostsById ¶
FindHostsById uses the service layer's host type to query the backing database for the hosts.
func (*DBHostConnector) FindHostsInRange ¶
func (hc *DBHostConnector) FindHostsInRange(apiParams restmodel.APIHostParams, username string) ([]host.Host, error)
func (*DBHostConnector) FindVolumeById ¶
func (hc *DBHostConnector) FindVolumeById(volumeID string) (*host.Volume, error)
func (*DBHostConnector) FindVolumesByUser ¶
func (hc *DBHostConnector) FindVolumesByUser(user string) ([]host.Volume, error)
func (*DBHostConnector) NewIntentHost ¶
func (hc *DBHostConnector) NewIntentHost(ctx context.Context, options *restmodel.HostRequestOptions, user *user.DBUser, settings *evergreen.Settings) (*host.Host, error)
NewIntentHost is a method to insert an intent host given a distro and a public key The public key can be the name of a saved key or the actual key string
func (*DBHostConnector) SetHostExpirationTime ¶
func (*DBHostConnector) SetHostStatus ¶
func (hc *DBHostConnector) SetHostStatus(host *host.Host, status, user string) error
func (*DBHostConnector) SetVolumeName ¶
func (hc *DBHostConnector) SetVolumeName(v *host.Volume, name string) error
func (*DBHostConnector) TerminateHost ¶
type DBPatchConnector ¶
type DBPatchConnector struct{}
DBPatchConnector is a struct that implements the Patch related methods from the Connector through interactions with the backing database.
func (*DBPatchConnector) AbortPatch ¶
func (pc *DBPatchConnector) AbortPatch(patchId string, user string) error
AbortPatch uses the service level CancelPatch method to abort a single patch with matching Id.
func (*DBPatchConnector) AbortPatchesFromPullRequest ¶
func (p *DBPatchConnector) AbortPatchesFromPullRequest(event *github.PullRequestEvent) error
func (*DBPatchConnector) FindPatchById ¶
func (pc *DBPatchConnector) FindPatchById(patchId string) (*restModel.APIPatch, error)
FindPatchById queries the backing database for the patch matching patchId.
func (*DBPatchConnector) FindPatchesByIds ¶
func (pc *DBPatchConnector) FindPatchesByIds(patchIds []string) ([]restModel.APIPatch, error)
func (*DBPatchConnector) FindPatchesByProject ¶
func (pc *DBPatchConnector) FindPatchesByProject(projectId string, ts time.Time, limit int) ([]restModel.APIPatch, error)
FindPatchesByProject uses the service layer's patches type to query the backing database for the patches.
func (*DBPatchConnector) FindPatchesByUser ¶
func (*DBPatchConnector) FindPatchesByUserPatchNameStatusesCommitQueue ¶
func (*DBPatchConnector) IsPatchEmpty ¶
func (p *DBPatchConnector) IsPatchEmpty(id string) (bool, error)
func (*DBPatchConnector) SetPatchActivated ¶
func (pc *DBPatchConnector) SetPatchActivated(ctx context.Context, patchId string, user string, activated bool, settings *evergreen.Settings) error
SetPatchActivated attempts to activate the patch and create a new version (if activated is set to true)
func (*DBPatchConnector) SetPatchPriority ¶
func (pc *DBPatchConnector) SetPatchPriority(patchId string, priority int64, caller string) error
SetPatchPriority attempts to set the priority on the corresponding version. Will not error if no version exists.
type DBPatchIntentConnector ¶
type DBPatchIntentConnector struct{}
func (*DBPatchIntentConnector) AddPatchIntent ¶
type DBProjectConnector ¶
type DBProjectConnector struct{}
DBProjectConnector is a struct that implements the Project related methods from the Connector through interactions with the backing database.
func (*DBProjectConnector) CopyProjectVars ¶
func (pc *DBProjectConnector) CopyProjectVars(oldProjectId, newProjectId string) error
func (*DBProjectConnector) CreateProject ¶
func (pc *DBProjectConnector) CreateProject(projectRef *model.ProjectRef, u *user.DBUser) error
CreateProject inserts the given model.ProjectRef.
func (*DBProjectConnector) EnableCommitQueue ¶
func (pc *DBProjectConnector) EnableCommitQueue(projectRef *model.ProjectRef, commitQueueParams model.CommitQueueParams) error
func (*DBProjectConnector) EnablePRTesting ¶
func (pc *DBProjectConnector) EnablePRTesting(projectRef *model.ProjectRef) error
func (*DBProjectConnector) EnableWebhooks ¶
func (pc *DBProjectConnector) EnableWebhooks(ctx context.Context, projectRef *model.ProjectRef) (bool, error)
EnableWebhooks returns true if a hook for the given owner/repo exists or was inserted.
func (*DBProjectConnector) FindEnabledProjectRefsByOwnerAndRepo ¶
func (ac *DBProjectConnector) FindEnabledProjectRefsByOwnerAndRepo(owner, repo string) ([]model.ProjectRef, error)
func (*DBProjectConnector) FindProjectById ¶
func (pc *DBProjectConnector) FindProjectById(id string) (*model.ProjectRef, error)
FindProjectById queries the database for the project matching the projectRef.Identifier.
func (*DBProjectConnector) FindProjectVarsById ¶
func (pc *DBProjectConnector) FindProjectVarsById(id string, redact bool) (*restModel.APIProjectVars, error)
FindProjectVarsById returns the variables associated with the given project.
func (*DBProjectConnector) FindProjects ¶
func (pc *DBProjectConnector) FindProjects(key string, limit int, sortDir int) ([]model.ProjectRef, error)
FindProjects queries the backing database for the specified projects
func (*DBProjectConnector) GetProjectEventLog ¶
func (ac *DBProjectConnector) GetProjectEventLog(id string, before time.Time, n int) ([]restModel.APIProjectEvent, error)
func (*DBProjectConnector) GetProjectFromFile ¶
func (pc *DBProjectConnector) GetProjectFromFile(ctx context.Context, pRef model.ProjectRef, file string, token string) (*model.Project, *model.ParserProject, error)
func (*DBProjectConnector) GetProjectSettingsEvent ¶
func (pc *DBProjectConnector) GetProjectSettingsEvent(p *model.ProjectRef) (*model.ProjectSettingsEvent, error)
func (*DBProjectConnector) GetProjectWithCommitQueueByOwnerRepoAndBranch ¶
func (ac *DBProjectConnector) GetProjectWithCommitQueueByOwnerRepoAndBranch(owner, repo, branch string) (*model.ProjectRef, error)
func (*DBProjectConnector) GetVersionsInProject ¶
func (ac *DBProjectConnector) GetVersionsInProject(project, requester string, limit, startOrder int) ([]restModel.APIVersion, error)
func (*DBProjectConnector) UpdateAdminRoles ¶
func (pc *DBProjectConnector) UpdateAdminRoles(project *model.ProjectRef, toAdd, toDelete []string) error
func (*DBProjectConnector) UpdateProject ¶
func (pc *DBProjectConnector) UpdateProject(projectRef *model.ProjectRef) error
UpdateProject updates the given model.ProjectRef.Identifier.
func (*DBProjectConnector) UpdateProjectRevision ¶
func (pc *DBProjectConnector) UpdateProjectRevision(projectID, revision string) error
func (*DBProjectConnector) UpdateProjectVars ¶
func (pc *DBProjectConnector) UpdateProjectVars(projectId string, varsModel *restModel.APIProjectVars, overwrite bool) error
UpdateProjectVars adds new variables, overwrites variables, and deletes variables for the given project.
type DBProjectTagConnector ¶
type DBProjectTagConnector struct{}
func (DBProjectTagConnector) AddTagsToProject ¶
func (DBProjectTagConnector) AddTagsToProject(id string, tags ...string) error
func (DBProjectTagConnector) FindProjectsByTag ¶
func (DBProjectTagConnector) FindProjectsByTag(tag string) ([]restModel.APIProjectRef, error)
func (DBProjectTagConnector) RemoveTagFromProject ¶
func (DBProjectTagConnector) RemoveTagFromProject(id, tag string) error
type DBStatusConnector ¶
type DBStatusConnector struct{}
DBStatusConnector is a struct that implements the status related methods from the Connector through interactions with the backing database.
func (*DBStatusConnector) FindRecentTaskListAgentVersion ¶
func (c *DBStatusConnector) FindRecentTaskListAgentVersion(minutes int) (*model.APIRecentTaskStatsList, error)
func (*DBStatusConnector) FindRecentTaskListDistro ¶
func (c *DBStatusConnector) FindRecentTaskListDistro(minutes int) (*model.APIRecentTaskStatsList, error)
func (*DBStatusConnector) FindRecentTaskListProject ¶
func (c *DBStatusConnector) FindRecentTaskListProject(minutes int) (*model.APIRecentTaskStatsList, error)
func (*DBStatusConnector) FindRecentTasks ¶
func (c *DBStatusConnector) FindRecentTasks(minutes int) ([]task.Task, *task.ResultCounts, error)
FindRecentTasks queries the database to find all distros.
func (*DBStatusConnector) GetHostStatsByDistro ¶
func (c *DBStatusConnector) GetHostStatsByDistro() ([]host.StatsByDistro, error)
GetHostStatsByDistro returns counts of up hosts broken down by distro
type DBSubscriptionConnector ¶
type DBSubscriptionConnector struct{}
func (*DBSubscriptionConnector) CopyProjectSubscriptions ¶
func (dc *DBSubscriptionConnector) CopyProjectSubscriptions(oldProject, newProject string) error
func (*DBSubscriptionConnector) DeleteSubscriptions ¶
func (dc *DBSubscriptionConnector) DeleteSubscriptions(owner string, ids []string) error
func (*DBSubscriptionConnector) GetSubscriptions ¶
func (dc *DBSubscriptionConnector) GetSubscriptions(owner string, ownerType event.OwnerType) ([]restModel.APISubscription, error)
func (*DBSubscriptionConnector) SaveSubscriptions ¶
func (dc *DBSubscriptionConnector) SaveSubscriptions(owner string, subscriptions []restModel.APISubscription) error
type DBTaskConnector ¶
type DBTaskConnector struct{}
DBTaskConnector is a struct that implements the Task related methods from the Connector through interactions with he backing database.
func (*DBTaskConnector) AbortTask ¶
func (tc *DBTaskConnector) AbortTask(taskId string, user string) error
func (*DBTaskConnector) CheckTaskSecret ¶
func (*DBTaskConnector) FindCostTaskByProject ¶
func (tc *DBTaskConnector) FindCostTaskByProject(project, taskId string, starttime, endtime time.Time, limit, sortDir int) ([]task.Task, error)
FindCostTaskByProject queries the backing database for tasks of a project that finishes in the given time range.
func (*DBTaskConnector) FindOldTasksByIDWithDisplayTasks ¶
func (tc *DBTaskConnector) FindOldTasksByIDWithDisplayTasks(id string) ([]task.Task, error)
func (*DBTaskConnector) FindTaskById ¶
func (tc *DBTaskConnector) FindTaskById(taskId string) (*task.Task, error)
FindTaskById uses the service layer's task type to query the backing database for the task with the given taskId.
func (*DBTaskConnector) FindTaskWithinTimePeriod ¶
func (*DBTaskConnector) FindTasksByBuildId ¶
func (tc *DBTaskConnector) FindTasksByBuildId(buildId, taskId, status string, limit int, sortDir int) ([]task.Task, error)
FindTasksByBuildId uses the service layer's task type to query the backing database for a list of task that matches buildId. It accepts the startTaskId and a limit to allow for pagination of the queries. It returns results sorted by taskId.
func (*DBTaskConnector) FindTasksByIds ¶
func (tc *DBTaskConnector) FindTasksByIds(ids []string) ([]task.Task, error)
func (*DBTaskConnector) FindTasksByProjectAndCommit ¶
func (*DBTaskConnector) FindTasksByVersion ¶
func (tc *DBTaskConnector) FindTasksByVersion(versionID, sortBy string, statuses []string, variant string, taskName string, sortDir, page, limit int, fieldsToProject []string) ([]task.Task, int, error)
FindTasksByVersion gets all tasks for a specific version Results can be filtered by task name, variant name and status in addition to being paginated and limited
func (*DBTaskConnector) GetManifestByTask ¶
func (tc *DBTaskConnector) GetManifestByTask(taskId string) (*manifest.Manifest, error)
GetManifestByTask finds the manifest corresponding to the given task.
func (*DBTaskConnector) ResetTask ¶
func (tc *DBTaskConnector) ResetTask(taskId, username string) error
ResetTask sets the task to be in an unexecuted state and prepares it to be run again.
func (*DBTaskConnector) SetTaskActivated ¶
func (tc *DBTaskConnector) SetTaskActivated(taskId, user string, activated bool) error
SetTaskPriority changes the priority value of a task using a call to the service layer function.
func (*DBTaskConnector) SetTaskPriority ¶
SetTaskPriority changes the priority value of a task using a call to the service layer function.
type DBTestConnector ¶
type DBTestConnector struct{}
DBTestConnector is a struct that implements the Test related methods from the Connector through interactions with the backing database.
func (*DBTestConnector) FindTestsByTaskId ¶
func (tc *DBTestConnector) FindTestsByTaskId(taskId, testId, testName, status string, limit, execution int) ([]testresult.TestResult, error)
func (*DBTestConnector) FindTestsByTaskIdFilterSortPaginate ¶
func (tc *DBTestConnector) FindTestsByTaskIdFilterSortPaginate(taskId, testName string, statuses []string, sortBy string, sortDir, page, limit, execution int) ([]testresult.TestResult, error)
func (*DBTestConnector) GetTestCountByTaskIdAndFilters ¶
type DBUserConnector ¶
type DBUserConnector struct{}
DBUserConnector is a struct that implements the User related interface of the Connector interface through interactions with the backing database.
func (*DBUserConnector) AddPublicKey ¶
func (u *DBUserConnector) AddPublicKey(user *user.DBUser, keyName, keyValue string) error
func (*DBUserConnector) DeletePublicKey ¶
func (u *DBUserConnector) DeletePublicKey(user *user.DBUser, keyName string) error
func (*DBUserConnector) FindUserByGithubName ¶
func (tc *DBUserConnector) FindUserByGithubName(name string) (gimlet.User, error)
func (*DBUserConnector) FindUserById ¶
func (tc *DBUserConnector) FindUserById(userId string) (gimlet.User, error)
FindUserById uses the service layer's user type to query the backing database for the user with the given Id.
func (*DBUserConnector) SubmitFeedback ¶
func (u *DBUserConnector) SubmitFeedback(in restModel.APIFeedbackSubmission) error
func (*DBUserConnector) UpdateSettings ¶
func (u *DBUserConnector) UpdateSettings(dbUser *user.DBUser, settings user.UserSettings) error
type DBVersionConnector ¶
type DBVersionConnector struct{}
DBVersionConnector is a struct that implements Version related methods from the Connector through interactions with the backing database.
func (*DBVersionConnector) AbortVersion ¶
func (vc *DBVersionConnector) AbortVersion(versionId, caller string) error
AbortVersion aborts all tasks of a version given its ID. It wraps the service level AbortModel.Version
func (*DBVersionConnector) AddGitTagToVersion ¶
func (vc *DBVersionConnector) AddGitTagToVersion(versionId string, gitTag model.GitTag) error
func (*DBVersionConnector) CreateVersionFromConfig ¶
func (vc *DBVersionConnector) CreateVersionFromConfig(ctx context.Context, projectInfo *model.ProjectInfo, metadata model.VersionMetadata, active bool) (*model.Version, error)
func (*DBVersionConnector) FindCostByVersionId ¶
func (vc *DBVersionConnector) FindCostByVersionId(versionId string) (*task.VersionCost, error)
FindCostByVersionId queries the backing database for cost data associated with the given versionId. This is done by aggregating TimeTaken over all tasks of the given model.Version
func (*DBVersionConnector) FindVersionById ¶
func (vc *DBVersionConnector) FindVersionById(versionId string) (*model.Version, error)
FindVersionById queries the backing database for the version with the given versionId.
func (*DBVersionConnector) FindVersionByProjectAndRevision ¶
func (vc *DBVersionConnector) FindVersionByProjectAndRevision(projectId, revision string) (*model.Version, error)
func (*DBVersionConnector) GetVersionsAndVariants ¶
func (vc *DBVersionConnector) GetVersionsAndVariants(skip, numVersionElements int, project *model.Project) (*restModel.VersionVariantData, error)
Fetch versions until 'numVersionElements' elements are created, including elements consisting of multiple versions rolled-up into one. The skip value indicates how many versions back in time should be skipped before starting to fetch versions, the project indicates which project the returned versions should be a part of.
func (*DBVersionConnector) LoadProjectForVersion ¶
func (bc *DBVersionConnector) LoadProjectForVersion(v *model.Version, projectId string) (*model.Project, *model.ParserProject, error)
func (*DBVersionConnector) RestartVersion ¶
func (vc *DBVersionConnector) RestartVersion(versionId string, caller string) error
RestartVersion wraps the service level RestartVersion, which restarts completed tasks associated with a given versionId. If abortInProgress is true, it also sets the abort flag on any in-progress tasks. In addition, it updates all builds containing the tasks affected.
type GenerateConnector ¶
type GenerateConnector struct{}
func (*GenerateConnector) GeneratePoll ¶
func (gc *GenerateConnector) GeneratePoll(ctx context.Context, taskID string, group amboy.QueueGroup) (bool, []string, error)
func (*GenerateConnector) GenerateTasks ¶
func (gc *GenerateConnector) GenerateTasks(ctx context.Context, taskID string, jsonBytes []json.RawMessage, group amboy.QueueGroup) error
GenerateTasks parses JSON files for `generate.tasks` and creates the new builds and tasks.
type MockAdminConnector ¶
type MockAdminConnector struct {
MockSettings *evergreen.Settings
// contains filtered or unexported fields
}
func (*MockAdminConnector) GetAdminEventLog ¶
func (ac *MockAdminConnector) GetAdminEventLog(before time.Time, n int) ([]restModel.APIAdminEvent, error)
func (*MockAdminConnector) GetBanner ¶
func (ac *MockAdminConnector) GetBanner() (string, string, error)
func (*MockAdminConnector) GetEvergreenSettings ¶
func (ac *MockAdminConnector) GetEvergreenSettings() (*evergreen.Settings, error)
GetEvergreenSettings retrieves the admin settings document from the mock connector
func (*MockAdminConnector) MapLDAPGroupToRole ¶
func (ac *MockAdminConnector) MapLDAPGroupToRole(group, roleID string) error
func (*MockAdminConnector) RestartFailedCommitQueueVersions ¶
func (ac *MockAdminConnector) RestartFailedCommitQueueVersions(opts model.RestartOptions) (*restModel.RestartResponse, error)
func (*MockAdminConnector) RestartFailedTasks ¶
func (ac *MockAdminConnector) RestartFailedTasks(queue amboy.Queue, opts model.RestartOptions) (*restModel.RestartResponse, error)
RestartFailedTasks mocks a response to restarting failed tasks
func (*MockAdminConnector) RevertConfigTo ¶
func (ac *MockAdminConnector) RevertConfigTo(guid string, user string) error
func (*MockAdminConnector) SetAdminBanner ¶
func (ac *MockAdminConnector) SetAdminBanner(text string, u *user.DBUser) error
SetAdminBanner sets the admin banner in the mock connector
func (*MockAdminConnector) SetBannerTheme ¶
func (ac *MockAdminConnector) SetBannerTheme(themeString string, u *user.DBUser) error
func (*MockAdminConnector) SetEvergreenSettings ¶
func (ac *MockAdminConnector) SetEvergreenSettings(changes *restModel.APIAdminSettings, oldSettings *evergreen.Settings, u *user.DBUser, persist bool) (*evergreen.Settings, error)
SetEvergreenSettings sets the admin settings document in the mock connector
func (*MockAdminConnector) SetServiceFlags ¶
func (ac *MockAdminConnector) SetServiceFlags(flags evergreen.ServiceFlags, u *user.DBUser) error
SetServiceFlags sets the service flags in the mock connector
func (*MockAdminConnector) UnmapLDAPGroupToRole ¶
func (ac *MockAdminConnector) UnmapLDAPGroupToRole(group string) error
type MockAliasConnector ¶
type MockAliasConnector struct {
Aliases []restModel.APIProjectAlias
}
MockAliasConnector is a struct that implements mock versions of Alias-related methods for testing.
func (*MockAliasConnector) CopyProjectAliases ¶
func (d *MockAliasConnector) CopyProjectAliases(oldProjectId, newProjectId string) error
func (*MockAliasConnector) FindProjectAliases ¶
func (d *MockAliasConnector) FindProjectAliases(projectId string) ([]restModel.APIProjectAlias, error)
FindAllAliases is a mock implementation for testing.
func (*MockAliasConnector) HasMatchingGitTagAliasAndRemotePath ¶
func (d *MockAliasConnector) HasMatchingGitTagAliasAndRemotePath(projectId, tag string) (bool, string, error)
func (*MockAliasConnector) UpdateProjectAliases ¶
func (d *MockAliasConnector) UpdateProjectAliases(projectId string, aliases []restModel.APIProjectAlias) error
type MockBuildConnector ¶
type MockBuildConnector struct {
CachedBuilds []build.Build
CachedProjects map[string]*model.ProjectRef
CachedAborted map[string]string
FailOnChangePriority bool
FailOnAbort bool
FailOnRestart bool
}
MockBuildConnector is a struct that implements the Build related methods from the Connector through interactions with the backing database.
func (*MockBuildConnector) AbortBuild ¶
func (bc *MockBuildConnector) AbortBuild(buildId string, user string) error
AbortBuild sets the value of the input build Id in CachedAborted to true.
func (*MockBuildConnector) FindBuildById ¶
func (bc *MockBuildConnector) FindBuildById(buildId string) (*build.Build, error)
FindBuildById iterates through the CachedBuilds slice to find the build with matching id field.
func (*MockBuildConnector) RestartBuild ¶
func (bc *MockBuildConnector) RestartBuild(buildId string, user string) error
RestartBuild does absolutely nothing
func (*MockBuildConnector) SetBuildActivated ¶
func (bc *MockBuildConnector) SetBuildActivated(buildId string, user string, activated bool) error
SetBuildActivated sets the activated and activated_by fields on the input build.
func (*MockBuildConnector) SetBuildPriority ¶
func (bc *MockBuildConnector) SetBuildPriority(buildId string, priority int64, caller string) error
SetBuildPriority throws an error if instructed
type MockCLIUpdateConnector ¶
type MockCLIUpdateConnector struct {
// contains filtered or unexported fields
}
func (*MockCLIUpdateConnector) GetCLIUpdate ¶
func (c *MockCLIUpdateConnector) GetCLIUpdate() (*model.APICLIUpdate, error)
type MockCommitQueueConnector ¶
type MockCommitQueueConnector struct {
Queue map[string][]restModel.APICommitQueueItem
}
func (*MockCommitQueueConnector) CommitQueueClearAll ¶
func (pc *MockCommitQueueConnector) CommitQueueClearAll() (int, error)
func (*MockCommitQueueConnector) CommitQueueRemoveItem ¶
func (pc *MockCommitQueueConnector) CommitQueueRemoveItem(id, item, user string) (bool, error)
func (*MockCommitQueueConnector) EnqueueItem ¶
func (pc *MockCommitQueueConnector) EnqueueItem(projectID string, item restModel.APICommitQueueItem, enqueueNext bool) (int, error)
func (*MockCommitQueueConnector) FindCommitQueueByID ¶
func (pc *MockCommitQueueConnector) FindCommitQueueByID(id string) (*restModel.APICommitQueue, error)
func (*MockCommitQueueConnector) GetGitHubPR ¶
func (pc *MockCommitQueueConnector) GetGitHubPR(ctx context.Context, owner, repo string, PRNum int) (*github.PullRequest, error)
func (*MockCommitQueueConnector) IsAuthorizedToPatchAndMerge ¶
func (pc *MockCommitQueueConnector) IsAuthorizedToPatchAndMerge(context.Context, *evergreen.Settings, UserRepoInfo) (bool, error)
func (*MockCommitQueueConnector) IsItemOnCommitQueue ¶
func (pc *MockCommitQueueConnector) IsItemOnCommitQueue(id, item string) (bool, error)
type MockConnector ¶
type MockConnector struct {
URL string
Prefix string
MockUserConnector
MockTaskConnector
MockContextConnector
MockDistroConnector
MockHostConnector
MockTestConnector
MockBuildConnector
MockVersionConnector
MockPatchConnector
MockPatchIntentConnector
MockProjectConnector
MockAdminConnector
MockStatusConnector
MockAliasConnector
MockRepoTrackerConnector
MockCLIUpdateConnector
MockGenerateConnector
MockSubscriptionConnector
MockNotificationConnector
MockCreateHostConnector
MockStatsConnector
MockTaskReliabilityConnector
MockCommitQueueConnector
MockProjectTagConnector
}
func (*MockConnector) AggregateSpawnhostData ¶
func (hc *MockConnector) AggregateSpawnhostData() (*host.SpawnHostUsage, error)
func (*MockConnector) FindHostByIdWithOwner ¶
func (*MockConnector) FindHostWithVolume ¶
func (hc *MockConnector) FindHostWithVolume(volumeID string) (*host.Host, error)
func (*MockConnector) FindVolumeById ¶
func (hc *MockConnector) FindVolumeById(volumeID string) (*host.Volume, error)
func (*MockConnector) FindVolumesByUser ¶
func (hc *MockConnector) FindVolumesByUser(user string) ([]host.Volume, error)
func (*MockConnector) GetPrefix ¶
func (ctx *MockConnector) GetPrefix() string
func (*MockConnector) GetURL ¶
func (ctx *MockConnector) GetURL() string
func (*MockConnector) SetPrefix ¶
func (ctx *MockConnector) SetPrefix(prefix string)
func (*MockConnector) SetURL ¶
func (ctx *MockConnector) SetURL(url string)
func (*MockConnector) SetVolumeName ¶
func (hc *MockConnector) SetVolumeName(volume *host.Volume, name string) error
type MockContextConnector ¶
MockContextConnector is a struct that mocks the context methods by storing context to be fetched by its method.
func (*MockContextConnector) FetchContext ¶
func (mc *MockContextConnector) FetchContext(taskId, buildId, versionId, patchId, projectId string) (model.Context, error)
FetchContext returns the context cached within the MockContextConnector.
type MockCreateHostConnector ¶
type MockCreateHostConnector struct{}
MockCreateHostConnector mocks `DBCreateHostConnector`.
func (*MockCreateHostConnector) CreateHostsFromTask ¶
func (*MockCreateHostConnector) GetDockerLogs ¶
func (*MockCreateHostConnector) GetDockerStatus ¶
func (*MockCreateHostConnector) ListHostsForTask ¶
func (*MockCreateHostConnector) ListHostsForTask(ctx context.Context, taskID string) ([]host.Host, error)
ListHostsForTask lists running hosts scoped to the task or the task's build.
func (*MockCreateHostConnector) MakeIntentHost ¶
func (*MockCreateHostConnector) MakeIntentHost(taskID, userID, publicKey string, createHost apimodels.CreateHost) (*host.Host, error)
type MockDistroConnector ¶
MockDistroConnector is a struct that implements mock versions of Distro-related methods for testing.
func (*MockDistroConnector) ClearTaskQueue ¶
func (mdc *MockDistroConnector) ClearTaskQueue(distroId string) error
func (*MockDistroConnector) CreateDistro ¶
func (mdc *MockDistroConnector) CreateDistro(distro *distro.Distro) error
func (*MockDistroConnector) DeleteDistroById ¶
func (mdc *MockDistroConnector) DeleteDistroById(distroId string) error
func (*MockDistroConnector) FindAllDistros ¶
func (mdc *MockDistroConnector) FindAllDistros() ([]distro.Distro, error)
FindAllDistros is a mock implementation for testing.
func (*MockDistroConnector) FindCostByDistroId ¶
func (mdc *MockDistroConnector) FindCostByDistroId(distroId string, starttime time.Time, duration time.Duration) (*task.DistroCost, error)
FindCostByDistroId returns results based on the cached tasks and cached distros in the MockDistroConnector.
func (*MockDistroConnector) FindDistroById ¶
func (mdc *MockDistroConnector) FindDistroById(distroId string) (*distro.Distro, error)
func (*MockDistroConnector) UpdateDistro ¶
func (mdc *MockDistroConnector) UpdateDistro(old, new *distro.Distro) error
type MockGenerateConnector ¶
type MockGenerateConnector struct{}
func (*MockGenerateConnector) GeneratePoll ¶
func (gc *MockGenerateConnector) GeneratePoll(ctx context.Context, taskID string, queue amboy.QueueGroup) (bool, []string, error)
func (*MockGenerateConnector) GenerateTasks ¶
func (gc *MockGenerateConnector) GenerateTasks(ctx context.Context, taskID string, jsonBytes []json.RawMessage, group amboy.QueueGroup) error
type MockHostConnector ¶
MockHostConnector is a struct that implements the Host related methods from the Connector through interactions with the backing database.
func (*MockHostConnector) CheckHostSecret ¶
func (*MockHostConnector) FindHostById ¶
func (hc *MockHostConnector) FindHostById(id string) (*host.Host, error)
func (*MockHostConnector) FindHostsByDistro ¶
func (hc *MockHostConnector) FindHostsByDistro(distro string) ([]host.Host, error)
func (*MockHostConnector) FindHostsById ¶
FindHostsById searches the mock hosts slice for hosts and returns them
func (*MockHostConnector) FindHostsByIdOnly ¶
func (*MockHostConnector) FindHostsInRange ¶
func (hc *MockHostConnector) FindHostsInRange(params restmodel.APIHostParams, username string) ([]host.Host, error)
FindHostsInRange searches the mock hosts slice for hosts and returns them
func (*MockHostConnector) NewIntentHost ¶
func (hc *MockHostConnector) NewIntentHost(ctx context.Context, options *restmodel.HostRequestOptions, user *user.DBUser, settings *evergreen.Settings) (*host.Host, error)
NewIntentHost is a method to mock "insert" an intent host given a distro and a public key The public key can be the name of a saved key or the actual key string
func (*MockHostConnector) SetHostExpirationTime ¶
func (*MockHostConnector) SetHostStatus ¶
func (hc *MockHostConnector) SetHostStatus(host *host.Host, status, user string) error
func (*MockHostConnector) TerminateHost ¶
type MockNotificationConnector ¶
type MockNotificationConnector struct{}
func (*MockNotificationConnector) GetNotificationsStats ¶
func (c *MockNotificationConnector) GetNotificationsStats() (*restModel.APIEventStats, error)
type MockPatchConnector ¶
type MockPatchConnector struct {
CachedPatches []restModel.APIPatch
CachedAborted map[string]string
CachedPriority map[string]int64
}
MockPatchConnector is a struct that implements the Patch related methods from the Connector through interactions with he backing database.
func (*MockPatchConnector) AbortPatch ¶
func (pc *MockPatchConnector) AbortPatch(patchId string, user string) error
AbortPatch sets the value of patchId in CachedAborted to user.
func (*MockPatchConnector) AbortPatchesFromPullRequest ¶
func (c *MockPatchConnector) AbortPatchesFromPullRequest(event *github.PullRequestEvent) error
func (*MockPatchConnector) FindPatchById ¶
func (pc *MockPatchConnector) FindPatchById(patchId string) (*restModel.APIPatch, error)
FindPatchById iterates through the slice of CachedPatches to find the matching patch.
func (*MockPatchConnector) FindPatchesByIds ¶
func (pc *MockPatchConnector) FindPatchesByIds(patchIds []string) ([]restModel.APIPatch, error)
func (*MockPatchConnector) FindPatchesByProject ¶
func (hp *MockPatchConnector) FindPatchesByProject(projectId string, ts time.Time, limit int) ([]restModel.APIPatch, error)
FindPatchesByProject queries the cached patches splice for the matching patches. Assumes CachedPatches is sorted by increasing creation time.
func (*MockPatchConnector) FindPatchesByUser ¶
func (hp *MockPatchConnector) FindPatchesByUser(user string, ts time.Time, limit int) ([]restModel.APIPatch, error)
FindPatchesByUser iterates through the cached patches slice to find the correct patches
func (*MockPatchConnector) FindPatchesByUserPatchNameStatusesCommitQueue ¶
func (*MockPatchConnector) IsPatchEmpty ¶
func (pc *MockPatchConnector) IsPatchEmpty(id string) (bool, error)
func (*MockPatchConnector) SetPatchActivated ¶
func (pc *MockPatchConnector) SetPatchActivated(ctx context.Context, patchId string, user string, activated bool, settings *evergreen.Settings) error
SetPatchActivated sets the boolean activated field on the input patch.
func (*MockPatchConnector) SetPatchPriority ¶
func (pc *MockPatchConnector) SetPatchPriority(patchId string, priority int64, caller string) error
SetPatchPriority sets the patch priority in the CachedPriority map.
type MockPatchIntentConnector ¶
type MockPatchIntentConnector struct {
CachedIntents map[MockPatchIntentKey]patch.Intent
}
func (*MockPatchIntentConnector) AddPatchIntent ¶
type MockPatchIntentKey ¶
type MockPatchIntentKey struct {
// contains filtered or unexported fields
}
type MockProjectConnector ¶
type MockProjectConnector struct {
CachedProjects []model.ProjectRef
CachedVars []*model.ProjectVars
CachedEvents []restModel.APIProjectEvent
}
MockPatchConnector is a struct that implements the Patch related methods from the Connector through interactions with he backing database.
func (*MockProjectConnector) CopyProjectVars ¶
func (pc *MockProjectConnector) CopyProjectVars(oldProjectId, newProjectId string) error
func (*MockProjectConnector) CreateProject ¶
func (pc *MockProjectConnector) CreateProject(projectRef *model.ProjectRef, u *user.DBUser) error
func (*MockProjectConnector) EnableCommitQueue ¶
func (pc *MockProjectConnector) EnableCommitQueue(projectRef *model.ProjectRef, commitQueueParams model.CommitQueueParams) error
func (*MockProjectConnector) EnablePRTesting ¶
func (pc *MockProjectConnector) EnablePRTesting(projectRef *model.ProjectRef) error
func (*MockProjectConnector) EnableWebhooks ¶
func (pc *MockProjectConnector) EnableWebhooks(ctx context.Context, projectRef *model.ProjectRef) (bool, error)
func (*MockProjectConnector) FindEnabledProjectRefsByOwnerAndRepo ¶
func (pc *MockProjectConnector) FindEnabledProjectRefsByOwnerAndRepo(owner, repo string) ([]model.ProjectRef, error)
func (*MockProjectConnector) FindProjectById ¶
func (pc *MockProjectConnector) FindProjectById(projectId string) (*model.ProjectRef, error)
func (*MockProjectConnector) FindProjectVarsById ¶
func (pc *MockProjectConnector) FindProjectVarsById(id string, redact bool) (*restModel.APIProjectVars, error)
func (*MockProjectConnector) FindProjects ¶
func (pc *MockProjectConnector) FindProjects(key string, limit int, sortDir int) ([]model.ProjectRef, error)
FindProjects queries the cached projects slice for the matching projects. Assumes CachedProjects is sorted in alphabetical order of project identifier.
func (*MockProjectConnector) GetProjectEventLog ¶
func (pc *MockProjectConnector) GetProjectEventLog(id string, before time.Time, n int) ([]restModel.APIProjectEvent, error)
func (*MockProjectConnector) GetProjectFromFile ¶
func (pc *MockProjectConnector) GetProjectFromFile(ctx context.Context, pRef model.ProjectRef, file string, token string) (*model.Project, *model.ParserProject, error)
func (*MockProjectConnector) GetProjectSettingsEvent ¶
func (pc *MockProjectConnector) GetProjectSettingsEvent(p *model.ProjectRef) (*model.ProjectSettingsEvent, error)
func (*MockProjectConnector) GetProjectWithCommitQueueByOwnerRepoAndBranch ¶
func (pc *MockProjectConnector) GetProjectWithCommitQueueByOwnerRepoAndBranch(owner, repo, branch string) (*model.ProjectRef, error)
func (*MockProjectConnector) GetVersionsInProject ¶
func (ac *MockProjectConnector) GetVersionsInProject(project, requester string, limit, startOrder int) ([]restModel.APIVersion, error)
func (*MockProjectConnector) UpdateAdminRoles ¶
func (pc *MockProjectConnector) UpdateAdminRoles(project *model.ProjectRef, toAdd, toDelete []string) error
func (*MockProjectConnector) UpdateProject ¶
func (pc *MockProjectConnector) UpdateProject(projectRef *model.ProjectRef) error
func (*MockProjectConnector) UpdateProjectRevision ¶
func (pc *MockProjectConnector) UpdateProjectRevision(projectID, revision string) error
func (*MockProjectConnector) UpdateProjectVars ¶
func (pc *MockProjectConnector) UpdateProjectVars(projectId string, varsModel *restModel.APIProjectVars, overwrite bool) error
type MockProjectTagConnector ¶
type MockProjectTagConnector struct{}
func (MockProjectTagConnector) AddTagsToProject ¶
func (MockProjectTagConnector) AddTagsToProject(id string, tags ...string) error
func (MockProjectTagConnector) FindProjectsByTag ¶
func (MockProjectTagConnector) FindProjectsByTag(tag string) ([]restModel.APIProjectRef, error)
func (MockProjectTagConnector) RemoveTagFromProject ¶
func (MockProjectTagConnector) RemoveTagFromProject(id, tag string) error
type MockRepoTrackerConnector ¶
type MockRepoTrackerConnector struct{}
func (*MockRepoTrackerConnector) TriggerRepotracker ¶
type MockStatsConnector ¶
type MockStatsConnector struct {
CachedTestStats []model.APITestStats
CachedTaskStats []model.APITaskStats
}
func (*MockStatsConnector) GetTaskStats ¶
func (msc *MockStatsConnector) GetTaskStats(filter stats.StatsFilter) ([]model.APITaskStats, error)
GetTaskStats returns the cached task stats, only enforcing the Limit field of the filter.
func (*MockStatsConnector) GetTestStats ¶
func (msc *MockStatsConnector) GetTestStats(filter stats.StatsFilter) ([]model.APITestStats, error)
GetTestStats returns the cached test stats, only enforcing the Limit field of the filter.
func (*MockStatsConnector) SetTaskStats ¶
func (msc *MockStatsConnector) SetTaskStats(baseTaskName string, numStats int)
SetTaskStats sets the cached task stats by generating 'numStats' stats.
func (*MockStatsConnector) SetTestStats ¶
func (msc *MockStatsConnector) SetTestStats(baseTestName string, numStats int)
SetTestStats sets the cached test stats by generating 'numStats' stats.
type MockStatusConnector ¶
type MockStatusConnector struct {
CachedTasks []task.Task
CachedResults *task.ResultCounts
CachedResultCountList *model.APIRecentTaskStatsList
CachedHostStats []host.StatsByDistro
}
MockStatusConnector is a struct that implements mock versions of Distro-related methods for testing.
func (*MockStatusConnector) FindRecentTaskListAgentVersion ¶
func (c *MockStatusConnector) FindRecentTaskListAgentVersion(minutes int) (*model.APIRecentTaskStatsList, error)
func (*MockStatusConnector) FindRecentTaskListDistro ¶
func (c *MockStatusConnector) FindRecentTaskListDistro(minutes int) (*model.APIRecentTaskStatsList, error)
func (*MockStatusConnector) FindRecentTaskListProject ¶
func (c *MockStatusConnector) FindRecentTaskListProject(minutes int) (*model.APIRecentTaskStatsList, error)
func (*MockStatusConnector) FindRecentTasks ¶
func (c *MockStatusConnector) FindRecentTasks(minutes int) ([]task.Task, *task.ResultCounts, error)
FindRecentTasks is a mock implementation for testing.
func (*MockStatusConnector) GetHostStatsByDistro ¶
func (c *MockStatusConnector) GetHostStatsByDistro() ([]host.StatsByDistro, error)
GetHostStatsByDistro returns mock stats for hosts broken down by distro
type MockSubscriptionConnector ¶
type MockSubscriptionConnector struct {
MockSubscriptions []restModel.APISubscription
}
func (*MockSubscriptionConnector) CopyProjectSubscriptions ¶
func (mc *MockSubscriptionConnector) CopyProjectSubscriptions(oldProject, newProject string) error
func (*MockSubscriptionConnector) DeleteSubscriptions ¶
func (mc *MockSubscriptionConnector) DeleteSubscriptions(owner string, ids []string) error
func (*MockSubscriptionConnector) GetSubscriptions ¶
func (mc *MockSubscriptionConnector) GetSubscriptions(owner string, ownerType event.OwnerType) ([]restModel.APISubscription, error)
func (*MockSubscriptionConnector) SaveSubscriptions ¶
func (mc *MockSubscriptionConnector) SaveSubscriptions(owner string, subscriptions []restModel.APISubscription) error
type MockTaskConnector ¶
type MockTaskConnector struct {
CachedTasks []task.Task
CachedOldTasks []task.Task
Manifests []manifest.Manifest
CachedAborted map[string]string
StoredError error
FailOnAbort bool
}
MockTaskConnector stores a cached set of tasks that are queried against by the implementations of the Connector interface's Task related functions.
func (*MockTaskConnector) AbortTask ¶
func (tc *MockTaskConnector) AbortTask(taskId, user string) error
func (*MockTaskConnector) CheckTaskSecret ¶
func (*MockTaskConnector) FindCostTaskByProject ¶
func (*MockTaskConnector) FindOldTasksByIDWithDisplayTasks ¶
func (mtc *MockTaskConnector) FindOldTasksByIDWithDisplayTasks(id string) ([]task.Task, error)
func (*MockTaskConnector) FindTaskById ¶
func (mtc *MockTaskConnector) FindTaskById(taskId string) (*task.Task, error)
FindTaskById provides a mock implementation of the functions for the Connector interface without needing to use a database. It returns results based on the cached tasks in the MockTaskConnector.
func (*MockTaskConnector) FindTaskWithinTimePeriod ¶
func (*MockTaskConnector) FindTasksByBuildId ¶
func (mtc *MockTaskConnector) FindTasksByBuildId(buildId, startTaskId, status string, limit, sortDir int) ([]task.Task, error)
FindTaskByBuildId provides a mock implementation of the function for the Connector interface without needing to use a database. It returns results based on the cached tasks in the MockTaskConnector.
func (*MockTaskConnector) FindTasksByIds ¶
func (mtc *MockTaskConnector) FindTasksByIds(taskIds []string) ([]task.Task, error)
func (*MockTaskConnector) FindTasksByProjectAndCommit ¶
func (mtc *MockTaskConnector) FindTasksByProjectAndCommit(projectId, commitHash, taskId, status string, limit int) ([]task.Task, error)
FindTasksBytaskId
func (*MockTaskConnector) FindTasksByVersion ¶
func (*MockTaskConnector) GetManifestByTask ¶
func (tc *MockTaskConnector) GetManifestByTask(taskId string) (*manifest.Manifest, error)
func (*MockTaskConnector) ResetTask ¶
func (mtc *MockTaskConnector) ResetTask(taskId, username string) error
func (*MockTaskConnector) SetTaskActivated ¶
func (mtc *MockTaskConnector) SetTaskActivated(taskId, user string, activated bool) error
SetTaskActivated changes the activation value of a task using a call to the service layer function.
func (*MockTaskConnector) SetTaskPriority ¶
SetTaskPriority changes the priority value of a task using a call to the service layer function.
type MockTaskReliabilityConnector ¶
type MockTaskReliabilityConnector struct {
CachedTaskReliability []model.APITaskReliability
}
func (*MockTaskReliabilityConnector) GetTaskReliabilityScores ¶
func (msc *MockTaskReliabilityConnector) GetTaskReliabilityScores(filter reliability.TaskReliabilityFilter) ([]model.APITaskReliability, error)
GetTaskReliabilityScores returns the cached task stats, only enforcing the Limit field of the filter.
func (*MockTaskReliabilityConnector) SetTaskReliabilityScores ¶
func (msc *MockTaskReliabilityConnector) SetTaskReliabilityScores(baseTaskName string, numStats int)
SetTaskReliabilityScores sets the cached task stats by generating 'numStats' stats.
type MockTestConnector ¶
type MockTestConnector struct {
CachedTests []testresult.TestResult
StoredError error
}
MockTaskConnector stores a cached set of tests that are queried against by the implementations of the Connector interface's Test related functions.
func (*MockTestConnector) FindTestsByTaskId ¶
func (mtc *MockTestConnector) FindTestsByTaskId(taskId, testId, testName, status string, limit, execution int) ([]testresult.TestResult, error)
func (*MockTestConnector) FindTestsByTaskIdFilterSortPaginate ¶
func (tc *MockTestConnector) FindTestsByTaskIdFilterSortPaginate(taskId, filter string, statuses []string, sortBy string, sortDir, page, limit, execution int) ([]testresult.TestResult, error)
func (*MockTestConnector) GetTestCountByTaskIdAndFilters ¶
type MockUserConnector ¶
MockUserConnector stores a cached set of users that are queried against by the implementations of the UserConnector interface's functions.
func (*MockUserConnector) AddPublicKey ¶
func (muc *MockUserConnector) AddPublicKey(dbuser *user.DBUser, keyName, keyValue string) error
func (*MockUserConnector) DeletePublicKey ¶
func (muc *MockUserConnector) DeletePublicKey(u *user.DBUser, keyName string) error
func (*MockUserConnector) FindUserByGithubName ¶
func (muc *MockUserConnector) FindUserByGithubName(name string) (gimlet.User, error)
func (*MockUserConnector) FindUserById ¶
func (muc *MockUserConnector) FindUserById(userId string) (gimlet.User, error)
FindUserById provides a mock implementation of the User functions from the Connector that does not need to use a database. It returns results based on the cached users in the MockUserConnector.
func (*MockUserConnector) SubmitFeedback ¶
func (u *MockUserConnector) SubmitFeedback(feedback restModel.APIFeedbackSubmission) error
func (*MockUserConnector) UpdateSettings ¶
func (muc *MockUserConnector) UpdateSettings(user *user.DBUser, settings user.UserSettings) error
type MockVersionConnector ¶
type MockVersionConnector struct {
CachedTasks []task.Task
CachedVersions []model.Version
CachedRestartedVersions map[string]string
}
MockVersionConnector stores a cached set of tasks that are queried against by the implementations of the Connector interface's Version related functions.
func (*MockVersionConnector) AbortVersion ¶
func (mvc *MockVersionConnector) AbortVersion(versionId, caller string) error
AbortVersion aborts all tasks of a version given its ID. Specifically, it sets the Aborted key of the tasks to true if they are currently in abortable statuses.
func (*MockVersionConnector) AddGitTagToVersion ¶
func (mvc *MockVersionConnector) AddGitTagToVersion(versionId string, gitTag model.GitTag) error
func (*MockVersionConnector) CreateVersionFromConfig ¶
func (mvc *MockVersionConnector) CreateVersionFromConfig(ctx context.Context, projectInfo *model.ProjectInfo, metadata model.VersionMetadata, active bool) (*model.Version, error)
func (*MockVersionConnector) FindCostByVersionId ¶
func (mvc *MockVersionConnector) FindCostByVersionId(versionId string) (*task.VersionCost, error)
FindCostByVersionId is the mock implementation of the function for the Connector interface without needing to use a database. It returns results based on the cached tasks in the MockVersionConnector.
func (*MockVersionConnector) FindVersionById ¶
func (mvc *MockVersionConnector) FindVersionById(versionId string) (*model.Version, error)
FindVersionById is the mock implementation of the function for the Connector interface without needing to use a database. It returns results based on the cached versions in the MockVersionConnector.
func (*MockVersionConnector) FindVersionByProjectAndRevision ¶
func (mvc *MockVersionConnector) FindVersionByProjectAndRevision(projectId, revision string) (*model.Version, error)
func (*MockVersionConnector) GetVersionsAndVariants ¶
func (mvc *MockVersionConnector) GetVersionsAndVariants(skip, numVersionElements int, project *model.Project) (*restModel.VersionVariantData, error)
func (*MockVersionConnector) LoadProjectForVersion ¶
func (mvc *MockVersionConnector) LoadProjectForVersion(v *model.Version, projectId string) (*model.Project, *model.ParserProject, error)
func (*MockVersionConnector) RestartVersion ¶
func (mvc *MockVersionConnector) RestartVersion(versionId string, caller string) error
The main function of the RestartVersion() for the MockVersionConnector is to test connectivity. It sets the value of versionId in CachedRestartedVersions to the caller.
type NotificationConnector ¶
type NotificationConnector struct{}
func (*NotificationConnector) GetNotificationsStats ¶
func (c *NotificationConnector) GetNotificationsStats() (*restModel.APIEventStats, error)
type RepoTrackerConnector ¶
type RepoTrackerConnector struct{}
func (*RepoTrackerConnector) TriggerRepotracker ¶
type StatsConnector ¶
type StatsConnector struct{}
func (*StatsConnector) GetTaskStats ¶
func (sc *StatsConnector) GetTaskStats(filter stats.StatsFilter) ([]model.APITaskStats, error)
GetTaskStats queries the service backend to retrieve the task stats that match the given filter.
func (*StatsConnector) GetTestStats ¶
func (sc *StatsConnector) GetTestStats(filter stats.StatsFilter) ([]model.APITestStats, error)
GetTestStats queries the service backend to retrieve the test stats that match the given filter.
type TaskReliabilityConnector ¶
type TaskReliabilityConnector struct{}
func (*TaskReliabilityConnector) GetTaskReliabilityScores ¶
func (sc *TaskReliabilityConnector) GetTaskReliabilityScores(filter reliability.TaskReliabilityFilter) ([]model.APITaskReliability, error)
GetTaskReliabilityScores queries the service backend to retrieve the task reliability scores that match the given filter.