mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
move opts field to dbconn cfg for helper object
This commit is contained in:
committed by
Dan Christian Bogos
parent
3179af0839
commit
9754bdf575
@@ -34,7 +34,7 @@ import (
|
||||
func TestDiamConnStats(t *testing.T) {
|
||||
switch *utils.DBType {
|
||||
case utils.MetaInternal:
|
||||
case utils.MetaMySQL, utils.MetaMongo, utils.MetaPostgres:
|
||||
case utils.MetaMySQL, utils.MetaRedis, utils.MetaMongo, utils.MetaPostgres:
|
||||
t.SkipNow()
|
||||
default:
|
||||
t.Fatal("unsupported dbtype value")
|
||||
|
||||
@@ -410,8 +410,8 @@ func (ng TestEngine) Run(t testing.TB, extraFlags ...string) (*birpc.Client, *co
|
||||
return client, newCfg
|
||||
}
|
||||
|
||||
// Opts contains opts of database
|
||||
type Opts struct {
|
||||
// DBConnOpts contains opts of database
|
||||
type DBConnOpts struct {
|
||||
InternalDBDumpPath *string `json:"internalDBDumpPath,omitempty"`
|
||||
InternalDBDumpInterval *string `json:"internalDBDumpInterval,omitempty"`
|
||||
InternalDBRewriteInterval *string `json:"internalDBRewriteInterval,omitempty"`
|
||||
@@ -419,13 +419,13 @@ type Opts struct {
|
||||
|
||||
// DBConn contains database connection parameters.
|
||||
type DBConn struct {
|
||||
Type *string `json:"db_type,omitempty"`
|
||||
Host *string `json:"db_host,omitempty"`
|
||||
Port *int `json:"db_port,omitempty"`
|
||||
Name *string `json:"db_name,omitempty"`
|
||||
User *string `json:"db_user,omitempty"`
|
||||
Password *string `json:"db_password,omitempty"`
|
||||
Opts Opts `json:"opts,omitempty"`
|
||||
Type *string `json:"db_type,omitempty"`
|
||||
Host *string `json:"db_host,omitempty"`
|
||||
Port *int `json:"db_port,omitempty"`
|
||||
Name *string `json:"db_name,omitempty"`
|
||||
User *string `json:"db_user,omitempty"`
|
||||
Password *string `json:"db_password,omitempty"`
|
||||
Opts DBConnOpts `json:"opts"`
|
||||
}
|
||||
|
||||
// Item contains db item parameters
|
||||
@@ -438,7 +438,6 @@ type Item struct {
|
||||
type DBParams struct {
|
||||
DBConns map[string]DBConn `json:"db_conns,omitempty"`
|
||||
Items map[string]Item `json:"items,omitempty"`
|
||||
Opts map[string]any `json:"opts"`
|
||||
}
|
||||
|
||||
// DBCfg holds the configurations for data_db and/or stor_db.
|
||||
@@ -738,12 +737,12 @@ var (
|
||||
DBConns: map[string]DBConn{
|
||||
utils.MetaDefault: {
|
||||
Type: utils.StringPointer(utils.MetaInternal),
|
||||
Opts: DBConnOpts{
|
||||
InternalDBDumpInterval: utils.StringPointer("0s"),
|
||||
InternalDBRewriteInterval: utils.StringPointer("0s"),
|
||||
},
|
||||
},
|
||||
},
|
||||
Opts: map[string]any{
|
||||
utils.InternalDBDumpIntervalCfg: "0s",
|
||||
utils.InternalDBRewriteIntervalCfg: "0s",
|
||||
},
|
||||
},
|
||||
}
|
||||
MySQLDBCfg = DBCfg{
|
||||
|
||||
@@ -86,7 +86,7 @@ func TestFilterIndexUpdates(t *testing.T) {
|
||||
dbConnCfg.Host, dbConnCfg.Port,
|
||||
dbConnCfg.Name, dbConnCfg.User,
|
||||
dbConnCfg.Password, cfg.GeneralCfg().DBDataEncoding,
|
||||
nil, nil, cfg.DbCfg().Opts, cfg.DbCfg().Items)
|
||||
nil, nil, dbConnCfg.Opts, cfg.DbCfg().Items)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -392,7 +392,7 @@ func benchmarkFilterUpdate(b *testing.B, profileCount, initialValueCount int, fi
|
||||
dbConnCfg.Host, dbConnCfg.Port,
|
||||
dbConnCfg.Name, dbConnCfg.User,
|
||||
dbConnCfg.Password, cfg.GeneralCfg().DBDataEncoding,
|
||||
nil, nil, cfg.DbCfg().Opts, cfg.DbCfg().Items)
|
||||
nil, nil, dbConnCfg.Opts, cfg.DbCfg().Items)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ func TestRankingStore(t *testing.T) {
|
||||
DBConns: map[string]engine.DBConn{
|
||||
utils.MetaDefault: {
|
||||
Type: utils.StringPointer(utils.MetaInternal),
|
||||
Opts: engine.Opts{
|
||||
Opts: engine.DBConnOpts{
|
||||
InternalDBDumpPath: utils.StringPointer("/tmp/internal_db"),
|
||||
},
|
||||
},
|
||||
|
||||
@@ -40,7 +40,7 @@ func TestTrendSchedule(t *testing.T) {
|
||||
DBConns: map[string]engine.DBConn{
|
||||
utils.MetaDefault: {
|
||||
Type: utils.StringPointer(utils.MetaInternal),
|
||||
Opts: engine.Opts{
|
||||
Opts: engine.DBConnOpts{
|
||||
InternalDBDumpInterval: utils.StringPointer("0s"),
|
||||
InternalDBRewriteInterval: utils.StringPointer("0s"),
|
||||
},
|
||||
|
||||
@@ -40,7 +40,7 @@ func TestTrendStore(t *testing.T) {
|
||||
DBConns: map[string]engine.DBConn{
|
||||
utils.MetaDefault: {
|
||||
Type: utils.StringPointer(utils.MetaInternal),
|
||||
Opts: engine.Opts{
|
||||
Opts: engine.DBConnOpts{
|
||||
InternalDBDumpInterval: utils.StringPointer("0s"),
|
||||
InternalDBRewriteInterval: utils.StringPointer("0s"),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user