MCPcopy Index your code
hub / github.com/coder/coder / seedWorkspaceBinding

Function seedWorkspaceBinding

coderd/x/chatd/subagent_internal_test.go:663–700  ·  view source on GitHub ↗
(
	t *testing.T,
	db database.Store,
	userID uuid.UUID,
)

Source from the content-addressed store, hash-verified

661}
662
663func seedWorkspaceBinding(
664 t *testing.T,
665 db database.Store,
666 userID uuid.UUID,
667) (database.WorkspaceTable, database.WorkspaceBuild, database.WorkspaceAgent) {
668 t.Helper()
669
670 org := dbgen.Organization(t, db, database.Organization{})
671 tv := dbgen.TemplateVersion(t, db, database.TemplateVersion{
672 OrganizationID: org.ID,
673 CreatedBy: userID,
674 })
675 tpl := dbgen.Template(t, db, database.Template{
676 CreatedBy: userID,
677 OrganizationID: org.ID,
678 ActiveVersionID: tv.ID,
679 })
680 workspace := dbgen.Workspace(t, db, database.WorkspaceTable{
681 TemplateID: tpl.ID,
682 OwnerID: userID,
683 OrganizationID: org.ID,
684 })
685 job := dbgen.ProvisionerJob(t, db, nil, database.ProvisionerJob{
686 InitiatorID: userID,
687 OrganizationID: org.ID,
688 })
689 build := dbgen.WorkspaceBuild(t, db, database.WorkspaceBuild{
690 TemplateVersionID: tv.ID,
691 WorkspaceID: workspace.ID,
692 JobID: job.ID,
693 })
694 resource := dbgen.WorkspaceResource(t, db, database.WorkspaceResource{
695 Transition: database.WorkspaceTransitionStart,
696 JobID: job.ID,
697 })
698 agent := dbgen.WorkspaceAgent(t, db, database.WorkspaceAgent{ResourceID: resource.ID})
699 return workspace, build, agent
700}
701
702// findToolByName returns the tool with the given name from the
703// slice, or nil if no match is found.

Calls 9

OrganizationFunction · 0.92
TemplateVersionFunction · 0.92
TemplateFunction · 0.92
WorkspaceFunction · 0.92
ProvisionerJobFunction · 0.92
WorkspaceBuildFunction · 0.92
WorkspaceResourceFunction · 0.92
WorkspaceAgentFunction · 0.92
HelperMethod · 0.65

Tested by

no test coverage detected