mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Revise err handling for CSV storage constructor
NewFileCSVStorage() now returns an error besides the storage struct itself, which is logged and returned instead of calling log.Fatal() which was causing the engine to crash. Fixed compilation errors by creating the CSVStorage separately and passing it as an argument to the TpReader constructor.
This commit is contained in:
@@ -134,8 +134,11 @@ func testLoaderITRemoveLoad(t *testing.T) {
|
||||
t.Error("Failed validating data: ", err.Error())
|
||||
}
|
||||
}*/
|
||||
loader, err = NewTpReader(dataDbCsv, NewFileCSVStorage(utils.CSVSep,
|
||||
path.Join(*dataDir, "tariffplans", *tpCsvScenario)), "", "",
|
||||
csvStorage, err := NewFileCSVStorage(utils.CSVSep, path.Join(*dataDir, "tariffplans", *tpCsvScenario))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
loader, err = NewTpReader(dataDbCsv, csvStorage, "", "",
|
||||
[]string{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaCaches)}, nil, false)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
@@ -213,8 +216,11 @@ func testLoaderITLoadFromCSV(t *testing.T) {
|
||||
t.Error("Failed validating data: ", err.Error())
|
||||
}
|
||||
}*/
|
||||
loader, err = NewTpReader(dataDbCsv, NewFileCSVStorage(utils.CSVSep,
|
||||
path.Join(*dataDir, "tariffplans", *tpCsvScenario)), "", "",
|
||||
csvStorage, err := NewFileCSVStorage(utils.CSVSep, path.Join(*dataDir, "tariffplans", *tpCsvScenario))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
loader, err = NewTpReader(dataDbCsv, csvStorage, "", "",
|
||||
[]string{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaCaches)}, nil, false)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
|
||||
Reference in New Issue
Block a user