mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-20 06:38:45 +05:00
Fix DataDB.RemAccountActionPlans
This commit is contained in:
@@ -1215,20 +1215,20 @@ func testOnStorITCRUDAccountActionPlans(t *testing.T) {
|
||||
} else if !reflect.DeepEqual(expect, rcv) {
|
||||
t.Errorf("Expecting: %v, received: %v", expect, rcv)
|
||||
}
|
||||
// if err := onStor.RemAccountActionPlans(acntID, aAPs2); err != nil {
|
||||
// t.Error(err)
|
||||
// }
|
||||
// if rcv, err := onStor.GetAccountActionPlans(acntID, true, utils.NonTransactional); err != nil {
|
||||
// t.Error(err)
|
||||
// } else if !reflect.DeepEqual(aAPs, rcv) {
|
||||
// t.Errorf("Expecting: %v, received: %v", aAPs, rcv)
|
||||
// }onstor_it_test.go:1238: Expecting: [PACKAGE_10_SHARED_A_5 apl_PACKAGE_1001], received: [PACKAGE_10_SHARED_A_5 USE_SHARED_A apl_PACKAGE_1001]
|
||||
if err := onStor.RemAccountActionPlans(acntID, aAPs2); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if rcv, err := onStor.GetAccountActionPlans(acntID, true, utils.NonTransactional); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(aAPs, rcv) {
|
||||
t.Errorf("Expecting: %v, received: %v", aAPs, rcv)
|
||||
}
|
||||
if err := onStor.RemAccountActionPlans(acntID, aAPs); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
// if _, rcvErr := onStor.GetAccountActionPlans(acntID, true, utils.NonTransactional); rcvErr != utils.ErrNotFound {
|
||||
// t.Error(rcvErr)
|
||||
// }
|
||||
if _, rcvErr := onStor.GetAccountActionPlans(acntID, true, utils.NonTransactional); rcvErr != utils.ErrNotFound {
|
||||
t.Error(rcvErr)
|
||||
}
|
||||
}
|
||||
|
||||
func testOnStorITCRUDAccount(t *testing.T) {
|
||||
|
||||
@@ -1658,7 +1658,7 @@ func (ms *MongoStorage) RemAccountActionPlans(acntID string, aPlIDs []string) (e
|
||||
if len(aPlIDs) == 0 {
|
||||
return col.Remove(bson.M{"key": acntID})
|
||||
}
|
||||
oldAPlIDs, err := ms.GetAccountActionPlans(acntID, false, utils.NonTransactional)
|
||||
oldAPlIDs, err := ms.GetAccountActionPlans(acntID, true, utils.NonTransactional)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1675,7 +1675,7 @@ func (ms *MongoStorage) RemAccountActionPlans(acntID string, aPlIDs []string) (e
|
||||
_, err = col.Upsert(bson.M{"key": acntID}, &struct {
|
||||
Key string
|
||||
Value []string
|
||||
}{Key: acntID, Value: aPlIDs})
|
||||
}{Key: acntID, Value: oldAPlIDs})
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -1267,7 +1267,11 @@ func (rs *RedisStorage) RemAccountActionPlans(acntID string, aPlIDs []string) (e
|
||||
if len(oldaPlIDs) == 0 { // no more elements, remove the reference
|
||||
return rs.Cmd("DEL", key).Err
|
||||
}
|
||||
return rs.Cmd("SET", key, oldaPlIDs).Err
|
||||
var result []byte
|
||||
if result, err = rs.ms.Marshal(oldaPlIDs); err != nil {
|
||||
return err
|
||||
}
|
||||
return rs.Cmd("SET", key, result).Err
|
||||
}
|
||||
|
||||
func (rs *RedisStorage) PushTask(t *Task) error {
|
||||
|
||||
Reference in New Issue
Block a user