@@ -3259,31 +3259,28 @@ func (s *MethodTestSuite) TestExtraMethods() {
3259
3259
}))
3260
3260
s .Run ("GetProvisionerJobsByOrganizationAndStatusWithQueuePositionAndProvisioner" , s .Subtest (func (db database.Store , check * expects ) {
3261
3261
org := dbgen .Organization (s .T (), db , database.Organization {})
3262
+ user := dbgen .User (s .T (), db , database.User {})
3262
3263
tags := database .StringMap (map [string ]string {
3263
3264
provisionersdk .TagScope : provisionersdk .ScopeOrganization ,
3264
3265
})
3265
- t := dbgen .Template (s .T (), db , database.Template {})
3266
- tv := dbgen .TemplateVersion (s .T (), db , database.TemplateVersion {TemplateID : uuid.NullUUID {UUID : t .ID , Valid : true }})
3267
- w := dbgen .Workspace (s .T (), db , database.WorkspaceTable {OrganizationID : org .ID , TemplateID : t .ID })
3268
- wb := dbgen .WorkspaceBuild (s .T (), db , database.WorkspaceBuild {WorkspaceID : w .ID , TemplateVersionID : tv .ID })
3269
- j1 , err := db .InsertProvisionerJob (context .Background (), database.InsertProvisionerJobParams {
3266
+ t := dbgen .Template (s .T (), db , database.Template {OrganizationID : org .ID , CreatedBy : user .ID })
3267
+ tv := dbgen .TemplateVersion (s .T (), db , database.TemplateVersion {OrganizationID : org .ID , CreatedBy : user .ID , TemplateID : uuid.NullUUID {UUID : t .ID , Valid : true }})
3268
+ j1 := dbgen .ProvisionerJob (s .T (), db , nil , database.ProvisionerJob {
3270
3269
OrganizationID : org .ID ,
3271
3270
Type : database .ProvisionerJobTypeTemplateVersionImport ,
3272
3271
Input : []byte (`{"template_version_id":"` + tv .ID .String () + `"}` ),
3273
3272
Tags : tags ,
3274
- Provisioner : database .ProvisionerTypeEcho ,
3275
- StorageMethod : database .ProvisionerStorageMethodFile ,
3276
3273
})
3277
- s .NoError (err , "insert provisioner job" )
3278
- j2 , err := db .InsertProvisionerJob (context .Background (), database.InsertProvisionerJobParams {
3274
+ w := dbgen .Workspace (s .T (), db , database.WorkspaceTable {OrganizationID : org .ID , OwnerID : user .ID , TemplateID : t .ID })
3275
+ wbID := uuid .New ()
3276
+ j2 := dbgen .ProvisionerJob (s .T (), db , nil , database.ProvisionerJob {
3279
3277
OrganizationID : org .ID ,
3280
3278
Type : database .ProvisionerJobTypeWorkspaceBuild ,
3281
- Input : []byte (`{"workspace_build_id":"` + wb . ID .String () + `"}` ),
3279
+ Input : []byte (`{"workspace_build_id":"` + wbID .String () + `"}` ),
3282
3280
Tags : tags ,
3283
- Provisioner : database .ProvisionerTypeEcho ,
3284
- StorageMethod : database .ProvisionerStorageMethodFile ,
3285
3281
})
3286
- s .NoError (err , "insert provisioner job" )
3282
+ dbgen .WorkspaceBuild (s .T (), db , database.WorkspaceBuild {ID : wbID , WorkspaceID : w .ID , TemplateVersionID : tv .ID , JobID : j2 .ID })
3283
+
3287
3284
ds , err := db .GetProvisionerJobsByOrganizationAndStatusWithQueuePositionAndProvisioner (context .Background (), database.GetProvisionerJobsByOrganizationAndStatusWithQueuePositionAndProvisionerParams {
3288
3285
OrganizationID : uuid.NullUUID {Valid : true , UUID : org .ID },
3289
3286
})
0 commit comments