| 281 | } |
| 282 | |
| 283 | func (f *Fixture) TriggerDeployment(t *testing.T, org, project string) *database.Deployment { |
| 284 | proj, err := f.Admin.DB.FindProjectByName(t.Context(), org, project) |
| 285 | require.NoError(t, err) |
| 286 | depl, err := f.Admin.DB.FindDeploymentsForProject(t.Context(), proj.ID, "", "") |
| 287 | require.NoError(t, err) |
| 288 | require.Len(t, depl, 1) |
| 289 | err = river.NewReconcileDeploymentWorker(f.Admin).Work(t.Context(), &riverqueue.Job[river.ReconcileDeploymentArgs]{ |
| 290 | Args: river.ReconcileDeploymentArgs{ |
| 291 | DeploymentID: depl[0].ID, |
| 292 | }, |
| 293 | }) |
| 294 | require.NoError(t, err) |
| 295 | depl, err = f.Admin.DB.FindDeploymentsForProject(t.Context(), proj.ID, "", "") |
| 296 | require.NoError(t, err) |
| 297 | require.Len(t, depl, 1) |
| 298 | return depl[0] |
| 299 | } |
| 300 | |
| 301 | // newGithub creates a new Github client. In short testing mode this is a mock client which has no-op implementations of all methods. |
| 302 | // Otherwise it creates a real implementation that makes real API calls to Github. |