MCPcopy Create free account
hub / github.com/bytebase/bytebase / TestBuildSnowflakeDSN

Function TestBuildSnowflakeDSN

backend/plugin/db/snowflake/snowflake_test.go:13–78  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestBuildSnowflakeDSN(t *testing.T) {
14 testCases := []struct {
15 input db.ConnectionConfig
16 want string
17 }{
18 {
19 input: db.ConnectionConfig{
20 DataSource: &storepb.DataSource{
21 Host: "nb47110.ap-southeast-1",
22 Port: "443",
23 Username: "bytebase",
24 Password: "pwd",
25 },
26 Password: "pwd",
27 },
28 want: "bytebase:pwd@nb47110.ap-southeast-1.snowflakecomputing.com:443?ocspFailOpen=true&region=ap-southeast-1&validateDefaultParameters=true",
29 },
30 {
31 input: db.ConnectionConfig{
32 DataSource: &storepb.DataSource{
33 Host: "nb47110.ap-southeast-1",
34 Port: "443",
35 Username: "bytebase",
36 Password: "pwd",
37 },
38 Password: "pwd",
39 ConnectionContext: db.ConnectionContext{
40 DatabaseName: "SAMPLE_DB",
41 },
42 },
43 want: "bytebase:pwd@nb47110.ap-southeast-1.snowflakecomputing.com:443?database=%22SAMPLE_DB%22&ocspFailOpen=true&region=ap-southeast-1&validateDefaultParameters=true",
44 },
45 {
46 input: db.ConnectionConfig{
47 DataSource: &storepb.DataSource{
48 Host: "nb47110.ap-southeast-1@10.0.0.1",
49 Port: "4182",
50 Username: "bytebase",
51 Password: "pwd",
52 },
53 Password: "pwd",
54 },
55 want: "bytebase:pwd@10.0.0.1:443?account=nb47110&ocspFailOpen=true&region=ap-southeast-1&validateDefaultParameters=true",
56 },
57 {
58 input: db.ConnectionConfig{
59 DataSource: &storepb.DataSource{
60 Host: "nb47110.ap-southeast-1@10.0.0.1",
61 Port: "4182",
62 Username: "bytebase",
63 Password: "pwd",
64 },
65 Password: "pwd",
66 ConnectionContext: db.ConnectionContext{
67 DatabaseName: "SAMPLE_DB",
68 },
69 },
70 want: "bytebase:pwd@10.0.0.1:443?account=nb47110&database=%22SAMPLE_DB%22&ocspFailOpen=true&region=ap-southeast-1&validateDefaultParameters=true",

Callers

nothing calls this directly

Calls 2

buildSnowflakeDSNFunction · 0.85
EqualMethod · 0.65

Tested by

no test coverage detected