(t *testing.T)
| 321 | } |
| 322 | |
| 323 | func TestMarkTaskAsDone(t *testing.T) { |
| 324 | t.Parallel() |
| 325 | a := require.New(t) |
| 326 | ctx := context.Background() |
| 327 | ctl := &controller{} |
| 328 | ctx, err := ctl.StartServerWithExternalPg(ctx) |
| 329 | a.NoError(err) |
| 330 | defer ctl.Close(ctx) |
| 331 | |
| 332 | // Provision an instance. |
| 333 | instanceRootDir := t.TempDir() |
| 334 | instanceName := "testInstance1" |
| 335 | instanceDir, err := ctl.provisionSQLiteInstance(instanceRootDir, instanceName) |
| 336 | a.NoError(err) |
| 337 | |
| 338 | // Add an instance. |
| 339 | instanceResp, err := ctl.instanceServiceClient.CreateInstance(ctx, connect.NewRequest(&v1pb.CreateInstanceRequest{ |
| 340 | InstanceId: generateRandomString("instance"), |
| 341 | Instance: &v1pb.Instance{ |
| 342 | Title: instanceName, |
| 343 | Engine: v1pb.Engine_SQLITE, |
| 344 | Environment: new("environments/prod"), |
| 345 | Activation: true, |
| 346 | DataSources: []*v1pb.DataSource{{Type: v1pb.DataSourceType_ADMIN, Host: instanceDir, Id: "admin"}}, |
| 347 | }, |
| 348 | })) |
| 349 | a.NoError(err) |
| 350 | instance := instanceResp.Msg |
| 351 | |
| 352 | // Create an issue that creates a database. |
| 353 | databaseName := "testSchemaUpdate" |
| 354 | err = ctl.createDatabase(ctx, ctl.project, instance, nil, databaseName, "") |
| 355 | a.NoError(err) |
| 356 | |
| 357 | databaseResp, err := ctl.databaseServiceClient.GetDatabase(ctx, connect.NewRequest(&v1pb.GetDatabaseRequest{ |
| 358 | Name: fmt.Sprintf("%s/databases/%s", instance.Name, databaseName), |
| 359 | })) |
| 360 | a.NoError(err) |
| 361 | database := databaseResp.Msg |
| 362 | |
| 363 | sheetResp, err := ctl.sheetServiceClient.CreateSheet(ctx, connect.NewRequest(&v1pb.CreateSheetRequest{ |
| 364 | Parent: ctl.project.Name, |
| 365 | Sheet: &v1pb.Sheet{ |
| 366 | Content: []byte(migrationStatement1), |
| 367 | }, |
| 368 | })) |
| 369 | a.NoError(err) |
| 370 | sheet := sheetResp.Msg |
| 371 | |
| 372 | // Create an issue that updates database schema. |
| 373 | planResp, err := ctl.planServiceClient.CreatePlan(ctx, connect.NewRequest(&v1pb.CreatePlanRequest{ |
| 374 | Parent: ctl.project.Name, |
| 375 | Plan: &v1pb.Plan{ |
| 376 | Specs: []*v1pb.Plan_Spec{ |
| 377 | { |
| 378 | Id: uuid.NewString(), |
| 379 | Config: &v1pb.Plan_Spec_ChangeDatabaseConfig{ |
| 380 | ChangeDatabaseConfig: &v1pb.Plan_ChangeDatabaseConfig{ |
nothing calls this directly
no test coverage detected