mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
Fixed integration tests
This commit is contained in:
committed by
Dan Christian Bogos
parent
f803431026
commit
47476bdbf0
@@ -31,7 +31,7 @@ import (
|
||||
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/sessionmanager"
|
||||
"github.com/cgrates/cgrates/sessions"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
"github.com/fiorix/go-diameter/diam"
|
||||
"github.com/fiorix/go-diameter/diam/avp"
|
||||
@@ -112,7 +112,7 @@ func TestDmtAgentCCRAsSMGenericEvent(t *testing.T) {
|
||||
if ccr.diamMessage, err = ccr.AsDiameterMessage(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
eSMGE := sessionmanager.SMGenericEvent{"EventName": DIAMETER_CCR,
|
||||
eSMGE := sessions.SMGenericEvent{"EventName": DIAMETER_CCR,
|
||||
"OriginID": "routinga;1442095190;1476802709",
|
||||
"Account": "*users", "Category": "call",
|
||||
"AnswerTime": "2015-11-23 12:22:24 +0000 UTC",
|
||||
|
||||
@@ -30,7 +30,7 @@ import (
|
||||
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/sessionmanager"
|
||||
"github.com/cgrates/cgrates/sessions"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
"github.com/cgrates/radigo"
|
||||
)
|
||||
@@ -191,7 +191,7 @@ func TestRAitAcctStart(t *testing.T) {
|
||||
t.Errorf("Received AVPs: %+v", reply.AVPs)
|
||||
}
|
||||
// Make sure the sessin is managed by SMG
|
||||
var aSessions []*sessionmanager.ActiveSession
|
||||
var aSessions []*sessions.ActiveSession
|
||||
if err := raRPC.Call("SMGenericV1.GetActiveSessions",
|
||||
map[string]string{utils.MEDI_RUNID: utils.META_DEFAULT, utils.OriginID: "e4921177ab0e3586c37f6a185864b71a@0:0:0:0:0:0:0:0-51585361-75c2f57b"},
|
||||
&aSessions); err != nil {
|
||||
@@ -258,7 +258,7 @@ func TestRAitAcctStop(t *testing.T) {
|
||||
t.Errorf("Received AVPs: %+v", reply.AVPs)
|
||||
}
|
||||
// Make sure the sessin was disconnected from SMG
|
||||
var aSessions []*sessionmanager.ActiveSession
|
||||
var aSessions []*sessions.ActiveSession
|
||||
if err := raRPC.Call("SMGenericV1.GetActiveSessions",
|
||||
map[string]string{utils.MEDI_RUNID: utils.META_DEFAULT, utils.OriginID: "e4921177ab0e3586c37f6a185864b71a@0:0:0:0:0:0:0:0-51585361-75c2f57b"},
|
||||
&aSessions); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
|
||||
@@ -31,7 +31,7 @@ import (
|
||||
"github.com/cenk/rpc2"
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/sessionmanager"
|
||||
"github.com/cgrates/cgrates/sessions"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
@@ -113,7 +113,7 @@ func TestSSv1ItTPFromFolder(t *testing.T) {
|
||||
|
||||
func TestSSv1ItAuth(t *testing.T) {
|
||||
authUsage := 5 * time.Minute
|
||||
args := &sessionmanager.V1AuthorizeArgs{
|
||||
args := &sessions.V1AuthorizeArgs{
|
||||
GetMaxUsage: true,
|
||||
AuthorizeResources: true,
|
||||
GetSuppliers: true,
|
||||
@@ -131,7 +131,7 @@ func TestSSv1ItAuth(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
var rply sessionmanager.V1AuthorizeReply
|
||||
var rply sessions.V1AuthorizeReply
|
||||
if err := sSv1BiRpc.Call(utils.SessionSv1AuthorizeEvent, args, &rply); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -188,7 +188,7 @@ func TestSSv1ItAuth(t *testing.T) {
|
||||
|
||||
func TestSSv1ItAuthWithDigest(t *testing.T) {
|
||||
authUsage := 5 * time.Minute
|
||||
args := &sessionmanager.V1AuthorizeArgs{
|
||||
args := &sessions.V1AuthorizeArgs{
|
||||
GetMaxUsage: true,
|
||||
AuthorizeResources: true,
|
||||
GetSuppliers: true,
|
||||
@@ -206,7 +206,7 @@ func TestSSv1ItAuthWithDigest(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
var rply sessionmanager.V1AuthorizeReplyWithDigest
|
||||
var rply sessions.V1AuthorizeReplyWithDigest
|
||||
if err := sSv1BiRpc.Call(utils.SessionSv1AuthorizeEventWithDigest, args, &rply); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -228,7 +228,7 @@ func TestSSv1ItAuthWithDigest(t *testing.T) {
|
||||
|
||||
func TestSSv1ItInitiateSession(t *testing.T) {
|
||||
initUsage := 5 * time.Minute
|
||||
args := &sessionmanager.V1InitSessionArgs{
|
||||
args := &sessions.V1InitSessionArgs{
|
||||
InitSession: true,
|
||||
AllocateResources: true,
|
||||
GetAttributes: true,
|
||||
@@ -246,7 +246,7 @@ func TestSSv1ItInitiateSession(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
var rply sessionmanager.V1InitSessionReply
|
||||
var rply sessions.V1InitSessionReply
|
||||
if err := sSv1BiRpc.Call(utils.SessionSv1InitiateSession,
|
||||
args, &rply); err != nil {
|
||||
t.Error(err)
|
||||
@@ -284,7 +284,7 @@ func TestSSv1ItInitiateSession(t *testing.T) {
|
||||
|
||||
func TestSSv1ItUpdateSession(t *testing.T) {
|
||||
reqUsage := 5 * time.Minute
|
||||
args := &sessionmanager.V1UpdateSessionArgs{
|
||||
args := &sessions.V1UpdateSessionArgs{
|
||||
GetAttributes: true,
|
||||
UpdateSession: true,
|
||||
CGREvent: utils.CGREvent{
|
||||
@@ -301,7 +301,7 @@ func TestSSv1ItUpdateSession(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
var rply sessionmanager.V1UpdateSessionReply
|
||||
var rply sessions.V1UpdateSessionReply
|
||||
if err := sSv1BiRpc.Call(utils.SessionSv1UpdateSession,
|
||||
args, &rply); err != nil {
|
||||
t.Error(err)
|
||||
@@ -335,7 +335,7 @@ func TestSSv1ItUpdateSession(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSSv1ItTerminateSession(t *testing.T) {
|
||||
args := &sessionmanager.V1TerminateSessionArgs{
|
||||
args := &sessions.V1TerminateSessionArgs{
|
||||
TerminateSession: true,
|
||||
ReleaseResources: true,
|
||||
CGREvent: utils.CGREvent{
|
||||
@@ -388,7 +388,7 @@ func TestSSv1ItProcessCDR(t *testing.T) {
|
||||
|
||||
func TestSSv1ItProcessEvent(t *testing.T) {
|
||||
initUsage := 5 * time.Minute
|
||||
args := &sessionmanager.V1ProcessEventArgs{
|
||||
args := &sessions.V1ProcessEventArgs{
|
||||
AllocateResources: true,
|
||||
Debit: true,
|
||||
GetAttributes: true,
|
||||
@@ -406,7 +406,7 @@ func TestSSv1ItProcessEvent(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
var rply sessionmanager.V1ProcessEventReply
|
||||
var rply sessions.V1ProcessEventReply
|
||||
if err := sSv1BiRpc.Call(utils.SessionSv1ProcessEvent,
|
||||
args, &rply); err != nil {
|
||||
t.Error(err)
|
||||
|
||||
@@ -30,7 +30,7 @@ import (
|
||||
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/sessionmanager"
|
||||
"github.com/cgrates/cgrates/sessions"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
@@ -126,7 +126,7 @@ func TestSMGV1AccountsBefore(t *testing.T) {
|
||||
|
||||
// Make sure account was debited properly
|
||||
func TestSMGV1GetMaxUsage(t *testing.T) {
|
||||
setupReq := &sessionmanager.SMGenericEvent{utils.RequestType: utils.META_PREPAID, utils.Tenant: "cgrates.org",
|
||||
setupReq := &sessions.SMGenericEvent{utils.RequestType: utils.META_PREPAID, utils.Tenant: "cgrates.org",
|
||||
utils.Account: "1003", utils.Destination: "1002", utils.SetupTime: "2015-11-10T15:20:00Z"}
|
||||
var maxTime float64
|
||||
if err := smgV1Rpc.Call("SMGenericV1.GetMaxUsage", setupReq, &maxTime); err != nil {
|
||||
|
||||
@@ -311,7 +311,7 @@ func (rs *Responder) GetMaxSessionTime(arg *CallDescriptor, reply *float64) (err
|
||||
return
|
||||
}
|
||||
|
||||
// Returns MaxSessionTime for an event received in SessionManager, considering DerivedCharging for it
|
||||
// Returns MaxSessionTime for an event received in sessions, considering DerivedCharging for it
|
||||
func (rs *Responder) GetDerivedMaxSessionTime(ev *CDR, reply *float64) (err error) {
|
||||
cacheKey := utils.GET_DERIV_MAX_SESS_TIME + ev.CGRID + ev.RunID
|
||||
if item, err := rs.getCache().Get(cacheKey); err == nil && item != nil {
|
||||
|
||||
@@ -33,7 +33,7 @@ import (
|
||||
"github.com/cgrates/cgrates/apier/v2"
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/sessionmanager"
|
||||
"github.com/cgrates/cgrates/sessions"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
@@ -127,7 +127,7 @@ func TestA1itAddBalance1(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestA1itDataSession1(t *testing.T) {
|
||||
smgEv := sessionmanager.SMGenericEvent{
|
||||
smgEv := sessions.SMGenericEvent{
|
||||
utils.EVENT_NAME: "INITIATE_SESSION",
|
||||
utils.TOR: utils.DATA,
|
||||
utils.OriginID: "504966119",
|
||||
@@ -151,7 +151,7 @@ func TestA1itDataSession1(t *testing.T) {
|
||||
} else if maxUsage != 10240 {
|
||||
t.Error("Received: ", maxUsage)
|
||||
}
|
||||
smgEv = sessionmanager.SMGenericEvent{
|
||||
smgEv = sessions.SMGenericEvent{
|
||||
utils.EVENT_NAME: "UPDATE_SESSION",
|
||||
utils.Account: "rpdata1",
|
||||
utils.Category: "data1",
|
||||
@@ -177,7 +177,7 @@ func TestA1itDataSession1(t *testing.T) {
|
||||
} else if maxUsage != 2097152 {
|
||||
t.Error("Bad max usage: ", maxUsage)
|
||||
}
|
||||
smgEv = sessionmanager.SMGenericEvent{
|
||||
smgEv = sessions.SMGenericEvent{
|
||||
utils.EVENT_NAME: "TERMINATE_SESSION",
|
||||
utils.Account: "rpdata1",
|
||||
utils.Category: "data1",
|
||||
|
||||
@@ -30,7 +30,7 @@ import (
|
||||
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/sessionmanager"
|
||||
"github.com/cgrates/cgrates/sessions"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
"github.com/cgrates/rpcclient"
|
||||
)
|
||||
@@ -171,7 +171,7 @@ func TestRPCITLclStatusFirstFailback(t *testing.T) {
|
||||
|
||||
// Make sure it executes on the first node supporting the command
|
||||
func TestRPCITLclTDirectedRPC(t *testing.T) {
|
||||
var sessions []*sessionmanager.ActiveSession
|
||||
var sessions []*sessions.ActiveSession
|
||||
if err := rpcPoolFirst.Call("SMGenericV1.GetActiveSessions", map[string]string{}, &sessions); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@ gnr=$?
|
||||
echo 'go test github.com/cgrates/cgrates/agents -tags=integration'
|
||||
go test github.com/cgrates/cgrates/agents -tags=integration
|
||||
agts=$?
|
||||
echo 'go test github.com/cgrates/cgrates/sessionmanager -tags=integration'
|
||||
go test github.com/cgrates/cgrates/sessionmanager -tags=integration
|
||||
echo 'go test github.com/cgrates/cgrates/sessions -tags=integration'
|
||||
go test github.com/cgrates/cgrates/sessions -tags=integration
|
||||
smg=$?
|
||||
echo 'go test github.com/cgrates/cgrates/migrator -tags=integration'
|
||||
go test github.com/cgrates/cgrates/migrator -tags=integration
|
||||
|
||||
Reference in New Issue
Block a user