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

Function writeTestData

backend/tests/sql_review_test.go:446–466  ·  view source on GitHub ↗
(filepath string, tests []test)

Source from the content-addressed store, hash-verified

444}
445
446func writeTestData(filepath string, tests []test) error {
447 type yamlStruct struct {
448 Statement string
449 Result []string
450 Run bool
451 }
452
453 var yamlTests []yamlStruct
454 for _, t := range tests {
455 yamlTest := yamlStruct{
456 Statement: t.Statement,
457 Run: t.Run,
458 }
459 for _, r := range t.Result {
460 yamlTest.Result = append(yamlTest.Result, protojson.Format(r))
461 }
462 yamlTests = append(yamlTests, yamlTest)
463 }
464
465 return yamltest.WriteFile(filepath, yamlTests)
466}
467
468func createIssueAndReturnSQLReviewResult(ctx context.Context, a *require.Assertions, ctl *controller, project *v1pb.Project, database *v1pb.Database, statement string, wait bool) []*v1pb.PlanCheckRun_Result {
469 sheet, err := ctl.sheetServiceClient.CreateSheet(ctx, connect.NewRequest(&v1pb.CreateSheetRequest{

Callers 2

TestSQLReviewForMySQLFunction · 0.85

Calls 1

WriteFileFunction · 0.92

Tested by

no test coverage detected