MCPcopy
hub / github.com/ory/keto / GetDSNs

Function GetDSNs

internal/x/dbx/dsn_testutils.go:109–160  ·  view source on GitHub ↗
(t testing.TB, debugSqliteOnDisk bool)

Source from the content-addressed store, hash-verified

107}
108
109func GetDSNs(t testing.TB, debugSqliteOnDisk bool) []*DsnT {
110 dsns := allSqlite(t, debugSqliteOnDisk)
111
112 if !testing.Short() {
113 var mysql, postgres, cockroach string
114 testDB := dbName(t.Name())
115
116 var wg sync.WaitGroup
117 wg.Add(3)
118 go func() {
119 defer wg.Done()
120 postgres = RunPostgres(t, testDB)
121 }()
122 go func() {
123 defer wg.Done()
124 mysql = RunMySQL(t, testDB)
125 }()
126 go func() {
127 defer wg.Done()
128 cockroach = RunCockroach(t, testDB)
129 }()
130 wg.Wait()
131
132 if mysql != "" {
133 dsns = append(dsns, &DsnT{
134 Name: "mysql",
135 Conn: mysql,
136 MigrateUp: true,
137 MigrateDown: true,
138 })
139 }
140 if postgres != "" {
141 dsns = append(dsns, &DsnT{
142 Name: "postgres",
143 Conn: postgres,
144 MigrateUp: true,
145 MigrateDown: true,
146 })
147 }
148 if cockroach != "" {
149 dsns = append(dsns, &DsnT{
150 Name: "cockroach",
151 Conn: cockroach,
152 MigrateUp: true,
153 MigrateDown: true,
154 })
155 }
156 }
157
158 require.NotZero(t, len(dsns), "expected to run against at least one database")
159 return dsns
160}
161
162type sqliteMode = int
163

Callers 8

TestUUIDMappingFunction · 0.92
TestPersisterFunction · 0.92
TestMigrationsFunction · 0.92
TestFunction · 0.92
TestMigrateFunction · 0.92
TestUpAndDownFunction · 0.92

Calls 8

dbNameFunction · 0.85
allSqliteFunction · 0.70
RunPostgresFunction · 0.70
RunMySQLFunction · 0.70
RunCockroachFunction · 0.70
AddMethod · 0.65
DoneMethod · 0.65
NameMethod · 0.45

Tested by 8

TestUUIDMappingFunction · 0.74
TestPersisterFunction · 0.74
TestMigrationsFunction · 0.74
TestFunction · 0.74
TestMigrateFunction · 0.74
TestUpAndDownFunction · 0.74