mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
chore(coderd): allow creating workspaces without specifying an organization (#14048)
This commit is contained in:
committed by
GitHub
parent
56dfc64bb0
commit
bf4b7abf14
@ -1064,7 +1064,7 @@ func (w WorkspaceAgentWaiter) Wait() []codersdk.WorkspaceResource {
|
||||
// CreateWorkspace creates a workspace for the user and template provided.
|
||||
// A random name is generated for it.
|
||||
// To customize the defaults, pass a mutator func.
|
||||
func CreateWorkspace(t testing.TB, client *codersdk.Client, organization uuid.UUID, templateID uuid.UUID, mutators ...func(*codersdk.CreateWorkspaceRequest)) codersdk.Workspace {
|
||||
func CreateWorkspace(t testing.TB, client *codersdk.Client, templateID uuid.UUID, mutators ...func(*codersdk.CreateWorkspaceRequest)) codersdk.Workspace {
|
||||
t.Helper()
|
||||
req := codersdk.CreateWorkspaceRequest{
|
||||
TemplateID: templateID,
|
||||
@ -1076,7 +1076,7 @@ func CreateWorkspace(t testing.TB, client *codersdk.Client, organization uuid.UU
|
||||
for _, mutator := range mutators {
|
||||
mutator(&req)
|
||||
}
|
||||
workspace, err := client.CreateWorkspace(context.Background(), organization, codersdk.Me, req)
|
||||
workspace, err := client.CreateUserWorkspace(context.Background(), codersdk.Me, req)
|
||||
require.NoError(t, err)
|
||||
return workspace
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ func TestNew(t *testing.T) {
|
||||
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, nil)
|
||||
_ = coderdtest.AwaitTemplateVersionJobCompleted(t, client, version.ID)
|
||||
template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID)
|
||||
workspace := coderdtest.CreateWorkspace(t, client, user.OrganizationID, template.ID)
|
||||
workspace := coderdtest.CreateWorkspace(t, client, template.ID)
|
||||
coderdtest.AwaitWorkspaceBuildJobCompleted(t, client, workspace.LatestBuild.ID)
|
||||
coderdtest.AwaitWorkspaceAgents(t, client, workspace.ID)
|
||||
_, _ = coderdtest.NewGoogleInstanceIdentity(t, "example", false)
|
||||
|
@ -89,9 +89,9 @@ func parseSwaggerComment(commentGroup *ast.CommentGroup) SwaggerComment {
|
||||
failures: []response{},
|
||||
}
|
||||
for _, line := range commentGroup.List {
|
||||
// @<annotationName> [args...]
|
||||
// "// @<annotationName> [args...]" -> []string{"//", "@<annotationName>", "args..."}
|
||||
splitN := strings.SplitN(strings.TrimSpace(line.Text), " ", 3)
|
||||
if len(splitN) < 2 {
|
||||
if len(splitN) < 3 {
|
||||
continue // comment prefix without any content
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user