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

Function TestSQLExport

backend/tests/sql_export_test.go:21–272  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

19)
20
21func TestSQLExport(t *testing.T) {
22 tests := []struct {
23 databaseName string
24 dbType storepb.Engine
25 prepareStatement string
26 exportTests []struct {
27 format v1pb.ExportFormat
28 statement string
29 password string
30 results []struct {
31 statement string
32 content string
33 }
34 }
35 }{
36 {
37 databaseName: "Test1",
38 dbType: storepb.Engine_MYSQL,
39 prepareStatement: `
40 CREATE TABLE tbl(id INT PRIMARY KEY, name VARCHAR(64), gender BIT(1), height BIT(8));
41 INSERT INTO Test1.tbl (id, name, gender, height) VALUES(1, 'Alice', B'0', B'01111111');
42 `,
43 exportTests: []struct {
44 format v1pb.ExportFormat
45 statement string
46 password string
47 results []struct {
48 statement string
49 content string
50 }
51 }{
52 {
53 format: v1pb.ExportFormat_JSON,
54 password: "123",
55 statement: "SELECT * FROM Test1.tbl;",
56 results: []struct {
57 statement string
58 content string
59 }{
60 {
61 statement: "SELECT * FROM Test1.tbl;",
62 content: `[
63 {
64 "gender": "AA==",
65 "height": "fw==",
66 "id": 1,
67 "name": "Alice"
68 }
69]`,
70 },
71 },
72 },
73 {
74 format: v1pb.ExportFormat_CSV,
75 statement: "SELECT * FROM Test1.tbl;",
76 results: []struct {
77 statement string
78 content string

Callers

nothing calls this directly

Calls 15

CloseMethod · 0.95
createDatabaseMethod · 0.95
changeDatabaseMethod · 0.95
GetInstanceIDFunction · 0.92
getMySQLContainerFunction · 0.85
getPgContainerFunction · 0.85
generateRandomStringFunction · 0.85
CloseMethod · 0.65
CreateInstanceMethod · 0.65
GetDatabaseMethod · 0.65
CreateSheetMethod · 0.65

Tested by

no test coverage detected