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

Skip to content

Commit 42e2a41

Browse files
authored
fix(coderd): improve workspace tests (#15069)
With [a recent PR](#14923) we introduced [new tests](https://github.com/coder/coder/pull/14923/files#diff-81081239b93aaa61eb8d180a5f9870fda8f0ab5cb4c6727d9d1636aa933e597b) that - while running in parallel to the existing ones - are failing. This PR is a quick proposal to fix it - tested in local and in the CI to unblock the situation. We can ignore it to work on a longer term solution if preferred.
1 parent b8420ec commit 42e2a41

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

coderd/workspacebuilds_test.go

+8-14
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{
@@ -1238,9 +1237,8 @@ func TestWorkspaceBuildTimings(t *testing.T) {
12381237
})
12391238
}
12401239

1240+
//nolint:paralleltest
12411241
t.Run("NonExistentBuild", func(t *testing.T) {
1242-
t.Parallel()
1243-
12441242
// When: fetching an inexistent build
12451243
buildID := uuid.New()
12461244
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
@@ -1252,9 +1250,8 @@ func TestWorkspaceBuildTimings(t *testing.T) {
12521250
require.Contains(t, err.Error(), "not found")
12531251
})
12541252

1253+
//nolint:paralleltest
12551254
t.Run("EmptyTimings", func(t *testing.T) {
1256-
t.Parallel()
1257-
12581255
// When: fetching timings for a build with no timings
12591256
build := makeBuild()
12601257
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
@@ -1267,9 +1264,8 @@ func TestWorkspaceBuildTimings(t *testing.T) {
12671264
require.Empty(t, res.AgentScriptTimings)
12681265
})
12691266

1267+
//nolint:paralleltest
12701268
t.Run("ProvisionerTimings", func(t *testing.T) {
1271-
t.Parallel()
1272-
12731269
// When: fetching timings for a build with provisioner timings
12741270
build := makeBuild()
12751271
provisionerTimings := dbgen.ProvisionerJobTimings(t, db, build, 5)
@@ -1294,9 +1290,8 @@ func TestWorkspaceBuildTimings(t *testing.T) {
12941290
}
12951291
})
12961292

1293+
//nolint:paralleltest
12971294
t.Run("AgentScriptTimings", func(t *testing.T) {
1298-
t.Parallel()
1299-
13001295
// When: fetching timings for a build with agent script timings
13011296
build := makeBuild()
13021297
resource := dbgen.WorkspaceResource(t, db, database.WorkspaceResource{
@@ -1328,9 +1323,8 @@ func TestWorkspaceBuildTimings(t *testing.T) {
13281323
}
13291324
})
13301325

1326+
//nolint:paralleltest
13311327
t.Run("NoAgentScripts", func(t *testing.T) {
1332-
t.Parallel()
1333-
13341328
// When: fetching timings for a build with no agent scripts
13351329
build := makeBuild()
13361330
resource := dbgen.WorkspaceResource(t, db, database.WorkspaceResource{
@@ -1349,16 +1343,16 @@ func TestWorkspaceBuildTimings(t *testing.T) {
13491343
})
13501344

13511345
// Some workspaces might not have agents. It is improbable, but possible.
1346+
//nolint:paralleltest
13521347
t.Run("NoAgents", func(t *testing.T) {
1353-
t.Parallel()
1354-
13551348
// When: fetching timings for a build with no agents
13561349
build := makeBuild()
13571350
dbgen.WorkspaceResource(t, db, database.WorkspaceResource{
13581351
JobID: build.JobID,
13591352
})
13601353

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

0 commit comments

Comments
 (0)