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

Commit75222b3

Browse files
committed
add flush to wsproxy tests
1 parent7582d61 commit75222b3

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

‎enterprise/coderd/coderdenttest/proxytest.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ type ProxyOptions struct {
3737

3838
// ProxyURL is optional
3939
ProxyURL*url.URL
40+
41+
// Flush is optional
42+
Flushchanchan<-struct{}
4043
}
4144

4245
// NewWorkspaceProxy will configure a wsproxy.Server with the given options.
@@ -113,6 +116,9 @@ func NewWorkspaceProxy(t *testing.T, coderdAPI *coderd.API, owner *codersdk.Clie
113116
// Inherit collector options from coderd, but keep the wsproxy reporter.
114117
statsCollectorOptions:=coderdAPI.Options.WorkspaceAppsStatsCollectorOptions
115118
statsCollectorOptions.Reporter=nil
119+
ifoptions.Flush!=nil {
120+
statsCollectorOptions.Flush=options.Flush
121+
}
116122

117123
wssrv,err:=wsproxy.New(ctx,&wsproxy.Options{
118124
Logger:slogtest.Make(t,nil).Leveled(slog.LevelDebug),

‎enterprise/wsproxy/wsproxy_test.go‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,13 @@ func TestWorkspaceProxyWorkspaceApps(t *testing.T) {
442442
"*",
443443
}
444444

445+
proxyFlushCh:=make(chanchan<-struct{},1)
446+
flushStats:=func() {
447+
proxyFlushDone:=make(chanstruct{},1)
448+
proxyFlushCh<-proxyFlushDone
449+
<-proxyFlushDone
450+
}
451+
445452
client,closer,api,user:=coderdenttest.NewWithAPI(t,&coderdenttest.Options{
446453
Options:&coderdtest.Options{
447454
DeploymentValues:deploymentValues,
@@ -476,13 +483,15 @@ func TestWorkspaceProxyWorkspaceApps(t *testing.T) {
476483
Name:"best-proxy",
477484
AppHostname:opts.AppHost,
478485
DisablePathApps:opts.DisablePathApps,
486+
Flush:proxyFlushCh,
479487
})
480488

481489
return&apptest.Deployment{
482490
Options:opts,
483491
SDKClient:client,
484492
FirstUser:user,
485493
PathAppBaseURL:proxyAPI.Options.AccessURL,
494+
FlushStats:flushStats,
486495
}
487496
})
488497
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp