MCPcopy Index your code
hub / github.com/bytebase/bytebase / createSQLiteInstance

Function createSQLiteInstance

backend/tests/collision_helper_test.go:458–475  ·  view source on GitHub ↗

createSQLiteInstance provisions and registers a SQLite instance for test use.

(ctx context.Context, t *testing.T, ctl *controller, titlePrefix string)

Source from the content-addressed store, hash-verified

456
457// createSQLiteInstance provisions and registers a SQLite instance for test use.
458func createSQLiteInstance(ctx context.Context, t *testing.T, ctl *controller, titlePrefix string) *v1pb.Instance {
459 t.Helper()
460 a := require.New(t)
461 instanceDir, err := ctl.provisionSQLiteInstance(t.TempDir(), titlePrefix)
462 a.NoError(err)
463 resp, err := ctl.instanceServiceClient.CreateInstance(ctx, connect.NewRequest(&v1pb.CreateInstanceRequest{
464 InstanceId: generateRandomString(titlePrefix),
465 Instance: &v1pb.Instance{
466 Title: titlePrefix,
467 Engine: v1pb.Engine_SQLITE,
468 Environment: new("environments/prod"),
469 Activation: true,
470 DataSources: []*v1pb.DataSource{{Type: v1pb.DataSourceType_ADMIN, Host: instanceDir, Id: "admin"}},
471 },
472 }))
473 a.NoError(err)
474 return resp.Msg
475}
476
477// createPlanAndIssue creates a plan + issue for a DML change targeting the given
478// database, without triggering a rollout. The caller must create the rollout.

Calls 3

generateRandomStringFunction · 0.85
CreateInstanceMethod · 0.65

Tested by

no test coverage detected