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

Skip to content

Commit 26aa87d

Browse files
committed
Merge remote-tracking branch 'origin/main' into jjs/15065
2 parents 89bed47 + 42e2a41 commit 26aa87d

File tree

6 files changed

+26
-24
lines changed

6 files changed

+26
-24
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,8 @@ gen: \
507507
examples/examples.gen.json \
508508
tailnet/tailnettest/coordinatormock.go \
509509
tailnet/tailnettest/coordinateemock.go \
510-
tailnet/tailnettest/multiagentmock.go
510+
tailnet/tailnettest/multiagentmock.go \
511+
coderd/database/pubsub/psmock/psmock.go
511512
.PHONY: gen
512513

513514
# Mark all generated files as fresh so make thinks they're up-to-date. This is
@@ -537,6 +538,7 @@ gen/mark-fresh:
537538
tailnet/tailnettest/coordinatormock.go \
538539
tailnet/tailnettest/coordinateemock.go \
539540
tailnet/tailnettest/multiagentmock.go \
541+
coderd/database/pubsub/psmock/psmock.go \
540542
"
541543

542544
for file in $$files; do

coderd/workspacebuilds_test.go

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,9 +1183,8 @@ func TestPostWorkspaceBuild(t *testing.T) {
11831183
})
11841184
}
11851185

1186+
//nolint:paralleltest
11861187
func TestWorkspaceBuildTimings(t *testing.T) {
1187-
t.Parallel()
1188-
11891188
// Setup the test environment with a template and version
11901189
db, pubsub := dbtestutil.NewDB(t)
11911190
client := coderdtest.New(t, &coderdtest.Options{
@@ -1214,16 +1213,15 @@ func TestWorkspaceBuildTimings(t *testing.T) {
12141213
ActiveVersionID: version.ID,
12151214
CreatedBy: owner.UserID,
12161215
})
1217-
ws := dbgen.Workspace(t, db, database.Workspace{
1218-
OwnerID: owner.UserID,
1219-
OrganizationID: owner.OrganizationID,
1220-
TemplateID: template.ID,
1221-
})
12221216

1223-
// Create a build to attach timings
1224-
var buildNumber int32
1217+
// Tests will run in parallel. To avoid conflicts and race conditions on the
1218+
// build number, each test will have its own workspace and build.
12251219
makeBuild := func() database.WorkspaceBuild {
1226-
buildNumber++
1220+
ws := dbgen.Workspace(t, db, database.Workspace{
1221+
OwnerID: owner.UserID,
1222+
OrganizationID: owner.OrganizationID,
1223+
TemplateID: template.ID,
1224+
})
12271225
jobID := uuid.New()
12281226
job := dbgen.ProvisionerJob(t, db, pubsub, database.ProvisionerJob{
12291227
ID: jobID,
@@ -1235,13 +1233,12 @@ func TestWorkspaceBuildTimings(t *testing.T) {
12351233
TemplateVersionID: version.ID,
12361234
InitiatorID: owner.UserID,
12371235
JobID: job.ID,
1238-
BuildNumber: buildNumber,
1236+
BuildNumber: 1,
12391237
})
12401238
}
12411239

1240+
//nolint:paralleltest
12421241
t.Run("NonExistentBuild", func(t *testing.T) {
1243-
t.Parallel()
1244-
12451242
// When: fetching an inexistent build
12461243
buildID := uuid.New()
12471244
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
@@ -1253,9 +1250,8 @@ func TestWorkspaceBuildTimings(t *testing.T) {
12531250
require.Contains(t, err.Error(), "not found")
12541251
})
12551252

1253+
//nolint:paralleltest
12561254
t.Run("EmptyTimings", func(t *testing.T) {
1257-
t.Parallel()
1258-
12591255
// When: fetching timings for a build with no timings
12601256
build := makeBuild()
12611257
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
@@ -1268,9 +1264,8 @@ func TestWorkspaceBuildTimings(t *testing.T) {
12681264
require.Empty(t, res.AgentScriptTimings)
12691265
})
12701266

1267+
//nolint:paralleltest
12711268
t.Run("ProvisionerTimings", func(t *testing.T) {
1272-
t.Parallel()
1273-
12741269
// When: fetching timings for a build with provisioner timings
12751270
build := makeBuild()
12761271
provisionerTimings := dbgen.ProvisionerJobTimings(t, db, build, 5)
@@ -1295,9 +1290,8 @@ func TestWorkspaceBuildTimings(t *testing.T) {
12951290
}
12961291
})
12971292

1293+
//nolint:paralleltest
12981294
t.Run("AgentScriptTimings", func(t *testing.T) {
1299-
t.Parallel()
1300-
13011295
// When: fetching timings for a build with agent script timings
13021296
build := makeBuild()
13031297
resource := dbgen.WorkspaceResource(t, db, database.WorkspaceResource{
@@ -1329,9 +1323,8 @@ func TestWorkspaceBuildTimings(t *testing.T) {
13291323
}
13301324
})
13311325

1326+
//nolint:paralleltest
13321327
t.Run("NoAgentScripts", func(t *testing.T) {
1333-
t.Parallel()
1334-
13351328
// When: fetching timings for a build with no agent scripts
13361329
build := makeBuild()
13371330
resource := dbgen.WorkspaceResource(t, db, database.WorkspaceResource{
@@ -1350,16 +1343,16 @@ func TestWorkspaceBuildTimings(t *testing.T) {
13501343
})
13511344

13521345
// Some workspaces might not have agents. It is improbable, but possible.
1346+
//nolint:paralleltest
13531347
t.Run("NoAgents", func(t *testing.T) {
1354-
t.Parallel()
1355-
13561348
// When: fetching timings for a build with no agents
13571349
build := makeBuild()
13581350
dbgen.WorkspaceResource(t, db, database.WorkspaceResource{
13591351
JobID: build.JobID,
13601352
})
13611353

13621354
// Then: return a response with empty agent script timings
1355+
// trigger build
13631356
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
13641357
t.Cleanup(cancel)
13651358
res, err := client.WorkspaceBuildTimings(ctx, build.ID)

scaletest/createworkspaces/run_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131

3232
func Test_Runner(t *testing.T) {
3333
t.Parallel()
34+
3435
if testutil.RaceEnabled() {
3536
t.Skip("Race detector enabled, skipping time-sensitive test.")
3637
}

scaletest/reconnectingpty/run_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222

2323
func Test_Runner(t *testing.T) {
2424
t.Parallel()
25+
t.Skip("https://github.com/coder/internal/issues/98")
2526

2627
t.Run("OK", func(t *testing.T) {
2728
t.Parallel()

vpn/serdes.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,16 @@ func (s *serdes[_, _, _]) closeIdempotent() {
103103
})
104104
}
105105

106+
// Close closes the serdes
107+
// nolint: revive
106108
func (s *serdes[_, _, _]) Close() error {
107109
s.closeIdempotent()
108110
s.wg.Wait()
109111
return nil
110112
}
111113

114+
// start starts the goroutines that serialize and deserialize to the conn.
115+
// nolint: revive
112116
func (s *serdes[_, _, _]) start() {
113117
s.wg.Add(2)
114118
go func() {

vpn/speaker.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ func (s *speaker[S, R, _]) recvFromSerdes() {
186186
}
187187
}
188188

189+
// Close closes the speaker
189190
// nolint: revive
190191
func (s *speaker[_, _, _]) Close() error {
191192
s.cancel()

0 commit comments

Comments
 (0)