88
89
// Config returns the persistence config for connecting to this test cluster
91
>
cfg := s.cfg
92
>
return config.Persistence{
93
>
DefaultStore: "test",
94
>
VisibilityStore: "test",
95
>
DataStores: map[string]config.DataStore{
96
>
"test": {SQL: &cfg, FaultInjection: s.faultInjection},
97
>
},
98
>
TransactionSizeLimit: dynamicconfig.GetIntPropertyFn(primitives.DefaultTransactionSizeLimit),
99
>
}
100
>
}
101
102
// TearDownTestDatabase from PersistenceTestCluster interface
104
>
s.DropDatabase()
105
>
}
106
107
// CreateDatabase from PersistenceTestCluster interface
109
>
cfg2 := s.cfg
110
>
// NOTE need to connect with empty name to create new database
111
>
if cfg2.PluginName != "sqlite" {
112
cfg2.DatabaseName = ""
113
}
114
116
>
defer s.closeAdminDB(db)
117
>
err := db.CreateDatabase(s.cfg.DatabaseName)
118
>
if err != nil {
119
panic(err)
120
}
122
}
123
124
// DropDatabase from PersistenceTestCluster interface
126
>
cfg2 := s.cfg
127
>
128
>
if cfg2.PluginName == "sqlite" && cfg2.DatabaseName != ":memory:" && cfg2.ConnectAttributes["mode"] != "memory" {
129
if len(cfg2.DatabaseName) > 3 { // 3 should mean not ., .., empty, or /
130
// Remove main database file