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

Commit882feaf

Browse files
committed
remove barrier
1 parentab630ec commit882feaf

File tree

1 file changed

+31
-43
lines changed

1 file changed

+31
-43
lines changed

‎cli/exp_scaletest.go‎

Lines changed: 31 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@ import (
3333
"github.com/coder/coder/v2/codersdk"
3434
"github.com/coder/coder/v2/codersdk/workspacesdk"
3535
"github.com/coder/coder/v2/scaletest/agentconn"
36-
"github.com/coder/coder/v2/scaletest/coderconnect"
36+
"github.com/coder/coder/v2/scaletest/createusers"
3737
"github.com/coder/coder/v2/scaletest/createworkspaces"
3838
"github.com/coder/coder/v2/scaletest/dashboard"
3939
"github.com/coder/coder/v2/scaletest/harness"
4040
"github.com/coder/coder/v2/scaletest/loadtestutil"
4141
"github.com/coder/coder/v2/scaletest/reconnectingpty"
4242
"github.com/coder/coder/v2/scaletest/workspacebuild"
4343
"github.com/coder/coder/v2/scaletest/workspacetraffic"
44+
"github.com/coder/coder/v2/scaletest/workspaceupdates"
4445
"github.com/coder/serpent"
4546
)
4647

@@ -57,7 +58,7 @@ func (r *RootCmd) scaletestCmd() *serpent.Command {
5758
r.scaletestCleanup(),
5859
r.scaletestDashboard(),
5960
r.scaletestCreateWorkspaces(),
60-
r.scaletestCoderConnect(),
61+
r.scaletestWorkspaceUpdates(),
6162
r.scaletestWorkspaceTraffic(),
6263
},
6364
}
@@ -856,7 +857,7 @@ func (r *RootCmd) scaletestCreateWorkspaces() *serpent.Command {
856857
returncmd
857858
}
858859

859-
func (r*RootCmd)scaletestCoderConnect()*serpent.Command {
860+
func (r*RootCmd)scaletestWorkspaceUpdates()*serpent.Command {
860861
var (
861862
workspaceCountint64
862863
powerUserWorkspacesint64
@@ -865,7 +866,6 @@ func (r *RootCmd) scaletestCoderConnect() *serpent.Command {
865866
dialTimeout time.Duration
866867
templatestring
867868
noCleanupbool
868-
noWaitForAgentsbool
869869

870870
parameterFlagsworkspaceParameterFlags
871871
tracingFlags=&scaletestTracingFlags{}
@@ -877,8 +877,8 @@ func (r *RootCmd) scaletestCoderConnect() *serpent.Command {
877877
)
878878

879879
cmd:=&serpent.Command{
880-
Use:"coder-connect",
881-
Short:"Simulate the load of Coder Desktop clients",
880+
Use:"workspace-updates",
881+
Short:"Simulate the load of Coder Desktop clients receiving workspace updates",
882882
Handler:func(inv*serpent.Invocation)error {
883883
ctx:=inv.Context()
884884
client,err:=r.TryInitClient(inv)
@@ -951,7 +951,6 @@ func (r *RootCmd) scaletestCoderConnect() *serpent.Command {
951951
RichParameterFile:parameterFlags.richParameterFile,
952952
RichParameters:cliRichParameters,
953953
})
954-
_=richParameters
955954
iferr!=nil {
956955
returnxerrors.Errorf("prepare build: %w",err)
957956
}
@@ -963,7 +962,7 @@ func (r *RootCmd) scaletestCoderConnect() *serpent.Command {
963962
tracer:=tracerProvider.Tracer(scaletestTracerName)
964963

965964
reg:=prometheus.NewRegistry()
966-
metrics:=coderconnect.NewMetrics(reg)
965+
metrics:=workspaceupdates.NewMetrics(reg)
967966

968967
logger:=inv.Logger
969968
prometheusSrvClose:=ServeHandler(ctx,logger,promhttp.HandlerFor(reg, promhttp.HandlerOpts{}),prometheusFlags.Address,"prometheus")
@@ -981,13 +980,14 @@ func (r *RootCmd) scaletestCoderConnect() *serpent.Command {
981980

982981
_,_=fmt.Fprintln(inv.Stderr,"Creating users...")
983982

984-
dialBarrier:=harness.NewBarrier(int(powerUserCount+regularUserCount))
983+
dialBarrier:=new(sync.WaitGroup)
984+
dialBarrier.Add(int(powerUserCount+regularUserCount))
985985

986-
configs:=make([]coderconnect.Config,0,powerUserCount+regularUserCount)
986+
configs:=make([]workspaceupdates.Config,0,powerUserCount+regularUserCount)
987987

988-
fori:=int64(0);i<powerUserCount;i++ {
989-
config:=coderconnect.Config{
990-
User:coderconnect.UserConfig{
988+
forrangepowerUserCount {
989+
config:=workspaceupdates.Config{
990+
User:createusers.Config{
991991
OrganizationID:me.OrganizationIDs[0],
992992
},
993993
Workspace: workspacebuild.Config{
@@ -996,13 +996,12 @@ func (r *RootCmd) scaletestCoderConnect() *serpent.Command {
996996
TemplateID:tpl.ID,
997997
RichParameterValues:richParameters,
998998
},
999-
NoWaitForAgents:noWaitForAgents,
999+
NoWaitForAgents:true,
10001000
},
10011001
WorkspaceCount:powerUserWorkspaces,
10021002
WorkspaceUpdatesTimeout:workspaceUpdatesTimeout,
10031003
DialTimeout:dialTimeout,
10041004
Metrics:metrics,
1005-
NoCleanup:noCleanup,
10061005
DialBarrier:dialBarrier,
10071006
}
10081007
iferr:=config.Validate();err!=nil {
@@ -1011,10 +1010,10 @@ func (r *RootCmd) scaletestCoderConnect() *serpent.Command {
10111010
configs=append(configs,config)
10121011
}
10131012

1014-
fori:=int64(0);i<regularUserCount;i++ {
1013+
forrangeregularUserCount {
10151014
workspaceCount:=1
1016-
config:=coderconnect.Config{
1017-
User:coderconnect.UserConfig{
1015+
config:=workspaceupdates.Config{
1016+
User:createusers.Config{
10181017
OrganizationID:me.OrganizationIDs[0],
10191018
},
10201019
Workspace: workspacebuild.Config{
@@ -1023,13 +1022,12 @@ func (r *RootCmd) scaletestCoderConnect() *serpent.Command {
10231022
TemplateID:tpl.ID,
10241023
RichParameterValues:richParameters,
10251024
},
1026-
NoWaitForAgents:noWaitForAgents,
1025+
NoWaitForAgents:true,
10271026
},
10281027
WorkspaceCount:int64(workspaceCount),
10291028
WorkspaceUpdatesTimeout:workspaceUpdatesTimeout,
10301029
DialTimeout:dialTimeout,
10311030
Metrics:metrics,
1032-
NoCleanup:noCleanup,
10331031
DialBarrier:dialBarrier,
10341032
}
10351033
iferr:=config.Validate();err!=nil {
@@ -1040,16 +1038,9 @@ func (r *RootCmd) scaletestCoderConnect() *serpent.Command {
10401038

10411039
th:=harness.NewTestHarness(strategy.toStrategy(),cleanupStrategy.toStrategy())
10421040
fori,config:=rangeconfigs {
1043-
name:=fmt.Sprintf("coderconnect-%dw",config.WorkspaceCount)
1041+
name:=fmt.Sprintf("workspaceupdates-%dw",config.WorkspaceCount)
10441042
id:=strconv.Itoa(i)
1045-
username,email,err:=loadtestutil.GenerateUserIdentifier(id)
1046-
iferr!=nil {
1047-
returnxerrors.Errorf("generate user identifier: %w",err)
1048-
}
1049-
config.User.Username=username
1050-
config.User.Email=email
1051-
1052-
varrunner harness.Runnable=coderconnect.NewRunner(client,config)
1043+
varrunner harness.Runnable=workspaceupdates.NewRunner(client,config)
10531044
iftracingEnabled {
10541045
runner=&runnableTraceWrapper{
10551046
tracer:tracer,
@@ -1061,7 +1052,7 @@ func (r *RootCmd) scaletestCoderConnect() *serpent.Command {
10611052
th.AddRun(name,id,runner)
10621053
}
10631054

1064-
_,_=fmt.Fprintln(inv.Stderr,"RunningCoder Connect scaletest...")
1055+
_,_=fmt.Fprintln(inv.Stderr,"Runningworkspace updates scaletest...")
10651056
testCtx,testCancel:=strategy.toContext(ctx)
10661057
defertestCancel()
10671058
err=th.Run(testCtx)
@@ -1082,12 +1073,14 @@ func (r *RootCmd) scaletestCoderConnect() *serpent.Command {
10821073
}
10831074
}
10841075

1085-
_,_=fmt.Fprintln(inv.Stderr,"\nCleaning up...")
1086-
cleanupCtx,cleanupCancel:=cleanupStrategy.toContext(ctx)
1087-
defercleanupCancel()
1088-
err=th.Cleanup(cleanupCtx)
1089-
iferr!=nil {
1090-
returnxerrors.Errorf("cleanup tests: %w",err)
1076+
if!noCleanup {
1077+
_,_=fmt.Fprintln(inv.Stderr,"\nCleaning up...")
1078+
cleanupCtx,cleanupCancel:=cleanupStrategy.toContext(ctx)
1079+
defercleanupCancel()
1080+
err=th.Cleanup(cleanupCtx)
1081+
iferr!=nil {
1082+
returnxerrors.Errorf("cleanup tests: %w",err)
1083+
}
10911084
}
10921085

10931086
ifres.TotalFail>0 {
@@ -1105,6 +1098,7 @@ func (r *RootCmd) scaletestCoderConnect() *serpent.Command {
11051098
Env:"CODER_SCALETEST_WORKSPACE_COUNT",
11061099
Description:"Required: Total number of workspaces to create.",
11071100
Value:serpent.Int64Of(&workspaceCount),
1101+
Required:true,
11081102
},
11091103
{
11101104
Flag:"power-user-workspaces",
@@ -1131,7 +1125,7 @@ func (r *RootCmd) scaletestCoderConnect() *serpent.Command {
11311125
Flag:"dial-timeout",
11321126
Env:"CODER_SCALETEST_DIAL_TIMEOUT",
11331127
Default:"2m",
1134-
Description:"Timeout for dialing theCoder Connect endpoint.",
1128+
Description:"Timeout for dialing thetailnet endpoint.",
11351129
Value:serpent.DurationOf(&dialTimeout),
11361130
},
11371131
{
@@ -1142,12 +1136,6 @@ func (r *RootCmd) scaletestCoderConnect() *serpent.Command {
11421136
Value:serpent.StringOf(&template),
11431137
Required:true,
11441138
},
1145-
{
1146-
Flag:"no-wait-for-agents",
1147-
Env:"CODER_SCALETEST_NO_WAIT_FOR_AGENTS",
1148-
Description:`Do not wait for agents to start before marking the test as succeeded. This can be useful if you are running the test against a template that does not start the agent quickly.`,
1149-
Value:serpent.BoolOf(&noWaitForAgents),
1150-
},
11511139
{
11521140
Flag:"no-cleanup",
11531141
Env:"CODER_SCALETEST_NO_CLEANUP",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp