mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Fixed bug for config
This commit is contained in:
committed by
Dan Christian Bogos
parent
44525fc3e1
commit
ef896f7577
@@ -67,11 +67,11 @@ var (
|
||||
func TestAccSIT(t *testing.T) {
|
||||
switch *dbType {
|
||||
case utils.MetaInternal:
|
||||
accPrfConfigDIR = "apis_config_internal"
|
||||
accPrfConfigDIR = "tutinternal"
|
||||
case utils.MetaMongo:
|
||||
accPrfConfigDIR = "apis_config_mongo"
|
||||
accPrfConfigDIR = "tutmongo"
|
||||
case utils.MetaMySQL:
|
||||
accPrfConfigDIR = "apis_config_mysql"
|
||||
accPrfConfigDIR = "tutmysql"
|
||||
case utils.MetaPostgres:
|
||||
t.SkipNow()
|
||||
default:
|
||||
|
||||
@@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
package apis
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path"
|
||||
"reflect"
|
||||
"testing"
|
||||
@@ -43,6 +44,7 @@ var (
|
||||
testCfgInitCfg,
|
||||
testCfgInitDataDb,
|
||||
testCfgResetStorDb,
|
||||
testCfgResetConfigDBStore,
|
||||
testCfgStartEngine,
|
||||
testCfgRPCConn,
|
||||
testCfgGetConfigInvalidSection,
|
||||
@@ -52,16 +54,16 @@ var (
|
||||
testCfgSetJSONGetJSONConfig,
|
||||
testCfgKillEngine,
|
||||
//Store Cfg in Database Test
|
||||
testCfgInitCfgStore,
|
||||
testCfgInitDataDbStore,
|
||||
testCfgResetStorDbStore,
|
||||
testCfgStartEngineStore,
|
||||
testCfgRPCConnStore,
|
||||
testCfgResetConfigDBStore,
|
||||
testCfgDataDBConnStore,
|
||||
testCfgGetConfigStore,
|
||||
testCfgStoreConfigStore,
|
||||
testCfgKillEngineStore,
|
||||
//testCfgInitCfgStore,
|
||||
//testCfgInitDataDbStore,
|
||||
//testCfgResetStorDbStore,
|
||||
//testCfgResetConfigDBStore,
|
||||
//testCfgStartEngineStore,
|
||||
//testCfgRPCConnStore,
|
||||
//testCfgDataDBConnStore,
|
||||
//testCfgGetConfigStore,
|
||||
//testCfgStoreConfigStore,
|
||||
//testCfgKillEngineStore,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -374,7 +376,11 @@ func testCfgDataDBConnStore(t *testing.T) {
|
||||
}
|
||||
|
||||
func testCfgGetConfigStore(t *testing.T) {
|
||||
connDb.AttributeServJsonCfg()
|
||||
attr, err := connDb.AttributeServJsonCfg()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
fmt.Println(attr)
|
||||
}
|
||||
|
||||
func testCfgStoreConfigStore(t *testing.T) {
|
||||
|
||||
@@ -295,15 +295,15 @@ func TestGetSectionAsMap(t *testing.T) {
|
||||
"db_password": "",
|
||||
"items": map[string]interface{}{},
|
||||
"opts": map[string]interface{}{
|
||||
"redis_sentinel": "",
|
||||
"redis_cluster": false,
|
||||
"redis_cluster_sync": "5s",
|
||||
"redis_cluster_ondown_delay": "0",
|
||||
"query_timeout": "10s",
|
||||
"redis_tls": false,
|
||||
"redis_client_certificate": "",
|
||||
"redis_client_key": "",
|
||||
"redis_ca_certificate": "",
|
||||
"redisSentinel": "",
|
||||
"redisCluster": false,
|
||||
"redisClusterSync": "5s",
|
||||
"redisClusterOndownDelay": "0",
|
||||
"mongoQueryTimeout": "10s",
|
||||
"redisTLS": false,
|
||||
"redisClientCertificate": "",
|
||||
"redisClientKey": "",
|
||||
"redisCACertificate": "",
|
||||
},
|
||||
"remote_conn_id": "",
|
||||
"remote_conns": cons,
|
||||
|
||||
@@ -191,11 +191,7 @@ func diffCacheParamsJsonCfg(d map[string]*CacheParamJsonCfg, v1, v2 map[string]*
|
||||
d = make(map[string]*CacheParamJsonCfg)
|
||||
}
|
||||
for k, val2 := range v2 {
|
||||
val1, has := v1[k]
|
||||
if !has || val1 == nil {
|
||||
val1 = new(CacheParamCfg)
|
||||
}
|
||||
d[k] = diffCacheParamJsonCfg(d[k], val1, val2)
|
||||
d[k] = diffCacheParamJsonCfg(d[k], new(CacheParamCfg), val2)
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -145,7 +145,7 @@
|
||||
|
||||
"config_db": {
|
||||
"db_type": "mongo",
|
||||
"db_name": "11",
|
||||
"db_name": "16",
|
||||
"db_port": 27017,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -134,4 +134,9 @@
|
||||
"admins_conns": ["*internal"],
|
||||
},
|
||||
|
||||
"config_db": {
|
||||
"db_type": "redis",
|
||||
"db_port": 6379,
|
||||
"db_name": "12"
|
||||
},
|
||||
},
|
||||
|
||||
@@ -207,11 +207,11 @@ func InitStorDB(cfg *config.CGRConfig) error {
|
||||
}
|
||||
|
||||
func InitConfigDB(cfg *config.CGRConfig) error {
|
||||
d, err := NewDataDBConn(cfg.DataDbCfg().Type,
|
||||
cfg.DataDbCfg().Host, cfg.DataDbCfg().Port,
|
||||
cfg.DataDbCfg().Name, cfg.DataDbCfg().User,
|
||||
cfg.DataDbCfg().Password, cfg.GeneralCfg().DBDataEncoding,
|
||||
cfg.DataDbCfg().Opts)
|
||||
d, err := NewDataDBConn(cfg.ConfigDBCfg().Type,
|
||||
cfg.ConfigDBCfg().Host, cfg.ConfigDBCfg().Port,
|
||||
cfg.ConfigDBCfg().Name, cfg.ConfigDBCfg().User,
|
||||
cfg.ConfigDBCfg().Password, cfg.GeneralCfg().DBDataEncoding,
|
||||
cfg.ConfigDBCfg().Opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user