@@ -1214,16 +1214,15 @@ func TestWorkspaceBuildTimings(t *testing.T) {
1214
1214
ActiveVersionID : version .ID ,
1215
1215
CreatedBy : owner .UserID ,
1216
1216
})
1217
- ws := dbgen .Workspace (t , db , database.Workspace {
1218
- OwnerID : owner .UserID ,
1219
- OrganizationID : owner .OrganizationID ,
1220
- TemplateID : template .ID ,
1221
- })
1222
1217
1223
- // Create a build to attach timings
1224
- var buildNumber int32
1218
+ // Tests will run in parallel. To avoid conflicts and race conditions on the
1219
+ // build number, each test will have its own workspace and build.
1225
1220
makeBuild := func () database.WorkspaceBuild {
1226
- buildNumber ++
1221
+ ws := dbgen .Workspace (t , db , database.Workspace {
1222
+ OwnerID : owner .UserID ,
1223
+ OrganizationID : owner .OrganizationID ,
1224
+ TemplateID : template .ID ,
1225
+ })
1227
1226
jobID := uuid .New ()
1228
1227
job := dbgen .ProvisionerJob (t , db , pubsub , database.ProvisionerJob {
1229
1228
ID : jobID ,
@@ -1235,7 +1234,7 @@ func TestWorkspaceBuildTimings(t *testing.T) {
1235
1234
TemplateVersionID : version .ID ,
1236
1235
InitiatorID : owner .UserID ,
1237
1236
JobID : job .ID ,
1238
- BuildNumber : buildNumber ,
1237
+ BuildNumber : 1 ,
1239
1238
})
1240
1239
}
1241
1240
0 commit comments