mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-23 08:08:45 +05:00
Fixing integration tests in loaders
This commit is contained in:
committed by
Dan Christian Bogos
parent
f61a5dc715
commit
311065f1c6
@@ -506,6 +506,14 @@ cgrates.org,SET_ACTPROFILE_3
|
||||
}
|
||||
|
||||
func testLoadFromFilesCsvActionProfileOpenError(t *testing.T) {
|
||||
pathL := "/tmp/testLoadFromFilesCsvActionProfileOpenError/"
|
||||
if err := os.MkdirAll(pathL, 0777); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if _, err := os.Create(path.Join(pathL, "WrongFileName")); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
data := engine.NewInternalDB(nil, nil, true)
|
||||
ldr := &Loader{
|
||||
ldrID: "TestRemoveActionProfileContent",
|
||||
@@ -514,6 +522,7 @@ func testLoadFromFilesCsvActionProfileOpenError(t *testing.T) {
|
||||
tpInDir: "/tmp/testLoadFromFilesCsvActionProfileOpenError",
|
||||
rdrTypes: []string{utils.MetaActionProfiles},
|
||||
timezone: "UTC",
|
||||
fieldSep: utils.InfieldSep,
|
||||
}
|
||||
ldr.rdrs = map[string]map[string]*openedCSVFile{
|
||||
utils.MetaActionProfiles: {
|
||||
@@ -522,7 +531,7 @@ func testLoadFromFilesCsvActionProfileOpenError(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
expectedErr := "open /tmp/testLoadFromFilesCsvActionProfileOpenError/ActionProfiles.csv: not a directory"
|
||||
expectedErr := "open /tmp/testLoadFromFilesCsvActionProfileOpenError/ActionProfiles.csv: no such file or directory"
|
||||
if err := ldr.ProcessFolder(context.TODO(), utils.EmptyString, utils.MetaStore, true); err == nil || err.Error() != expectedErr {
|
||||
t.Errorf("Expected %+v, received %+v", expectedErr, err)
|
||||
}
|
||||
@@ -531,6 +540,10 @@ func testLoadFromFilesCsvActionProfileOpenError(t *testing.T) {
|
||||
if err := ldr.ProcessFolder(context.TODO(), utils.EmptyString, utils.MetaStore, false); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if err := os.RemoveAll(pathL); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func testProcessFolderRemoveContent(t *testing.T) {
|
||||
@@ -578,6 +591,7 @@ cgrates.org,SET_ACTPROFILE_3
|
||||
Mandatory: true},
|
||||
},
|
||||
}
|
||||
ldr.connMgr = engine.NewConnManager(config.NewDefaultCGRConfig())
|
||||
|
||||
rdr := io.NopCloser(strings.NewReader(string(content)))
|
||||
csvRdr := csv.NewReader(rdr)
|
||||
|
||||
Reference in New Issue
Block a user