mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
added test for shared groups set/get
This commit is contained in:
@@ -25,9 +25,12 @@ go install github.com/cgrates/cgrates
|
||||
ln -s /root/code/bin/cgr-engine /usr/bin/cgr-engine
|
||||
|
||||
# expand freeswitch conf
|
||||
cd /usr/share/cgrates/tutorials/fs_evsock/freeswitch/etc/ && tar xzf freeswitch_conf.tar.gz
|
||||
cd /usr/share/cgrates/tutorials/fs_evsock/freeswitch/etc/ && tar xzf freeswitch_conf.tar.gz
|
||||
|
||||
cd /root/cgr
|
||||
echo "for cgradmin run: cgr-engine -config_dir data/conf/samples/cgradmin"
|
||||
echo 'export GOROOT=/root/go; export GOPATH=/root/code; export PATH=$GOROOT/bin:$GOPATH/bin:$PATH'>>/root/.zshrc
|
||||
|
||||
upgrade_oh_my_zsh
|
||||
|
||||
zsh
|
||||
|
||||
@@ -18,7 +18,34 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
package engine
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSharedSetGet(t *testing.T) {
|
||||
id := "TEST_SG100"
|
||||
sg := &SharedGroup{
|
||||
Id: id,
|
||||
AccountParameters: map[string]*SharingParameters{
|
||||
"test": &SharingParameters{Strategy: STRATEGY_HIGHEST},
|
||||
},
|
||||
MemberIds: []string{"1", "2", "3"},
|
||||
}
|
||||
err := accountingStorage.SetSharedGroup(sg)
|
||||
if err != nil {
|
||||
t.Error("Error storing Shared groudp: ", err)
|
||||
}
|
||||
received, err := accountingStorage.GetSharedGroup(id, true)
|
||||
if err != nil || received == nil || !reflect.DeepEqual(sg, received) {
|
||||
t.Error("Error getting shared group: ", err, received)
|
||||
}
|
||||
received, err = accountingStorage.GetSharedGroup(id, false)
|
||||
if err != nil || received == nil || !reflect.DeepEqual(sg, received) {
|
||||
t.Error("Error getting cached shared group: ", err, received)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestSharedPopBalanceByStrategyLow(t *testing.T) {
|
||||
bc := BalanceChain{
|
||||
|
||||
Reference in New Issue
Block a user