Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

test: add unit test to create a workspace for a non-org-member#18534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
Emyrk wants to merge1 commit intomainfromstevenmasley/workspace_for_non_member
Closed
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletionscodersdk/deployment.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1521,7 +1521,7 @@ func (c *DeploymentValues) Options() serpent.OptionSet {
Value: &c.DERP.Config.BlockDirect,
Group: &deploymentGroupNetworkingDERP,
YAML: "blockDirect", Annotations: serpent.Annotations{}.
Mark(annotationExternalProxies, "true"),
Mark(annotationExternalProxies, "true"),
},
{
Name: "DERP Force WebSockets",
Expand DownExpand Up@@ -3380,7 +3380,6 @@ var ExperimentsKnown = Experiments{
ExperimentWebPush,
ExperimentWorkspacePrebuilds,
ExperimentAgenticChat,
ExperimentAITasks,
}

// ExperimentsSafe should include all experiments that are safe for
Expand Down
15 changes: 10 additions & 5 deletionsenterprise/coderd/workspaces_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -260,8 +260,9 @@ func TestCreateUserWorkspace(t *testing.T) {
},
LicenseOptions: &coderdenttest.LicenseOptions{
Features: license.Features{
codersdk.FeatureCustomRoles: 1,
codersdk.FeatureTemplateRBAC: 1,
codersdk.FeatureCustomRoles: 1,
codersdk.FeatureTemplateRBAC: 1,
codersdk.FeatureMultipleOrganizations: 1,
},
},
})
Expand All@@ -277,9 +278,13 @@ func TestCreateUserWorkspace(t *testing.T) {
}),
})
require.NoError(t, err)
secondOrg := coderdenttest.CreateOrganization(t, owner, coderdenttest.CreateOrganizationOptions{})

// use admin for setting up test
admin, adminID := coderdtest.CreateAnotherUser(t, owner, first.OrganizationID, rbac.RoleTemplateAdmin())
admin, _ := coderdtest.CreateAnotherUser(t, owner, first.OrganizationID, rbac.RoleTemplateAdmin())

// user to make the workspace for, **note** the user is not a member of the first org.
_, forUser := coderdtest.CreateAnotherUser(t, owner, secondOrg.ID)

// try the test action with this user & custom role
creator, _ := coderdtest.CreateAnotherUser(t, owner, first.OrganizationID, rbac.RoleMember(), rbac.RoleIdentifier{
Expand All@@ -293,14 +298,14 @@ func TestCreateUserWorkspace(t *testing.T) {

ctx = testutil.Context(t, testutil.WaitLong*1000) // Reset the context to avoid timeouts.

wrk, err := creator.CreateUserWorkspace(ctx,adminID.ID.String(), codersdk.CreateWorkspaceRequest{
wrk, err := creator.CreateUserWorkspace(ctx,forUser.ID.String(), codersdk.CreateWorkspaceRequest{
TemplateID: template.ID,
Name: "workspace",
})
require.NoError(t, err)
coderdtest.AwaitWorkspaceBuildJobCompleted(t, admin, wrk.LatestBuild.ID)

_, err = creator.WorkspaceByOwnerAndName(ctx,adminID.Username, wrk.Name, codersdk.WorkspaceOptions{
_, err = creator.WorkspaceByOwnerAndName(ctx,forUser.Username, wrk.Name, codersdk.WorkspaceOptions{
IncludeDeleted: false,
})
require.NoError(t, err)
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp