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

Commitff3cde2

Browse files
committed
remove unnecessary change to CreateFirstUser
1 parentc9ed43c commitff3cde2

File tree

2 files changed

+15
-21
lines changed

2 files changed

+15
-21
lines changed

‎coderd/coderdtest/coderdtest.go‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -602,17 +602,13 @@ var FirstUserParams = codersdk.CreateFirstUserRequest{
602602
// CreateFirstUser creates a user with preset credentials and authenticates
603603
// with the passed in codersdk client. Optionally, pass a function to mutate
604604
// the first user create request as required.
605-
funcCreateFirstUser(t testing.TB,client*codersdk.Client,mutators...func(*codersdk.CreateFirstUserRequest)) codersdk.CreateFirstUserResponse {
606-
params:=FirstUserParams
607-
for_,mut:=rangemutators {
608-
mut(&params)
609-
}
610-
resp,err:=client.CreateFirstUser(context.Background(),params)
605+
funcCreateFirstUser(t testing.TB,client*codersdk.Client) codersdk.CreateFirstUserResponse {
606+
resp,err:=client.CreateFirstUser(context.Background(),FirstUserParams)
611607
require.NoError(t,err)
612608

613609
login,err:=client.LoginWithPassword(context.Background(), codersdk.LoginWithPasswordRequest{
614-
Email:params.Email,
615-
Password:params.Password,
610+
Email:FirstUserParams.Email,
611+
Password:FirstUserParams.Password,
616612
})
617613
require.NoError(t,err)
618614
client.SetSessionToken(login.SessionToken)

‎coderd/workspaces_test.go‎

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -479,13 +479,8 @@ func TestAdminViewAllWorkspaces(t *testing.T) {
479479
funcTestWorkspacesSortOrder(t*testing.T) {
480480
t.Parallel()
481481

482-
ctx,cancel:=context.WithTimeout(context.Background(),testutil.WaitLong)
483-
defercancel()
484-
485482
client,db:=coderdtest.NewWithDatabase(t,nil)
486-
firstUser:=coderdtest.CreateFirstUser(t,client,func(r*codersdk.CreateFirstUserRequest) {
487-
r.Username="aaa"
488-
})
483+
firstUser:=coderdtest.CreateFirstUser(t,client)
489484
secondUserClient,secondUser:=coderdtest.CreateAnotherUserMutators(t,client,firstUser.OrganizationID, []string{"owner"},func(r*codersdk.CreateUserRequest) {
490485
r.Username="zzz"
491486
})
@@ -507,6 +502,9 @@ func TestWorkspacesSortOrder(t *testing.T) {
507502

508503
// f-workspace is also stopped, but is marked as favorite
509504
wsbF:=dbfake.WorkspaceBuild(t,db, database.Workspace{Name:"f-workspace",OwnerID:firstUser.UserID,OrganizationID:firstUser.OrganizationID}).Seed(database.WorkspaceBuild{Transition:database.WorkspaceTransitionStop}).Do()
505+
506+
ctx,cancel:=context.WithTimeout(context.Background(),testutil.WaitLong)
507+
defercancel()
510508
require.NoError(t,client.FavoriteWorkspace(ctx,wsbF.Workspace.ID))// need to do this via API call for now
511509

512510
workspacesResponse,err:=client.Workspaces(ctx, codersdk.WorkspaceFilter{})
@@ -517,9 +515,9 @@ func TestWorkspacesSortOrder(t *testing.T) {
517515
wsbF.Workspace.Name,// favorite
518516
wsbA.Workspace.Name,// running
519517
wsbC.Workspace.Name,// running
520-
wsbB.Workspace.Name,// stopped,aaa < zzz
521-
wsbD.Workspace.Name,// stopped, zzz >aaa
522-
wsbE.Workspace.Name,// stopped, zzz >aaa
518+
wsbB.Workspace.Name,// stopped,testuser < zzz
519+
wsbD.Workspace.Name,// stopped, zzz >testuser
520+
wsbE.Workspace.Name,// stopped, zzz >testuser
523521
}
524522

525523
actualNames:=make([]string,0,len(expectedNames))
@@ -543,10 +541,10 @@ func TestWorkspacesSortOrder(t *testing.T) {
543541
expectedNames= []string{
544542
wsbA.Workspace.Name,// running
545543
wsbC.Workspace.Name,// running
546-
wsbB.Workspace.Name,// stopped,aaa < zzz
547-
wsbF.Workspace.Name,// stopped,aaa < zzz
548-
wsbD.Workspace.Name,// stopped, zzz >aaa
549-
wsbE.Workspace.Name,// stopped, zzz >aaa
544+
wsbB.Workspace.Name,// stopped,testuser < zzz
545+
wsbF.Workspace.Name,// stopped,testuser < zzz
546+
wsbD.Workspace.Name,// stopped, zzz >testuser
547+
wsbE.Workspace.Name,// stopped, zzz >testuser
550548
}
551549

552550
actualNames=make([]string,0,len(expectedNames))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp