Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ade1a65

Browse files
committed
fix lint, simplify fakeTelemetry
1 parent 15c1560 commit ade1a65

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

coderd/workspaceagents_test.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2137,6 +2137,7 @@ func TestOwnedWorkspacesCoordinate(t *testing.T) {
21372137
logger := testutil.Logger(t)
21382138

21392139
fTelemetry := newFakeTelemetryReporter(ctx, t, 200)
2140+
fTelemetry.enabled = false
21402141
firstClient, _, api := coderdtest.NewWithAPI(t, &coderdtest.Options{
21412142
Coordinator: tailnet.NewCoordinator(logger),
21422143
TelemetryReporter: fTelemetry,
@@ -2147,10 +2148,8 @@ func TestOwnedWorkspacesCoordinate(t *testing.T) {
21472148
// Create a workspace with an agent
21482149
firstWorkspace := buildWorkspaceWithAgent(t, member, firstUser.OrganizationID, memberUser.ID, api.Database, api.Pubsub)
21492150

2150-
// clean out telemetry snapshots from the setup; we don't care about them for this test
2151-
for len(fTelemetry.snapshots) != 0 {
2152-
<-fTelemetry.snapshots
2153-
}
2151+
// enable telemetry now that workspace is built; we don't care about snapshots before this.
2152+
fTelemetry.enabled = true
21542153

21552154
u, err := member.URL.Parse("/api/v2/tailnet")
21562155
require.NoError(t, err)
@@ -2413,10 +2412,5 @@ func (f *fakeTelemetryReporter) Enabled() bool {
24132412
return f.enabled
24142413
}
24152414

2416-
// SetEnabled allows controlling whether the reporter is enabled.
2417-
func (f *fakeTelemetryReporter) SetEnabled(enabled bool) {
2418-
f.enabled = enabled
2419-
}
2420-
24212415
// Close implements the telemetry.Reporter interface.
2422-
func (f *fakeTelemetryReporter) Close() {}
2416+
func (*fakeTelemetryReporter) Close() {}

0 commit comments

Comments
 (0)