mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-20 14:48:43 +05:00
Added StroreDb config
This commit is contained in:
@@ -60,8 +60,9 @@ func TestDMitMongo(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
dataDB, err := NewMongoStorage(mgoITCfg.StorDBHost, mgoITCfg.StorDBPort,
|
||||
mgoITCfg.StorDBName, mgoITCfg.StorDBUser, mgoITCfg.StorDBPass,
|
||||
dataDB, err := NewMongoStorage(mgoITCfg.StorDbCfg().StorDBHost,
|
||||
mgoITCfg.StorDbCfg().StorDBPort, mgoITCfg.StorDbCfg().StorDBName,
|
||||
mgoITCfg.StorDbCfg().StorDBUser, mgoITCfg.StorDbCfg().StorDBPass,
|
||||
utils.StorDB, nil, mgoITCfg.CacheCfg())
|
||||
if err != nil {
|
||||
t.Fatal("Could not connect to Mongo", err.Error())
|
||||
|
||||
@@ -82,13 +82,14 @@ func TestFilterIndexerITMongo(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
mongoDB, err := NewMongoStorage(mgoITCfg.StorDBHost, mgoITCfg.StorDBPort,
|
||||
mgoITCfg.StorDBName, mgoITCfg.StorDBUser, mgoITCfg.StorDBPass,
|
||||
mongoDB, err := NewMongoStorage(mgoITCfg.StorDbCfg().StorDBHost,
|
||||
mgoITCfg.StorDbCfg().StorDBPort, mgoITCfg.StorDbCfg().StorDBName,
|
||||
mgoITCfg.StorDbCfg().StorDBUser, mgoITCfg.StorDbCfg().StorDBPass,
|
||||
utils.StorDB, nil, mgoITCfg.CacheCfg())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
cfgDBName = mgoITCfg.StorDBName
|
||||
cfgDBName = mgoITCfg.StorDbCfg().StorDBName
|
||||
dataManager = NewDataManager(mongoDB)
|
||||
for _, stest := range sTests {
|
||||
t.Run("TestITMongo", stest)
|
||||
|
||||
@@ -55,18 +55,20 @@ func InitDataDb(cfg *config.CGRConfig) error {
|
||||
|
||||
func InitStorDb(cfg *config.CGRConfig) error {
|
||||
x := []string{utils.MYSQL, utils.POSTGRES}
|
||||
storDb, err := ConfigureLoadStorage(cfg.StorDBType,
|
||||
cfg.StorDBHost, cfg.StorDBPort, cfg.StorDBName,
|
||||
cfg.StorDBUser, cfg.StorDBPass, cfg.DBDataEncoding,
|
||||
cfg.StorDBMaxOpenConns, cfg.StorDBMaxIdleConns,
|
||||
cfg.StorDBConnMaxLifetime, cfg.StorDBCDRSIndexes)
|
||||
storDb, err := ConfigureLoadStorage(cfg.StorDbCfg().StorDBType,
|
||||
cfg.StorDbCfg().StorDBHost, cfg.StorDbCfg().StorDBPort,
|
||||
cfg.StorDbCfg().StorDBName, cfg.StorDbCfg().StorDBUser,
|
||||
cfg.StorDbCfg().StorDBPass, cfg.DBDataEncoding,
|
||||
cfg.StorDbCfg().StorDBMaxOpenConns, cfg.StorDbCfg().StorDBMaxIdleConns,
|
||||
cfg.StorDbCfg().StorDBConnMaxLifetime, cfg.StorDbCfg().StorDBCDRSIndexes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := storDb.Flush(path.Join(cfg.DataFolderPath, "storage", cfg.StorDBType)); err != nil {
|
||||
if err := storDb.Flush(path.Join(cfg.DataFolderPath, "storage",
|
||||
cfg.StorDbCfg().StorDBType)); err != nil {
|
||||
return err
|
||||
}
|
||||
if utils.IsSliceMember(x, cfg.StorDBType) {
|
||||
if utils.IsSliceMember(x, cfg.StorDbCfg().StorDBType) {
|
||||
if err := SetDBVersions(storDb); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ var tpCsvScenario = flag.String("tp_scenario", "testtp", "Use this scenario fold
|
||||
// Will use 3 different datadbs in order to be able to see differences in data loaded
|
||||
func TestLoaderITConnDataDbs(t *testing.T) {
|
||||
lCfg, _ = config.NewDefaultCGRConfig()
|
||||
lCfg.StorDBPass = "CGRateS.org"
|
||||
lCfg.StorDbCfg().StorDBPass = "CGRateS.org"
|
||||
var err error
|
||||
if dataDbCsv, err = ConfigureDataStorage(lCfg.DataDbCfg().DataDbType,
|
||||
lCfg.DataDbCfg().DataDbHost, lCfg.DataDbCfg().DataDbPort, "7",
|
||||
@@ -71,8 +71,11 @@ func TestLoaderITConnDataDbs(t *testing.T) {
|
||||
|
||||
// Create/reset storage tariff plan tables, used as database connectin establishment also
|
||||
func TestLoaderITCreateStorTpTables(t *testing.T) {
|
||||
db, err := NewMySQLStorage(lCfg.StorDBHost, lCfg.StorDBPort, lCfg.StorDBName,
|
||||
lCfg.StorDBUser, lCfg.StorDBPass, lCfg.StorDBMaxOpenConns, lCfg.StorDBMaxIdleConns, lCfg.StorDBConnMaxLifetime)
|
||||
db, err := NewMySQLStorage(lCfg.StorDbCfg().StorDBHost,
|
||||
lCfg.StorDbCfg().StorDBPort, lCfg.StorDbCfg().StorDBName,
|
||||
lCfg.StorDbCfg().StorDBUser, lCfg.StorDbCfg().StorDBPass,
|
||||
lCfg.StorDbCfg().StorDBMaxOpenConns, lCfg.StorDbCfg().StorDBMaxIdleConns,
|
||||
lCfg.StorDbCfg().StorDBConnMaxLifetime)
|
||||
if err != nil {
|
||||
t.Error("Error on opening database connection: ", err)
|
||||
}
|
||||
|
||||
@@ -114,12 +114,13 @@ func TestOnStorITMongo(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if mgoITdb, err = NewMongoStorage(mgoITCfg.StorDBHost, mgoITCfg.StorDBPort,
|
||||
mgoITCfg.StorDBName, mgoITCfg.StorDBUser, mgoITCfg.StorDBPass,
|
||||
if mgoITdb, err = NewMongoStorage(mgoITCfg.StorDbCfg().StorDBHost,
|
||||
mgoITCfg.StorDbCfg().StorDBPort, mgoITCfg.StorDbCfg().StorDBName,
|
||||
mgoITCfg.StorDbCfg().StorDBUser, mgoITCfg.StorDbCfg().StorDBPass,
|
||||
utils.StorDB, nil, mgoITCfg.CacheCfg()); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
onStorCfg = mgoITCfg.StorDBName
|
||||
onStorCfg = mgoITCfg.StorDbCfg().StorDBName
|
||||
onStor = NewDataManager(mgoITdb)
|
||||
for _, stest := range sTestsOnStorIT {
|
||||
t.Run("TestOnStorITMongo", stest)
|
||||
|
||||
@@ -84,8 +84,12 @@ func testSetCDR(cfg *config.CGRConfig) error {
|
||||
if err := InitStorDb(cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
cdrStorage, err := ConfigureCdrStorage(cfg.StorDBType, cfg.StorDBHost, cfg.StorDBPort, cfg.StorDBName, cfg.StorDBUser, cfg.StorDBPass,
|
||||
cfg.StorDBMaxOpenConns, cfg.StorDBMaxIdleConns, cfg.StorDBConnMaxLifetime, cfg.StorDBCDRSIndexes)
|
||||
cdrStorage, err := ConfigureCdrStorage(cfg.StorDbCfg().StorDBType,
|
||||
cfg.StorDbCfg().StorDBHost, cfg.StorDbCfg().StorDBPort,
|
||||
cfg.StorDbCfg().StorDBName, cfg.StorDbCfg().StorDBUser,
|
||||
cfg.StorDbCfg().StorDBPass, cfg.StorDbCfg().StorDBMaxOpenConns,
|
||||
cfg.StorDbCfg().StorDBMaxIdleConns, cfg.StorDbCfg().StorDBConnMaxLifetime,
|
||||
cfg.StorDbCfg().StorDBCDRSIndexes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -186,8 +190,12 @@ func testSMCosts(cfg *config.CGRConfig) error {
|
||||
if err := InitStorDb(cfg); err != nil {
|
||||
return fmt.Errorf("testSMCosts #1 err: %v", err)
|
||||
}
|
||||
cdrStorage, err := ConfigureCdrStorage(cfg.StorDBType, cfg.StorDBHost, cfg.StorDBPort, cfg.StorDBName, cfg.StorDBUser, cfg.StorDBPass,
|
||||
cfg.StorDBMaxOpenConns, cfg.StorDBMaxIdleConns, cfg.StorDBConnMaxLifetime, cfg.StorDBCDRSIndexes)
|
||||
cdrStorage, err := ConfigureCdrStorage(cfg.StorDbCfg().StorDBType,
|
||||
cfg.StorDbCfg().StorDBHost, cfg.StorDbCfg().StorDBPort,
|
||||
cfg.StorDbCfg().StorDBName, cfg.StorDbCfg().StorDBUser,
|
||||
cfg.StorDbCfg().StorDBPass, cfg.StorDbCfg().StorDBMaxOpenConns,
|
||||
cfg.StorDbCfg().StorDBMaxIdleConns, cfg.StorDbCfg().StorDBConnMaxLifetime,
|
||||
cfg.StorDbCfg().StorDBCDRSIndexes)
|
||||
if err != nil {
|
||||
return fmt.Errorf("testSMCosts #2 err: %v", err)
|
||||
}
|
||||
@@ -195,7 +203,7 @@ func testSMCosts(cfg *config.CGRConfig) error {
|
||||
Direction: utils.OUT,
|
||||
Destination: "+4986517174963",
|
||||
Timespans: []*TimeSpan{
|
||||
&TimeSpan{
|
||||
{
|
||||
TimeStart: time.Date(2015, 12, 28, 8, 53, 0, 0, time.UTC),
|
||||
TimeEnd: time.Date(2015, 12, 28, 8, 54, 40, 0, time.UTC),
|
||||
DurationIndex: 0,
|
||||
@@ -235,8 +243,12 @@ func testGetCDRs(cfg *config.CGRConfig) error {
|
||||
if err := InitStorDb(cfg); err != nil {
|
||||
return fmt.Errorf("testGetCDRs #1: %v", err)
|
||||
}
|
||||
cdrStorage, err := ConfigureCdrStorage(cfg.StorDBType, cfg.StorDBHost, cfg.StorDBPort, cfg.StorDBName, cfg.StorDBUser, cfg.StorDBPass,
|
||||
cfg.StorDBMaxOpenConns, cfg.StorDBMaxIdleConns, cfg.StorDBConnMaxLifetime, cfg.StorDBCDRSIndexes)
|
||||
cdrStorage, err := ConfigureCdrStorage(cfg.StorDbCfg().StorDBType,
|
||||
cfg.StorDbCfg().StorDBHost, cfg.StorDbCfg().StorDBPort,
|
||||
cfg.StorDbCfg().StorDBName, cfg.StorDbCfg().StorDBUser,
|
||||
cfg.StorDbCfg().StorDBPass, cfg.StorDbCfg().StorDBMaxOpenConns,
|
||||
cfg.StorDbCfg().StorDBMaxIdleConns, cfg.StorDbCfg().StorDBConnMaxLifetime,
|
||||
cfg.StorDbCfg().StorDBCDRSIndexes)
|
||||
if err != nil {
|
||||
return fmt.Errorf("testGetCDRs #2: %v", err)
|
||||
}
|
||||
@@ -245,7 +257,7 @@ func testGetCDRs(cfg *config.CGRConfig) error {
|
||||
return fmt.Errorf("testGetCDRs #3: %v", err)
|
||||
}
|
||||
cdrs := []*CDR{
|
||||
&CDR{
|
||||
{
|
||||
CGRID: utils.Sha1("testevent1", time.Date(2015, 12, 12, 14, 52, 0, 0, time.UTC).String()),
|
||||
RunID: utils.MetaRaw,
|
||||
OriginHost: "127.0.0.1",
|
||||
@@ -265,7 +277,7 @@ func testGetCDRs(cfg *config.CGRConfig) error {
|
||||
CostSource: "",
|
||||
Cost: -1,
|
||||
},
|
||||
&CDR{
|
||||
{
|
||||
CGRID: utils.Sha1("testevent1", time.Date(2015, 12, 12, 14, 52, 0, 0, time.UTC).String()),
|
||||
RunID: utils.META_DEFAULT,
|
||||
OriginHost: "127.0.0.1",
|
||||
@@ -285,7 +297,7 @@ func testGetCDRs(cfg *config.CGRConfig) error {
|
||||
CostSource: "testGetCDRs",
|
||||
Cost: 0.17,
|
||||
},
|
||||
&CDR{
|
||||
{
|
||||
CGRID: utils.Sha1("testevent1", time.Date(2015, 12, 12, 14, 52, 0, 0, time.UTC).String()),
|
||||
RunID: "run2",
|
||||
OriginHost: "127.0.0.1",
|
||||
@@ -305,7 +317,7 @@ func testGetCDRs(cfg *config.CGRConfig) error {
|
||||
CostSource: "testGetCDRs",
|
||||
Cost: 0.17,
|
||||
},
|
||||
&CDR{
|
||||
{
|
||||
CGRID: utils.Sha1("testevent2", time.Date(2015, 12, 29, 12, 58, 0, 0, time.UTC).String()),
|
||||
RunID: utils.META_DEFAULT,
|
||||
OriginHost: "192.168.1.12",
|
||||
@@ -325,7 +337,7 @@ func testGetCDRs(cfg *config.CGRConfig) error {
|
||||
CostSource: "rater1",
|
||||
Cost: 0,
|
||||
},
|
||||
&CDR{
|
||||
{
|
||||
CGRID: utils.Sha1("testevent3", time.Date(2015, 12, 28, 12, 58, 0, 0, time.UTC).String()),
|
||||
RunID: utils.MetaRaw,
|
||||
OriginHost: "192.168.1.13",
|
||||
@@ -345,7 +357,7 @@ func testGetCDRs(cfg *config.CGRConfig) error {
|
||||
CostSource: "",
|
||||
Cost: -1,
|
||||
},
|
||||
&CDR{
|
||||
{
|
||||
CGRID: utils.Sha1("testevent3", time.Date(2015, 12, 28, 12, 58, 0, 0, time.UTC).String()),
|
||||
RunID: utils.META_DEFAULT,
|
||||
OriginHost: "192.168.1.13",
|
||||
@@ -366,7 +378,7 @@ func testGetCDRs(cfg *config.CGRConfig) error {
|
||||
Cost: -1,
|
||||
ExtraInfo: "AccountNotFound",
|
||||
},
|
||||
&CDR{
|
||||
{
|
||||
CGRID: utils.Sha1("testevent4", time.Date(2015, 12, 14, 14, 52, 0, 0, time.UTC).String()),
|
||||
RunID: utils.MetaRaw,
|
||||
OriginHost: "192.168.1.14",
|
||||
@@ -386,7 +398,7 @@ func testGetCDRs(cfg *config.CGRConfig) error {
|
||||
CostSource: "",
|
||||
Cost: -1,
|
||||
},
|
||||
&CDR{
|
||||
{
|
||||
CGRID: utils.Sha1("testevent4", time.Date(2015, 12, 14, 14, 52, 0, 0, time.UTC).String()),
|
||||
RunID: utils.META_DEFAULT,
|
||||
OriginHost: "192.168.1.14",
|
||||
@@ -406,7 +418,7 @@ func testGetCDRs(cfg *config.CGRConfig) error {
|
||||
CostSource: "testSetCDRs",
|
||||
Cost: 1.205,
|
||||
},
|
||||
&CDR{
|
||||
{
|
||||
CGRID: utils.Sha1("testevent5", time.Date(2015, 12, 15, 18, 22, 0, 0, time.UTC).String()),
|
||||
RunID: utils.MetaRaw,
|
||||
OriginHost: "127.0.0.1",
|
||||
@@ -426,7 +438,7 @@ func testGetCDRs(cfg *config.CGRConfig) error {
|
||||
CostSource: "",
|
||||
Cost: -1,
|
||||
},
|
||||
&CDR{
|
||||
{
|
||||
CGRID: utils.Sha1("testevent5", time.Date(2015, 12, 15, 18, 22, 0, 0, time.UTC).String()),
|
||||
RunID: utils.META_DEFAULT,
|
||||
OriginHost: "127.0.0.1",
|
||||
@@ -757,7 +769,7 @@ func testGetCDRs(cfg *config.CGRConfig) error {
|
||||
if CDRs, _, err := cdrStorage.GetCDRs(&utils.CDRsFilter{OrderBy: "OrderID;desc"}, false); err != nil {
|
||||
return fmt.Errorf("testGetCDRs #95, err: %v", err)
|
||||
} else {
|
||||
for i, _ := range CDRs {
|
||||
for i := range CDRs {
|
||||
if i+1 > len(CDRs)-1 {
|
||||
break
|
||||
}
|
||||
@@ -770,7 +782,7 @@ func testGetCDRs(cfg *config.CGRConfig) error {
|
||||
if CDRs, _, err := cdrStorage.GetCDRs(&utils.CDRsFilter{OrderBy: "OrderID"}, false); err != nil {
|
||||
return fmt.Errorf("testGetCDRs #95, err: %v", err)
|
||||
} else {
|
||||
for i, _ := range CDRs {
|
||||
for i := range CDRs {
|
||||
if i+1 > len(CDRs)-1 {
|
||||
break
|
||||
}
|
||||
@@ -783,7 +795,7 @@ func testGetCDRs(cfg *config.CGRConfig) error {
|
||||
if CDRs, _, err := cdrStorage.GetCDRs(&utils.CDRsFilter{OrderBy: "Cost;desc"}, false); err != nil {
|
||||
return fmt.Errorf("testGetCDRs #95, err: %v", err)
|
||||
} else {
|
||||
for i, _ := range CDRs {
|
||||
for i := range CDRs {
|
||||
if i+1 > len(CDRs)-1 {
|
||||
break
|
||||
}
|
||||
@@ -796,7 +808,7 @@ func testGetCDRs(cfg *config.CGRConfig) error {
|
||||
if CDRs, _, err := cdrStorage.GetCDRs(&utils.CDRsFilter{OrderBy: "Cost"}, false); err != nil {
|
||||
return fmt.Errorf("testGetCDRs #95, err: %v", err)
|
||||
} else {
|
||||
for i, _ := range CDRs {
|
||||
for i := range CDRs {
|
||||
if i+1 > len(CDRs)-1 {
|
||||
break
|
||||
}
|
||||
|
||||
@@ -66,8 +66,11 @@ func TestStorDBitMySQL(t *testing.T) {
|
||||
if cfg, err = config.NewCGRConfigFromFolder(path.Join(*dataDir, "conf", "samples", "storage", "mysql")); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if storDB, err = NewMySQLStorage(cfg.StorDBHost, cfg.StorDBPort, cfg.StorDBName,
|
||||
cfg.StorDBUser, cfg.StorDBPass, cfg.StorDBMaxOpenConns, cfg.StorDBMaxIdleConns, cfg.StorDBConnMaxLifetime); err != nil {
|
||||
if storDB, err = NewMySQLStorage(cfg.StorDbCfg().StorDBHost,
|
||||
cfg.StorDbCfg().StorDBPort, cfg.StorDbCfg().StorDBName,
|
||||
cfg.StorDbCfg().StorDBUser, cfg.StorDbCfg().StorDBPass,
|
||||
cfg.StorDbCfg().StorDBMaxOpenConns, cfg.StorDbCfg().StorDBMaxIdleConns,
|
||||
cfg.StorDbCfg().StorDBConnMaxLifetime); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
storDB2ndDBname = "mysql"
|
||||
@@ -83,8 +86,11 @@ func TestStorDBitPostgresSQL(t *testing.T) {
|
||||
if cfg, err = config.NewCGRConfigFromFolder(path.Join(*dataDir, "conf", "samples", "storage", "postgres")); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if storDB, err = NewPostgresStorage(cfg.StorDBHost, cfg.StorDBPort, cfg.StorDBName,
|
||||
cfg.StorDBUser, cfg.StorDBPass, cfg.StorDBMaxOpenConns, cfg.StorDBMaxIdleConns, cfg.StorDBConnMaxLifetime); err != nil {
|
||||
if storDB, err = NewPostgresStorage(cfg.StorDbCfg().StorDBHost,
|
||||
cfg.StorDbCfg().StorDBPort, cfg.StorDbCfg().StorDBName,
|
||||
cfg.StorDbCfg().StorDBUser, cfg.StorDbCfg().StorDBPass,
|
||||
cfg.StorDbCfg().StorDBMaxOpenConns, cfg.StorDbCfg().StorDBMaxIdleConns,
|
||||
cfg.StorDbCfg().StorDBConnMaxLifetime); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
storDB2ndDBname = "postgres"
|
||||
@@ -100,8 +106,10 @@ func TestStorDBitMongo(t *testing.T) {
|
||||
if cfg, err = config.NewCGRConfigFromFolder(path.Join(*dataDir, "conf", "samples", "storage", "mongo")); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if storDB, err = NewMongoStorage(cfg.StorDBHost, cfg.StorDBPort, cfg.StorDBName,
|
||||
cfg.StorDBUser, cfg.StorDBPass, utils.StorDB, cfg.StorDBCDRSIndexes, nil); err != nil {
|
||||
if storDB, err = NewMongoStorage(cfg.StorDbCfg().StorDBHost,
|
||||
cfg.StorDbCfg().StorDBPort, cfg.StorDbCfg().StorDBName,
|
||||
cfg.StorDbCfg().StorDBUser, cfg.StorDbCfg().StorDBPass,
|
||||
utils.StorDB, cfg.StorDbCfg().StorDBCDRSIndexes, nil); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
storDB2ndDBname = "todo"
|
||||
@@ -143,7 +151,7 @@ func testStorDBitCRUDTpTimings(t *testing.T) {
|
||||
}
|
||||
// WRITE
|
||||
var snd = []*utils.ApierTPTiming{
|
||||
&utils.ApierTPTiming{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
ID: "testTag1",
|
||||
Years: "*any",
|
||||
@@ -152,7 +160,7 @@ func testStorDBitCRUDTpTimings(t *testing.T) {
|
||||
WeekDays: "1;2;3;4;5",
|
||||
Time: "01:00:00",
|
||||
},
|
||||
&utils.ApierTPTiming{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
ID: "testTag2",
|
||||
Years: "*any",
|
||||
@@ -204,12 +212,12 @@ func testStorDBitCRUDTpDestinations(t *testing.T) {
|
||||
}
|
||||
// WRITE
|
||||
snd := []*utils.TPDestination{
|
||||
&utils.TPDestination{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
ID: "testTag1",
|
||||
Prefixes: []string{`0256`, `0257`, `0723`, `+49`},
|
||||
},
|
||||
&utils.TPDestination{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
ID: "testTag2",
|
||||
Prefixes: []string{`0256`, `0257`, `0723`, `+49`},
|
||||
@@ -227,7 +235,7 @@ func testStorDBitCRUDTpDestinations(t *testing.T) {
|
||||
prfs[prf] = true
|
||||
}
|
||||
pfrOk := true
|
||||
for i, _ := range rcv[0].Prefixes {
|
||||
for i := range rcv[0].Prefixes {
|
||||
found1, _ := prfs[rcv[0].Prefixes[i]]
|
||||
found2, _ := prfs[rcv[1].Prefixes[i]]
|
||||
if !found1 && !found2 {
|
||||
@@ -257,7 +265,7 @@ func testStorDBitCRUDTpDestinations(t *testing.T) {
|
||||
prfs[prf] = true
|
||||
}
|
||||
pfrOk := true
|
||||
for i, _ := range rcv[0].Prefixes {
|
||||
for i := range rcv[0].Prefixes {
|
||||
found1, _ := prfs[rcv[0].Prefixes[i]]
|
||||
found2, _ := prfs[rcv[1].Prefixes[i]]
|
||||
if !found1 && !found2 {
|
||||
@@ -289,18 +297,18 @@ func testStorDBitCRUDTpRates(t *testing.T) {
|
||||
}
|
||||
// WRITE
|
||||
var snd = []*utils.TPRate{
|
||||
&utils.TPRate{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
ID: "1",
|
||||
RateSlots: []*utils.RateSlot{
|
||||
&utils.RateSlot{
|
||||
{
|
||||
ConnectFee: 0.0,
|
||||
Rate: 0.0,
|
||||
RateUnit: "60s",
|
||||
RateIncrement: "60s",
|
||||
GroupIntervalStart: "0s",
|
||||
},
|
||||
&utils.RateSlot{
|
||||
{
|
||||
ConnectFee: 0.0,
|
||||
Rate: 0.0,
|
||||
RateUnit: "60s",
|
||||
@@ -309,11 +317,11 @@ func testStorDBitCRUDTpRates(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
&utils.TPRate{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
ID: "2",
|
||||
RateSlots: []*utils.RateSlot{
|
||||
&utils.RateSlot{
|
||||
{
|
||||
ConnectFee: 0.0,
|
||||
Rate: 0.0,
|
||||
RateUnit: "60s",
|
||||
@@ -370,11 +378,11 @@ func testStorDBitCRUDTpDestinationRates(t *testing.T) {
|
||||
}
|
||||
// WRITE
|
||||
var snd = []*utils.TPDestinationRate{
|
||||
&utils.TPDestinationRate{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
ID: "1",
|
||||
DestinationRates: []*utils.DestinationRate{
|
||||
&utils.DestinationRate{
|
||||
{
|
||||
DestinationId: "GERMANY",
|
||||
RateId: "RT_1CENT",
|
||||
RoundingMethod: "*up",
|
||||
@@ -384,11 +392,11 @@ func testStorDBitCRUDTpDestinationRates(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
&utils.TPDestinationRate{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
ID: "2",
|
||||
DestinationRates: []*utils.DestinationRate{
|
||||
&utils.DestinationRate{
|
||||
{
|
||||
DestinationId: "GERMANY",
|
||||
RateId: "RT_1CENT",
|
||||
RoundingMethod: "*up",
|
||||
@@ -442,22 +450,22 @@ func testStorDBitCRUDTpRatingPlans(t *testing.T) {
|
||||
}
|
||||
// WRITE
|
||||
var snd = []*utils.TPRatingPlan{
|
||||
&utils.TPRatingPlan{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
ID: "1",
|
||||
RatingPlanBindings: []*utils.TPRatingPlanBinding{
|
||||
&utils.TPRatingPlanBinding{
|
||||
{
|
||||
DestinationRatesId: "1",
|
||||
TimingId: "ALWAYS",
|
||||
Weight: 0.0,
|
||||
},
|
||||
},
|
||||
},
|
||||
&utils.TPRatingPlan{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
ID: "2",
|
||||
RatingPlanBindings: []*utils.TPRatingPlanBinding{
|
||||
&utils.TPRatingPlanBinding{
|
||||
{
|
||||
DestinationRatesId: "2",
|
||||
TimingId: "ALWAYS",
|
||||
Weight: 2,
|
||||
@@ -510,7 +518,7 @@ func testStorDBitCRUDTpRatingProfiles(t *testing.T) {
|
||||
}
|
||||
// WRITE
|
||||
var snd = []*utils.TPRatingProfile{
|
||||
&utils.TPRatingProfile{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
LoadId: "TEST_LOADID",
|
||||
Direction: "*out",
|
||||
@@ -518,7 +526,7 @@ func testStorDBitCRUDTpRatingProfiles(t *testing.T) {
|
||||
Category: "call",
|
||||
Subject: "test",
|
||||
RatingPlanActivations: []*utils.TPRatingActivation{
|
||||
&utils.TPRatingActivation{
|
||||
{
|
||||
ActivationTime: "2014-07-29T15:00:00Z",
|
||||
RatingPlanId: "test",
|
||||
FallbackSubjects: "",
|
||||
@@ -526,7 +534,7 @@ func testStorDBitCRUDTpRatingProfiles(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
&utils.TPRatingProfile{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
LoadId: "TEST_LOADID2",
|
||||
Direction: "*out",
|
||||
@@ -534,7 +542,7 @@ func testStorDBitCRUDTpRatingProfiles(t *testing.T) {
|
||||
Category: "call",
|
||||
Subject: "test",
|
||||
RatingPlanActivations: []*utils.TPRatingActivation{
|
||||
&utils.TPRatingActivation{
|
||||
{
|
||||
ActivationTime: "2014-07-29T15:00:00Z",
|
||||
RatingPlanId: "test",
|
||||
FallbackSubjects: "",
|
||||
@@ -585,22 +593,22 @@ func testStorDBitCRUDTpSharedGroups(t *testing.T) {
|
||||
}
|
||||
// WRITE
|
||||
var snd = []*utils.TPSharedGroups{
|
||||
&utils.TPSharedGroups{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
ID: "1",
|
||||
SharedGroups: []*utils.TPSharedGroup{
|
||||
&utils.TPSharedGroup{
|
||||
{
|
||||
Account: "test",
|
||||
Strategy: "*lowest_cost",
|
||||
RatingSubject: "test",
|
||||
},
|
||||
},
|
||||
},
|
||||
&utils.TPSharedGroups{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
ID: "2",
|
||||
SharedGroups: []*utils.TPSharedGroup{
|
||||
&utils.TPSharedGroup{
|
||||
{
|
||||
Account: "test",
|
||||
Strategy: "*lowest_cost",
|
||||
RatingSubject: "test",
|
||||
@@ -650,11 +658,11 @@ func testStorDBitCRUDTpActions(t *testing.T) {
|
||||
}
|
||||
// WRITE
|
||||
var snd = []*utils.TPActions{
|
||||
&utils.TPActions{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
ID: "1",
|
||||
Actions: []*utils.TPAction{
|
||||
&utils.TPAction{
|
||||
{
|
||||
Identifier: "",
|
||||
BalanceId: "",
|
||||
BalanceUuid: "",
|
||||
@@ -676,11 +684,11 @@ func testStorDBitCRUDTpActions(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
&utils.TPActions{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
ID: "2",
|
||||
Actions: []*utils.TPAction{
|
||||
&utils.TPAction{
|
||||
{
|
||||
Identifier: "",
|
||||
BalanceId: "",
|
||||
BalanceUuid: "",
|
||||
@@ -745,22 +753,22 @@ func testStorDBitCRUDTpActionPlans(t *testing.T) {
|
||||
}
|
||||
// WRITE
|
||||
var snd = []*utils.TPActionPlan{
|
||||
&utils.TPActionPlan{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
ID: "1",
|
||||
ActionPlan: []*utils.TPActionTiming{
|
||||
&utils.TPActionTiming{
|
||||
{
|
||||
ActionsId: "1",
|
||||
TimingId: "1",
|
||||
Weight: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
&utils.TPActionPlan{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
ID: "2",
|
||||
ActionPlan: []*utils.TPActionTiming{
|
||||
&utils.TPActionTiming{
|
||||
{
|
||||
ActionsId: "1",
|
||||
TimingId: "1",
|
||||
Weight: 1,
|
||||
@@ -810,11 +818,11 @@ func testStorDBitCRUDTpActionTriggers(t *testing.T) {
|
||||
}
|
||||
// WRITE
|
||||
var snd = []*utils.TPActionTriggers{
|
||||
&utils.TPActionTriggers{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
ID: "1",
|
||||
ActionTriggers: []*utils.TPActionTrigger{
|
||||
&utils.TPActionTrigger{
|
||||
{
|
||||
Id: "1",
|
||||
UniqueID: "",
|
||||
ThresholdType: "1",
|
||||
@@ -841,11 +849,11 @@ func testStorDBitCRUDTpActionTriggers(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
&utils.TPActionTriggers{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
ID: "2",
|
||||
ActionTriggers: []*utils.TPActionTrigger{
|
||||
&utils.TPActionTrigger{
|
||||
{
|
||||
Id: "2",
|
||||
UniqueID: "",
|
||||
ThresholdType: "1",
|
||||
@@ -918,7 +926,7 @@ func testStorDBitCRUDTpAccountActions(t *testing.T) {
|
||||
}
|
||||
// WRITE
|
||||
var snd = []*utils.TPAccountActions{
|
||||
&utils.TPAccountActions{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
LoadId: "TEST_LOADID",
|
||||
Tenant: "cgrates.org",
|
||||
@@ -928,7 +936,7 @@ func testStorDBitCRUDTpAccountActions(t *testing.T) {
|
||||
AllowNegative: true,
|
||||
Disabled: true,
|
||||
},
|
||||
&utils.TPAccountActions{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
LoadId: "TEST_LOADID",
|
||||
Tenant: "cgrates.org",
|
||||
@@ -984,7 +992,7 @@ func testStorDBitCRUDTpLCRs(t *testing.T) {
|
||||
Account: "",
|
||||
Subject: "",
|
||||
Rules: []*utils.TPLcrRule{
|
||||
&utils.TPLcrRule{
|
||||
{
|
||||
DestinationId: "",
|
||||
RpCategory: "",
|
||||
Strategy: "",
|
||||
@@ -999,7 +1007,7 @@ func testStorDBitCRUDTpLCRs(t *testing.T) {
|
||||
}
|
||||
// WRITE
|
||||
var snd = []*utils.TPLcrRules{
|
||||
&utils.TPLcrRules{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
Direction: "*in",
|
||||
Tenant: "cgrates.org",
|
||||
@@ -1007,7 +1015,7 @@ func testStorDBitCRUDTpLCRs(t *testing.T) {
|
||||
Account: "1000",
|
||||
Subject: "test",
|
||||
Rules: []*utils.TPLcrRule{
|
||||
&utils.TPLcrRule{
|
||||
{
|
||||
DestinationId: "",
|
||||
RpCategory: "LCR_STANDARD",
|
||||
Strategy: "*lowest_cost",
|
||||
@@ -1017,7 +1025,7 @@ func testStorDBitCRUDTpLCRs(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
&utils.TPLcrRules{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
Direction: "*out",
|
||||
Tenant: "cgrates.org",
|
||||
@@ -1025,7 +1033,7 @@ func testStorDBitCRUDTpLCRs(t *testing.T) {
|
||||
Account: "1000",
|
||||
Subject: "test",
|
||||
Rules: []*utils.TPLcrRule{
|
||||
&utils.TPLcrRule{
|
||||
{
|
||||
DestinationId: "",
|
||||
RpCategory: "LCR_STANDARD",
|
||||
Strategy: "*lowest_cost",
|
||||
@@ -1081,7 +1089,7 @@ func testStorDBitCRUDTpDerivedChargers(t *testing.T) {
|
||||
}
|
||||
// WRITE
|
||||
var snd = []*utils.TPDerivedChargers{
|
||||
&utils.TPDerivedChargers{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
LoadId: "TEST_LOADID",
|
||||
Direction: "*out",
|
||||
@@ -1091,7 +1099,7 @@ func testStorDBitCRUDTpDerivedChargers(t *testing.T) {
|
||||
Subject: "test",
|
||||
DestinationIds: "",
|
||||
DerivedChargers: []*utils.TPDerivedCharger{
|
||||
&utils.TPDerivedCharger{
|
||||
{
|
||||
RunId: "default",
|
||||
RunFilters: "test",
|
||||
ReqTypeField: "test",
|
||||
@@ -1112,7 +1120,7 @@ func testStorDBitCRUDTpDerivedChargers(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
&utils.TPDerivedChargers{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
LoadId: "TEST_LOADID2",
|
||||
Direction: "*out",
|
||||
@@ -1122,7 +1130,7 @@ func testStorDBitCRUDTpDerivedChargers(t *testing.T) {
|
||||
Subject: "test",
|
||||
DestinationIds: "",
|
||||
DerivedChargers: []*utils.TPDerivedCharger{
|
||||
&utils.TPDerivedCharger{
|
||||
{
|
||||
RunId: "default",
|
||||
RunFilters: "test",
|
||||
ReqTypeField: "test",
|
||||
@@ -1186,11 +1194,11 @@ func testStorDBitCRUDTpCdrStats(t *testing.T) {
|
||||
}
|
||||
// WRITE
|
||||
var snd = []*utils.TPCdrStats{
|
||||
&utils.TPCdrStats{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
ID: "1",
|
||||
CdrStats: []*utils.TPCdrStat{
|
||||
&utils.TPCdrStat{
|
||||
{
|
||||
QueueLength: "0",
|
||||
TimeWindow: "10m",
|
||||
SaveInterval: "3s",
|
||||
@@ -1218,11 +1226,11 @@ func testStorDBitCRUDTpCdrStats(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
&utils.TPCdrStats{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
ID: "2",
|
||||
CdrStats: []*utils.TPCdrStat{
|
||||
&utils.TPCdrStat{
|
||||
{
|
||||
QueueLength: "0",
|
||||
TimeWindow: "10m",
|
||||
SaveInterval: "3s",
|
||||
@@ -1296,27 +1304,27 @@ func testStorDBitCRUDTpUsers(t *testing.T) {
|
||||
}
|
||||
// WRITE
|
||||
var snd = []*utils.TPUsers{
|
||||
&utils.TPUsers{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
Tenant: "cgrates.org",
|
||||
Masked: true,
|
||||
UserName: "1001",
|
||||
Weight: 0.1,
|
||||
Profile: []*utils.TPUserProfile{
|
||||
&utils.TPUserProfile{
|
||||
{
|
||||
AttrName: "Account",
|
||||
AttrValue: "1001",
|
||||
},
|
||||
},
|
||||
},
|
||||
&utils.TPUsers{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
Tenant: "cgrates.org",
|
||||
Masked: true,
|
||||
UserName: "1002",
|
||||
Weight: 0.1,
|
||||
Profile: []*utils.TPUserProfile{
|
||||
&utils.TPUserProfile{
|
||||
{
|
||||
AttrName: "Account",
|
||||
AttrValue: "1001",
|
||||
},
|
||||
@@ -1368,7 +1376,7 @@ func testStorDBitCRUDTpAliases(t *testing.T) {
|
||||
}
|
||||
// WRITE
|
||||
var snd = []*utils.TPAliases{
|
||||
&utils.TPAliases{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
Direction: "*out",
|
||||
Tenant: "cgrates.org",
|
||||
@@ -1377,7 +1385,7 @@ func testStorDBitCRUDTpAliases(t *testing.T) {
|
||||
Subject: "1006",
|
||||
Context: "*rating",
|
||||
Values: []*utils.TPAliasValue{
|
||||
&utils.TPAliasValue{
|
||||
{
|
||||
DestinationId: "*any",
|
||||
Target: "Subject",
|
||||
Original: "1006",
|
||||
@@ -1386,7 +1394,7 @@ func testStorDBitCRUDTpAliases(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
&utils.TPAliases{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
Direction: "*out",
|
||||
Tenant: "cgrates.org",
|
||||
@@ -1395,7 +1403,7 @@ func testStorDBitCRUDTpAliases(t *testing.T) {
|
||||
Subject: "1006",
|
||||
Context: "*rating",
|
||||
Values: []*utils.TPAliasValue{
|
||||
&utils.TPAliasValue{
|
||||
{
|
||||
DestinationId: "*any",
|
||||
Target: "Subject",
|
||||
Original: "1006",
|
||||
@@ -1447,7 +1455,7 @@ func testStorDBitCRUDTpResources(t *testing.T) {
|
||||
}
|
||||
//WRITE
|
||||
var snd = []*utils.TPResource{
|
||||
&utils.TPResource{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
ID: "testTag1",
|
||||
Weight: 0.0,
|
||||
@@ -1457,7 +1465,7 @@ func testStorDBitCRUDTpResources(t *testing.T) {
|
||||
Blocker: true,
|
||||
Stored: true,
|
||||
},
|
||||
&utils.TPResource{
|
||||
{
|
||||
TPid: "testTPid",
|
||||
ID: "testTag2",
|
||||
ActivationInterval: &utils.TPActivationInterval{ActivationTime: "test"},
|
||||
@@ -1542,7 +1550,7 @@ func testStorDBitCRUDTpStats(t *testing.T) {
|
||||
}
|
||||
//WRITE
|
||||
eTPs := []*utils.TPStats{
|
||||
&utils.TPStats{
|
||||
{
|
||||
TPid: "TEST_TPID",
|
||||
Tenant: "Test",
|
||||
ID: "Stats1",
|
||||
@@ -1553,15 +1561,15 @@ func testStorDBitCRUDTpStats(t *testing.T) {
|
||||
QueueLength: 100,
|
||||
TTL: "1s",
|
||||
Metrics: []*utils.MetricWithParams{
|
||||
&utils.MetricWithParams{
|
||||
{
|
||||
MetricID: "*asr",
|
||||
Parameters: "",
|
||||
},
|
||||
&utils.MetricWithParams{
|
||||
{
|
||||
MetricID: "*acd",
|
||||
Parameters: "",
|
||||
},
|
||||
&utils.MetricWithParams{
|
||||
{
|
||||
MetricID: "*acc",
|
||||
Parameters: "",
|
||||
},
|
||||
@@ -1635,7 +1643,7 @@ func testStorDBitCRUDCDRs(t *testing.T) {
|
||||
}
|
||||
// WRITE
|
||||
var snd = []*CDR{
|
||||
&CDR{
|
||||
{
|
||||
CGRID: "88ed9c38005f07576a1e1af293063833b60edcc6",
|
||||
RunID: "1",
|
||||
OrderID: 0,
|
||||
@@ -1645,7 +1653,7 @@ func testStorDBitCRUDCDRs(t *testing.T) {
|
||||
CostDetails: NewBareEventCost(),
|
||||
ExtraFields: map[string]string{"Service-Context-Id": "voice@huawei.com"},
|
||||
},
|
||||
&CDR{
|
||||
{
|
||||
CGRID: "88ed9c38005f07576a1e1af293063833b60edcc2",
|
||||
RunID: "2",
|
||||
OrderID: 0,
|
||||
@@ -1769,14 +1777,14 @@ func testStorDBitCRUDSMCosts(t *testing.T) {
|
||||
}
|
||||
// WRITE
|
||||
var snd = []*SMCost{
|
||||
&SMCost{
|
||||
{
|
||||
CGRID: "88ed9c38005f07576a1e1af293063833b60edcc6",
|
||||
RunID: "1",
|
||||
OriginHost: "host2",
|
||||
OriginID: "2",
|
||||
CostDetails: NewBareEventCost(),
|
||||
},
|
||||
&SMCost{
|
||||
{
|
||||
CGRID: "88ed9c38005f07576a1e1af293063833b60edcc2",
|
||||
RunID: "2",
|
||||
OriginHost: "host2",
|
||||
@@ -1822,7 +1830,7 @@ func testStorDBitCRUDSMCosts(t *testing.T) {
|
||||
}
|
||||
|
||||
func testStorDBitFlush(t *testing.T) {
|
||||
if err := storDB.Flush(path.Join(cfg.DataFolderPath, "storage", cfg.StorDBType)); err != nil {
|
||||
if err := storDB.Flush(path.Join(cfg.DataFolderPath, "storage", cfg.StorDbCfg().StorDBType)); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,10 +52,14 @@ func TestVersionsITMongo(t *testing.T) {
|
||||
cfg.CacheCfg(), ""); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
storageDb, err = ConfigureStorStorage(cfg.StorDBType, cfg.StorDBHost,
|
||||
cfg.StorDBPort, cfg.StorDBName, cfg.StorDBUser, cfg.StorDBPass, cfg.DBDataEncoding,
|
||||
config.CgrConfig().StorDBMaxOpenConns, config.CgrConfig().StorDBMaxIdleConns,
|
||||
config.CgrConfig().StorDBConnMaxLifetime, config.CgrConfig().StorDBCDRSIndexes)
|
||||
storageDb, err = ConfigureStorStorage(cfg.StorDbCfg().StorDBType,
|
||||
cfg.StorDbCfg().StorDBHost, cfg.StorDbCfg().StorDBPort,
|
||||
cfg.StorDbCfg().StorDBName, cfg.StorDbCfg().StorDBUser,
|
||||
cfg.StorDbCfg().StorDBPass, cfg.DBDataEncoding,
|
||||
config.CgrConfig().StorDbCfg().StorDBMaxOpenConns,
|
||||
config.CgrConfig().StorDbCfg().StorDBMaxIdleConns,
|
||||
config.CgrConfig().StorDbCfg().StorDBConnMaxLifetime,
|
||||
config.CgrConfig().StorDbCfg().StorDBCDRSIndexes)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@@ -78,10 +82,14 @@ func TestVersionsITRedisMYSQL(t *testing.T) {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
storageDb, err = ConfigureStorStorage(cfg.StorDBType, cfg.StorDBHost, cfg.StorDBPort,
|
||||
cfg.StorDBName, cfg.StorDBUser, cfg.StorDBPass, cfg.DBDataEncoding,
|
||||
config.CgrConfig().StorDBMaxOpenConns, config.CgrConfig().StorDBMaxIdleConns,
|
||||
config.CgrConfig().StorDBConnMaxLifetime, config.CgrConfig().StorDBCDRSIndexes)
|
||||
storageDb, err = ConfigureStorStorage(cfg.StorDbCfg().StorDBType,
|
||||
cfg.StorDbCfg().StorDBHost, cfg.StorDbCfg().StorDBPort,
|
||||
cfg.StorDbCfg().StorDBName, cfg.StorDbCfg().StorDBUser,
|
||||
cfg.StorDbCfg().StorDBPass, cfg.DBDataEncoding,
|
||||
config.CgrConfig().StorDbCfg().StorDBMaxOpenConns,
|
||||
config.CgrConfig().StorDbCfg().StorDBMaxIdleConns,
|
||||
config.CgrConfig().StorDbCfg().StorDBConnMaxLifetime,
|
||||
config.CgrConfig().StorDbCfg().StorDBCDRSIndexes)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@@ -103,10 +111,14 @@ func TestVersionsITRedisPostgres(t *testing.T) {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
storageDb, err = ConfigureStorStorage(cfg.StorDBType, cfg.StorDBHost,
|
||||
cfg.StorDBPort, cfg.StorDBName, cfg.StorDBUser, cfg.StorDBPass, cfg.DBDataEncoding,
|
||||
config.CgrConfig().StorDBMaxOpenConns, config.CgrConfig().StorDBMaxIdleConns,
|
||||
config.CgrConfig().StorDBConnMaxLifetime, config.CgrConfig().StorDBCDRSIndexes)
|
||||
storageDb, err = ConfigureStorStorage(cfg.StorDbCfg().StorDBType,
|
||||
cfg.StorDbCfg().StorDBHost, cfg.StorDbCfg().StorDBPort,
|
||||
cfg.StorDbCfg().StorDBName, cfg.StorDbCfg().StorDBUser,
|
||||
cfg.StorDbCfg().StorDBPass, cfg.DBDataEncoding,
|
||||
config.CgrConfig().StorDbCfg().StorDBMaxOpenConns,
|
||||
config.CgrConfig().StorDbCfg().StorDBMaxIdleConns,
|
||||
config.CgrConfig().StorDbCfg().StorDBConnMaxLifetime,
|
||||
config.CgrConfig().StorDbCfg().StorDBCDRSIndexes)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@@ -122,7 +134,7 @@ func testVersionsFlush(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error("Error when flushing Mongo ", err.Error())
|
||||
}
|
||||
if err := storageDb.Flush(path.Join(cfg.DataFolderPath, "storage", cfg.StorDBType)); err != nil {
|
||||
if err := storageDb.Flush(path.Join(cfg.DataFolderPath, "storage", cfg.StorDbCfg().StorDBType)); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user