diff --git a/engine/loader_local_test.go b/engine/loader_local_test.go index 9af365122..0320f6840 100644 --- a/engine/loader_local_test.go +++ b/engine/loader_local_test.go @@ -21,6 +21,7 @@ package engine import ( "flag" "path" + "strings" "testing" "github.com/cgrates/cgrates/config" @@ -395,7 +396,7 @@ func TestMatchLoadCsvWithStorRating(t *testing.T) { for _, key := range keysCsv { var refVal []byte for idx, rs := range []*RedisStorage{rsCsv, rsStor, rsApier} { - if key == utils.TASKS_KEY { + if key == utils.TASKS_KEY || strings.HasPrefix(key, utils.ACTION_PLAN_PREFIX) { // action plans are not consistent continue } qVal, err := rs.db.Cmd("GET", key).Bytes() diff --git a/engine/storage_redis.go b/engine/storage_redis.go index 990ca2cde..8a857d8a8 100644 --- a/engine/storage_redis.go +++ b/engine/storage_redis.go @@ -904,7 +904,7 @@ func (rs *RedisStorage) GetActionPlan(key string, skipCache bool) (ats *ActionPl } var values []byte if values, err = rs.db.Cmd("GET", key).Bytes(); err == nil { - /*b := bytes.NewBuffer(values) + b := bytes.NewBuffer(values) r, err := zlib.NewReader(b) if err != nil { return nil, err @@ -913,8 +913,8 @@ func (rs *RedisStorage) GetActionPlan(key string, skipCache bool) (ats *ActionPl if err != nil { return nil, err } - r.Close()*/ - err = rs.ms.Unmarshal(values, &ats) + r.Close() + err = rs.ms.Unmarshal(out, &ats) cache2go.Cache(key, ats) } return @@ -932,10 +932,10 @@ func (rs *RedisStorage) SetActionPlan(key string, ats *ActionPlan) (err error) { return err } var b bytes.Buffer - /*w := zlib.NewWriter(&b) + w := zlib.NewWriter(&b) w.Write(result) - w.Close()*/ - return rs.db.Cmd("SET", utils.ACTION_PLAN_PREFIX+key, result).Err + w.Close() + return rs.db.Cmd("SET", utils.ACTION_PLAN_PREFIX+key, b.Bytes()).Err } func (rs *RedisStorage) GetAllActionPlans() (ats map[string]*ActionPlan, err error) {