mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
Updated integration tests for routes
This commit is contained in:
committed by
Dan Christian Bogos
parent
c706659063
commit
88db18cc24
@@ -163,9 +163,10 @@ func testV1RouteGetWeightRoutes(t *testing.T) {
|
||||
utils.AccountField: "1007",
|
||||
utils.Destination: "+491511231234",
|
||||
},
|
||||
Opts: map[string]interface{}{utils.OptsRouteProfilesCount: 1},
|
||||
},
|
||||
}
|
||||
eSpls := engine.SortedRoutes{
|
||||
eSpls := engine.SortedRoutesList{{
|
||||
ProfileID: "ROUTE_WEIGHT_1",
|
||||
Sorting: utils.MetaWeight,
|
||||
Count: 2,
|
||||
@@ -183,8 +184,8 @@ func testV1RouteGetWeightRoutes(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
var suplsReply engine.SortedRoutes
|
||||
}}
|
||||
var suplsReply engine.SortedRoutesList
|
||||
if err := routeSv1Rpc.Call(utils.RouteSv1GetRoutes,
|
||||
ev, &suplsReply); err != nil {
|
||||
t.Error(err)
|
||||
@@ -215,9 +216,10 @@ func testV1RouteGetLeastCostRoutes(t *testing.T) {
|
||||
utils.SetupTime: time.Date(2017, 12, 1, 14, 25, 0, 0, time.UTC),
|
||||
utils.Usage: "1m20s",
|
||||
},
|
||||
Opts: map[string]interface{}{utils.OptsRouteProfilesCount: 1},
|
||||
},
|
||||
}
|
||||
eSpls := engine.SortedRoutes{
|
||||
eSpls := engine.SortedRoutesList{{
|
||||
ProfileID: "ROUTE_LEASTCOST_1",
|
||||
Sorting: utils.MetaLC,
|
||||
Count: 3,
|
||||
@@ -247,8 +249,8 @@ func testV1RouteGetLeastCostRoutes(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
var suplsReply engine.SortedRoutes
|
||||
}}
|
||||
var suplsReply engine.SortedRoutesList
|
||||
if err := routeSv1Rpc.Call(utils.RouteSv1GetRoutes,
|
||||
ev, &suplsReply); err != nil {
|
||||
t.Error(err)
|
||||
@@ -269,9 +271,10 @@ func testV1RouteGetLeastCostRoutesWithoutUsage(t *testing.T) {
|
||||
utils.Destination: "1002",
|
||||
utils.SetupTime: time.Date(2017, 12, 1, 14, 25, 0, 0, time.UTC),
|
||||
},
|
||||
Opts: map[string]interface{}{utils.OptsRouteProfilesCount: 1},
|
||||
},
|
||||
}
|
||||
eSpls := engine.SortedRoutes{
|
||||
eSpls := engine.SortedRoutesList{{
|
||||
ProfileID: "ROUTE_LEASTCOST_1",
|
||||
Sorting: utils.MetaLC,
|
||||
Count: 3,
|
||||
@@ -301,8 +304,8 @@ func testV1RouteGetLeastCostRoutesWithoutUsage(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
var suplsReply engine.SortedRoutes
|
||||
}}
|
||||
var suplsReply engine.SortedRoutesList
|
||||
if err := routeSv1Rpc.Call(utils.RouteSv1GetRoutes,
|
||||
ev, &suplsReply); err != nil {
|
||||
t.Error(err)
|
||||
@@ -325,9 +328,10 @@ func testV1RouteGetLeastCostRoutesWithMaxCost(t *testing.T) {
|
||||
utils.SetupTime: time.Date(2017, 12, 1, 14, 25, 0, 0, time.UTC),
|
||||
utils.Usage: "1m20s",
|
||||
},
|
||||
Opts: map[string]interface{}{utils.OptsRouteProfilesCount: 1},
|
||||
},
|
||||
}
|
||||
eSpls := engine.SortedRoutes{
|
||||
eSpls := engine.SortedRoutesList{{
|
||||
ProfileID: "ROUTE_LEASTCOST_1",
|
||||
Sorting: utils.MetaLC,
|
||||
Count: 2,
|
||||
@@ -349,8 +353,8 @@ func testV1RouteGetLeastCostRoutesWithMaxCost(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
var suplsReply engine.SortedRoutes
|
||||
}}
|
||||
var suplsReply engine.SortedRoutesList
|
||||
if err := routeSv1Rpc.Call(utils.RouteSv1GetRoutes,
|
||||
ev, &suplsReply); err != nil {
|
||||
t.Error(err)
|
||||
@@ -375,7 +379,7 @@ func testV1RouteGetLeastCostRoutesWithMaxCostNotFound(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
var suplsReply engine.SortedRoutes
|
||||
var suplsReply engine.SortedRoutesList
|
||||
if err := routeSv1Rpc.Call(utils.RouteSv1GetRoutes,
|
||||
ev, &suplsReply); err != nil && err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Error(err)
|
||||
@@ -396,9 +400,10 @@ func testV1RouteGetLeastCostRoutesWithMaxCost2(t *testing.T) {
|
||||
utils.Usage: "10m20s",
|
||||
utils.Category: "call",
|
||||
},
|
||||
Opts: map[string]interface{}{utils.OptsRouteProfilesCount: 1},
|
||||
},
|
||||
}
|
||||
eSpls := engine.SortedRoutes{
|
||||
eSpls := engine.SortedRoutesList{{
|
||||
ProfileID: "ROUTE_LEASTCOST_1",
|
||||
Sorting: utils.MetaLC,
|
||||
Count: 2,
|
||||
@@ -420,8 +425,8 @@ func testV1RouteGetLeastCostRoutesWithMaxCost2(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
var suplsReply engine.SortedRoutes
|
||||
}}
|
||||
var suplsReply engine.SortedRoutesList
|
||||
if err := routeSv1Rpc.Call(utils.RouteSv1GetRoutes,
|
||||
ev, &suplsReply); err != nil {
|
||||
t.Error(err)
|
||||
@@ -443,9 +448,10 @@ func testV1RouteGetHighestCostRoutes(t *testing.T) {
|
||||
utils.Usage: "1m20s",
|
||||
"DistinctMatch": "*highest_cost",
|
||||
},
|
||||
Opts: map[string]interface{}{utils.OptsRouteProfilesCount: 1},
|
||||
},
|
||||
}
|
||||
eSpls := engine.SortedRoutes{
|
||||
eSpls := engine.SortedRoutesList{{
|
||||
ProfileID: "ROUTE_HIGHESTCOST_1",
|
||||
Sorting: utils.MetaHC,
|
||||
Count: 3,
|
||||
@@ -475,8 +481,8 @@ func testV1RouteGetHighestCostRoutes(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
var suplsReply engine.SortedRoutes
|
||||
}}
|
||||
var suplsReply engine.SortedRoutesList
|
||||
if err := routeSv1Rpc.Call(utils.RouteSv1GetRoutes,
|
||||
ev, &suplsReply); err != nil {
|
||||
t.Error(err)
|
||||
@@ -500,7 +506,7 @@ func testV1RouteGetLeastCostRoutesErr(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
var suplsReply engine.SortedRoutes
|
||||
var suplsReply engine.SortedRoutesList
|
||||
if err := routeSv1Rpc.Call(utils.RouteSv1GetRoutes,
|
||||
ev, &suplsReply); err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Error(err)
|
||||
@@ -656,18 +662,18 @@ func testV1RouteGetQOSRoutes(t *testing.T) {
|
||||
},
|
||||
}
|
||||
expRouteIDs := []string{"route1", "route3", "route2"}
|
||||
var suplsReply engine.SortedRoutes
|
||||
var suplsReply engine.SortedRoutesList
|
||||
if err := routeSv1Rpc.Call(utils.RouteSv1GetRoutes,
|
||||
ev, &suplsReply); err != nil {
|
||||
t.Error(err)
|
||||
} else {
|
||||
rcvSupl := make([]string, len(suplsReply.Routes))
|
||||
for i, supl := range suplsReply.Routes {
|
||||
rcvSupl := make([]string, len(suplsReply[0].Routes))
|
||||
for i, supl := range suplsReply[0].Routes {
|
||||
rcvSupl[i] = supl.RouteID
|
||||
}
|
||||
if suplsReply.ProfileID != "ROUTE_QOS_1" {
|
||||
if suplsReply[0].ProfileID != "ROUTE_QOS_1" {
|
||||
t.Errorf("Expecting: ROUTE_QOS_1, received: %s",
|
||||
suplsReply.ProfileID)
|
||||
suplsReply[0].ProfileID)
|
||||
}
|
||||
if !reflect.DeepEqual(rcvSupl, expRouteIDs) {
|
||||
t.Errorf("Expecting: %+v, \n received: %+v",
|
||||
@@ -687,18 +693,18 @@ func testV1RouteGetQOSRoutes2(t *testing.T) {
|
||||
},
|
||||
}
|
||||
expRouteIDs := []string{"route3", "route2", "route1"}
|
||||
var suplsReply engine.SortedRoutes
|
||||
var suplsReply engine.SortedRoutesList
|
||||
if err := routeSv1Rpc.Call(utils.RouteSv1GetRoutes,
|
||||
ev, &suplsReply); err != nil {
|
||||
t.Error(err)
|
||||
} else {
|
||||
rcvSupl := make([]string, len(suplsReply.Routes))
|
||||
for i, supl := range suplsReply.Routes {
|
||||
rcvSupl := make([]string, len(suplsReply[0].Routes))
|
||||
for i, supl := range suplsReply[0].Routes {
|
||||
rcvSupl[i] = supl.RouteID
|
||||
}
|
||||
if suplsReply.ProfileID != "ROUTE_QOS_2" {
|
||||
if suplsReply[0].ProfileID != "ROUTE_QOS_2" {
|
||||
t.Errorf("Expecting: ROUTE_QOS_2, received: %s",
|
||||
suplsReply.ProfileID)
|
||||
suplsReply[0].ProfileID)
|
||||
}
|
||||
if !reflect.DeepEqual(rcvSupl, expRouteIDs) {
|
||||
t.Errorf("Expecting: %+v, \n received: %+v",
|
||||
@@ -718,18 +724,18 @@ func testV1RouteGetQOSRoutes3(t *testing.T) {
|
||||
},
|
||||
}
|
||||
expRouteIDs := []string{"route1", "route3", "route2"}
|
||||
var suplsReply engine.SortedRoutes
|
||||
var suplsReply engine.SortedRoutesList
|
||||
if err := routeSv1Rpc.Call(utils.RouteSv1GetRoutes,
|
||||
ev, &suplsReply); err != nil {
|
||||
t.Error(err)
|
||||
} else {
|
||||
rcvSupl := make([]string, len(suplsReply.Routes))
|
||||
for i, supl := range suplsReply.Routes {
|
||||
rcvSupl := make([]string, len(suplsReply[0].Routes))
|
||||
for i, supl := range suplsReply[0].Routes {
|
||||
rcvSupl[i] = supl.RouteID
|
||||
}
|
||||
if suplsReply.ProfileID != "ROUTE_QOS_3" {
|
||||
if suplsReply[0].ProfileID != "ROUTE_QOS_3" {
|
||||
t.Errorf("Expecting: ROUTE_QOS_3, received: %s",
|
||||
suplsReply.ProfileID)
|
||||
suplsReply[0].ProfileID)
|
||||
}
|
||||
if !reflect.DeepEqual(rcvSupl, expRouteIDs) {
|
||||
t.Errorf("Expecting: %+v, \n received: %+v",
|
||||
@@ -749,18 +755,18 @@ func testV1RouteGetQOSRoutesFiltred(t *testing.T) {
|
||||
},
|
||||
}
|
||||
expRouteIDs := []string{"route1", "route3"}
|
||||
var suplsReply engine.SortedRoutes
|
||||
var suplsReply engine.SortedRoutesList
|
||||
if err := routeSv1Rpc.Call(utils.RouteSv1GetRoutes,
|
||||
ev, &suplsReply); err != nil {
|
||||
t.Error(err)
|
||||
} else {
|
||||
rcvSupl := make([]string, len(suplsReply.Routes))
|
||||
for i, supl := range suplsReply.Routes {
|
||||
rcvSupl := make([]string, len(suplsReply[0].Routes))
|
||||
for i, supl := range suplsReply[0].Routes {
|
||||
rcvSupl[i] = supl.RouteID
|
||||
}
|
||||
if suplsReply.ProfileID != "ROUTE_QOS_FILTRED" {
|
||||
if suplsReply[0].ProfileID != "ROUTE_QOS_FILTRED" {
|
||||
t.Errorf("Expecting: ROUTE_QOS_FILTRED, received: %s",
|
||||
suplsReply.ProfileID)
|
||||
suplsReply[0].ProfileID)
|
||||
}
|
||||
if !reflect.DeepEqual(rcvSupl, expRouteIDs) {
|
||||
t.Errorf("Expecting: %+v, \n received: %+v",
|
||||
@@ -784,18 +790,18 @@ func testV1RouteGetQOSRoutesFiltred2(t *testing.T) {
|
||||
},
|
||||
}
|
||||
expRouteIDs := []string{"route3", "route2"}
|
||||
var suplsReply engine.SortedRoutes
|
||||
var suplsReply engine.SortedRoutesList
|
||||
if err := routeSv1Rpc.Call(utils.RouteSv1GetRoutes,
|
||||
ev, &suplsReply); err != nil {
|
||||
t.Error(err)
|
||||
} else {
|
||||
rcvSupl := make([]string, len(suplsReply.Routes))
|
||||
for i, supl := range suplsReply.Routes {
|
||||
rcvSupl := make([]string, len(suplsReply[0].Routes))
|
||||
for i, supl := range suplsReply[0].Routes {
|
||||
rcvSupl[i] = supl.RouteID
|
||||
}
|
||||
if suplsReply.ProfileID != "ROUTE_QOS_FILTRED2" {
|
||||
if suplsReply[0].ProfileID != "ROUTE_QOS_FILTRED2" {
|
||||
t.Errorf("Expecting: ROUTE_QOS_FILTRED2, received: %s",
|
||||
suplsReply.ProfileID)
|
||||
suplsReply[0].ProfileID)
|
||||
}
|
||||
if !reflect.DeepEqual(rcvSupl, expRouteIDs) {
|
||||
t.Errorf("Expecting: %+v, \n received: %+v",
|
||||
@@ -815,7 +821,7 @@ func testV1RouteGetRouteWithoutFilter(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
eSpls := engine.SortedRoutes{
|
||||
eSpls := engine.SortedRoutesList{{
|
||||
ProfileID: "ROUTE_WEIGHT_2",
|
||||
Sorting: utils.MetaWeight,
|
||||
Count: 1,
|
||||
@@ -827,8 +833,8 @@ func testV1RouteGetRouteWithoutFilter(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
var suplsReply engine.SortedRoutes
|
||||
}}
|
||||
var suplsReply engine.SortedRoutesList
|
||||
if err := routeSv1Rpc.Call(utils.RouteSv1GetRoutes,
|
||||
ev, &suplsReply); err != nil {
|
||||
t.Error(err)
|
||||
@@ -1143,7 +1149,7 @@ func testV1RoutesOneRouteWithoutDestination(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
eSpls := engine.SortedRoutes{
|
||||
eSpls := engine.SortedRoutesList{{
|
||||
ProfileID: "ROUTE_DESTINATION",
|
||||
Sorting: utils.MetaLC,
|
||||
Count: 1,
|
||||
@@ -1157,8 +1163,8 @@ func testV1RoutesOneRouteWithoutDestination(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
var suplsReply engine.SortedRoutes
|
||||
}}
|
||||
var suplsReply engine.SortedRoutesList
|
||||
if err := routeSv1Rpc.Call(utils.RouteSv1GetRoutes,
|
||||
ev, &suplsReply); err != nil {
|
||||
t.Error(err)
|
||||
@@ -1220,7 +1226,7 @@ func testV1RouteMultipleRouteSameID(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
eSpls := engine.SortedRoutes{
|
||||
eSpls := engine.SortedRoutesList{{
|
||||
ProfileID: "MULTIPLE_ROUTES",
|
||||
Sorting: utils.MetaLC,
|
||||
Count: 1,
|
||||
@@ -1234,8 +1240,8 @@ func testV1RouteMultipleRouteSameID(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
var suplsReply engine.SortedRoutes
|
||||
}}
|
||||
var suplsReply engine.SortedRoutesList
|
||||
if err := routeSv1Rpc.Call(utils.RouteSv1GetRoutes,
|
||||
ev, &suplsReply); err != nil {
|
||||
t.Error(err)
|
||||
@@ -1258,7 +1264,7 @@ func testV1RouteMultipleRouteSameID(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
eSpls = engine.SortedRoutes{
|
||||
eSpls = engine.SortedRoutesList{{
|
||||
ProfileID: "MULTIPLE_ROUTES",
|
||||
Sorting: utils.MetaLC,
|
||||
Count: 1,
|
||||
@@ -1272,7 +1278,7 @@ func testV1RouteMultipleRouteSameID(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}}
|
||||
if err := routeSv1Rpc.Call(utils.RouteSv1GetRoutes,
|
||||
ev, &suplsReply); err != nil {
|
||||
t.Error(err)
|
||||
@@ -1356,7 +1362,7 @@ func testV1RouteAccountWithRatingPlan(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
eSpls := &engine.SortedRoutes{
|
||||
eSpls := &engine.SortedRoutesList{{
|
||||
ProfileID: "RouteWithAccAndRP",
|
||||
Sorting: utils.MetaLC,
|
||||
Count: 2,
|
||||
@@ -1379,9 +1385,9 @@ func testV1RouteAccountWithRatingPlan(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}}
|
||||
if *encoding == utils.MetaGOB {
|
||||
eSpls.Routes = []*engine.SortedRoute{
|
||||
(*eSpls)[0].Routes = []*engine.SortedRoute{
|
||||
{
|
||||
RouteID: "RouteWithAccAndRP",
|
||||
SortingData: map[string]interface{}{
|
||||
@@ -1401,7 +1407,7 @@ func testV1RouteAccountWithRatingPlan(t *testing.T) {
|
||||
},
|
||||
}
|
||||
}
|
||||
var suplsReply *engine.SortedRoutes
|
||||
var suplsReply *engine.SortedRoutesList
|
||||
if err := routeSv1Rpc.Call(utils.RouteSv1GetRoutes,
|
||||
ev, &suplsReply); err != nil {
|
||||
t.Error(err)
|
||||
@@ -1426,7 +1432,7 @@ func testV1RouteAccountWithRatingPlan(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
eSpls = &engine.SortedRoutes{
|
||||
eSpls = &engine.SortedRoutesList{{
|
||||
ProfileID: "RouteWithAccAndRP",
|
||||
Sorting: utils.MetaLC,
|
||||
Count: 2,
|
||||
@@ -1450,9 +1456,9 @@ func testV1RouteAccountWithRatingPlan(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}}
|
||||
if *encoding == utils.MetaGOB {
|
||||
eSpls.Routes = []*engine.SortedRoute{
|
||||
(*eSpls)[0].Routes = []*engine.SortedRoute{
|
||||
{
|
||||
RouteID: "RouteWithAccAndRP",
|
||||
SortingData: map[string]interface{}{
|
||||
@@ -1473,7 +1479,7 @@ func testV1RouteAccountWithRatingPlan(t *testing.T) {
|
||||
},
|
||||
}
|
||||
}
|
||||
var routeRply *engine.SortedRoutes
|
||||
var routeRply *engine.SortedRoutesList
|
||||
if err := routeSv1Rpc.Call(utils.RouteSv1GetRoutes,
|
||||
ev, &routeRply); err != nil {
|
||||
t.Error(err)
|
||||
@@ -1498,7 +1504,7 @@ func testV1RouteAccountWithRatingPlan(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
eSpls = &engine.SortedRoutes{
|
||||
eSpls = &engine.SortedRoutesList{{
|
||||
ProfileID: "RouteWithAccAndRP",
|
||||
Sorting: utils.MetaLC,
|
||||
Count: 2,
|
||||
@@ -1522,9 +1528,9 @@ func testV1RouteAccountWithRatingPlan(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}}
|
||||
if *encoding == utils.MetaGOB {
|
||||
eSpls.Routes = []*engine.SortedRoute{
|
||||
(*eSpls)[0].Routes = []*engine.SortedRoute{
|
||||
{
|
||||
RouteID: "RouteWithRP",
|
||||
SortingData: map[string]interface{}{
|
||||
@@ -1545,7 +1551,7 @@ func testV1RouteAccountWithRatingPlan(t *testing.T) {
|
||||
},
|
||||
}
|
||||
}
|
||||
var routeRply2 *engine.SortedRoutes
|
||||
var routeRply2 *engine.SortedRoutesList
|
||||
if err := routeSv1Rpc.Call(utils.RouteSv1GetRoutes,
|
||||
ev, &routeRply2); err != nil {
|
||||
t.Error(err)
|
||||
|
||||
@@ -195,7 +195,7 @@ func testSSv1ItProcessEventAuth(t *testing.T) {
|
||||
if rply.ResourceAllocation == nil || rply.ResourceAllocation["CustomerCharges"] == utils.EmptyString {
|
||||
t.Errorf("Unexpected ResourceAllocation: %s", rply.ResourceAllocation)
|
||||
}
|
||||
eSplrs := &engine.SortedRoutes{
|
||||
eSplrs := engine.SortedRoutesList{{
|
||||
ProfileID: "ROUTE_ACNT_1001",
|
||||
Sorting: utils.MetaWeight,
|
||||
Count: 2,
|
||||
@@ -213,7 +213,17 @@ func testSSv1ItProcessEventAuth(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}, {
|
||||
ProfileID: "ROUTE_WEIGHT_2",
|
||||
Sorting: utils.MetaWeight,
|
||||
Count: 1,
|
||||
Routes: []*engine.SortedRoute{{
|
||||
RouteID: "route1",
|
||||
SortingData: map[string]interface{}{
|
||||
"Weight": 10.0,
|
||||
},
|
||||
}},
|
||||
}}
|
||||
if !reflect.DeepEqual(eSplrs, rply.Routes[utils.MetaRaw]) {
|
||||
t.Errorf("expecting: %+v,\n received: %+v", utils.ToJSON(eSplrs), utils.ToJSON(rply.Routes[utils.MetaRaw]))
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ func testSSv1ItAuth(t *testing.T) {
|
||||
if *rply.ResourceAllocation == "" {
|
||||
t.Errorf("Unexpected ResourceAllocation: %s", *rply.ResourceAllocation)
|
||||
}
|
||||
eSplrs := &engine.SortedRoutes{
|
||||
eSplrs := engine.SortedRoutesList{{
|
||||
ProfileID: "ROUTE_ACNT_1001",
|
||||
Sorting: utils.MetaWeight,
|
||||
Count: 2,
|
||||
@@ -250,7 +250,17 @@ func testSSv1ItAuth(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}, {
|
||||
ProfileID: "ROUTE_WEIGHT_2",
|
||||
Sorting: utils.MetaWeight,
|
||||
Count: 1,
|
||||
Routes: []*engine.SortedRoute{{
|
||||
RouteID: "route1",
|
||||
SortingData: map[string]interface{}{
|
||||
"Weight": 10.0,
|
||||
},
|
||||
}},
|
||||
}}
|
||||
if !reflect.DeepEqual(eSplrs, rply.Routes) {
|
||||
t.Errorf("expecting: %+v,\n received: %+v", utils.ToJSON(eSplrs), utils.ToJSON(rply.Routes))
|
||||
}
|
||||
@@ -303,6 +313,7 @@ func testSSv1ItAuthWithDigest(t *testing.T) {
|
||||
utils.SetupTime: time.Date(2018, time.January, 7, 16, 60, 0, 0, time.UTC),
|
||||
utils.Usage: authUsage,
|
||||
},
|
||||
Opts: map[string]interface{}{utils.OptsRouteProfilesCount: 1},
|
||||
},
|
||||
}
|
||||
var rply sessions.V1AuthorizeReplyWithDigest
|
||||
|
||||
@@ -124,8 +124,8 @@ func testDspSupPingFailover(t *testing.T) {
|
||||
}
|
||||
|
||||
func testDspSupGetSupFailover(t *testing.T) {
|
||||
var rpl *engine.SortedRoutes
|
||||
eRpl1 := &engine.SortedRoutes{
|
||||
var rpl engine.SortedRoutesList
|
||||
eRpl1 := engine.SortedRoutesList{{
|
||||
ProfileID: "ROUTE_WEIGHT_2",
|
||||
Sorting: utils.MetaWeight,
|
||||
Count: 1,
|
||||
@@ -138,8 +138,8 @@ func testDspSupGetSupFailover(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
eRpl := &engine.SortedRoutes{
|
||||
}}
|
||||
eRpl := engine.SortedRoutesList{{
|
||||
ProfileID: "ROUTE_ACNT_1002",
|
||||
Sorting: utils.MetaLC,
|
||||
Count: 2,
|
||||
@@ -163,7 +163,7 @@ func testDspSupGetSupFailover(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}}
|
||||
args := &engine.ArgsGetRoutes{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
@@ -200,7 +200,7 @@ func testDspSupGetSupFailover(t *testing.T) {
|
||||
}
|
||||
|
||||
func testDspSupTestAuthKey(t *testing.T) {
|
||||
var rpl *engine.SortedRoutes
|
||||
var rpl engine.SortedRoutesList
|
||||
args := &engine.ArgsGetRoutes{
|
||||
CGREvent: &utils.CGREvent{
|
||||
ID: utils.UUIDSha1Prefix(),
|
||||
@@ -225,8 +225,8 @@ func testDspSupTestAuthKey(t *testing.T) {
|
||||
}
|
||||
|
||||
func testDspSupTestAuthKey2(t *testing.T) {
|
||||
var rpl *engine.SortedRoutes
|
||||
eRpl := &engine.SortedRoutes{
|
||||
var rpl engine.SortedRoutesList
|
||||
eRpl := engine.SortedRoutesList{{
|
||||
ProfileID: "ROUTE_ACNT_1002",
|
||||
Sorting: utils.MetaLC,
|
||||
Count: 2,
|
||||
@@ -250,7 +250,7 @@ func testDspSupTestAuthKey2(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}}
|
||||
args := &engine.ArgsGetRoutes{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
@@ -278,8 +278,8 @@ func testDspSupTestAuthKey2(t *testing.T) {
|
||||
}
|
||||
|
||||
func testDspSupGetSupRoundRobin(t *testing.T) {
|
||||
var rpl *engine.SortedRoutes
|
||||
eRpl1 := &engine.SortedRoutes{
|
||||
var rpl engine.SortedRoutesList
|
||||
eRpl1 := engine.SortedRoutesList{{
|
||||
ProfileID: "ROUTE_WEIGHT_2",
|
||||
Sorting: utils.MetaWeight,
|
||||
Count: 1,
|
||||
@@ -292,8 +292,8 @@ func testDspSupGetSupRoundRobin(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
eRpl := &engine.SortedRoutes{
|
||||
}}
|
||||
eRpl := engine.SortedRoutesList{{
|
||||
ProfileID: "ROUTE_ACNT_1002",
|
||||
Sorting: utils.MetaLC,
|
||||
Count: 2,
|
||||
@@ -317,7 +317,7 @@ func testDspSupGetSupRoundRobin(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}}
|
||||
args := &engine.ArgsGetRoutes{
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
|
||||
@@ -242,7 +242,8 @@ func testDspSessionAuthorize(t *testing.T) {
|
||||
},
|
||||
|
||||
Opts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "ses12345",
|
||||
utils.OptsAPIKey: "ses12345",
|
||||
utils.OptsRouteProfilesCount: 1.,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ func testSesRoutesAuthorizeEvent(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
expected := sessions.V1AuthorizeReply{
|
||||
Routes: &engine.SortedRoutes{
|
||||
Routes: engine.SortedRoutesList{{
|
||||
ProfileID: "ROUTE_LEASTCOST_1",
|
||||
Sorting: "*lc",
|
||||
Count: 3,
|
||||
@@ -173,7 +173,7 @@ func testSesRoutesAuthorizeEvent(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}}
|
||||
if !reflect.DeepEqual(rply, expected) {
|
||||
t.Errorf("Expected: %s, received: %s", utils.ToJSON(expected), utils.ToJSON(rply))
|
||||
}
|
||||
@@ -192,7 +192,7 @@ func testSesRoutesAuthorizeEvent(t *testing.T) {
|
||||
}
|
||||
|
||||
expected = sessions.V1AuthorizeReply{
|
||||
Routes: &engine.SortedRoutes{
|
||||
Routes: engine.SortedRoutesList{{
|
||||
ProfileID: "ROUTE_LEASTCOST_1",
|
||||
Sorting: "*lc",
|
||||
Count: 2,
|
||||
@@ -216,7 +216,7 @@ func testSesRoutesAuthorizeEvent(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}}
|
||||
|
||||
args = sessions.NewV1AuthorizeArgs(false, []string{},
|
||||
false, []string{}, false, []string{}, false, false,
|
||||
@@ -274,7 +274,7 @@ func testSesRoutesProcessMessage(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
expected := sessions.V1ProcessMessageReply{
|
||||
Routes: &engine.SortedRoutes{
|
||||
Routes: engine.SortedRoutesList{{
|
||||
ProfileID: "ROUTE_LEASTCOST_1",
|
||||
Sorting: "*lc",
|
||||
Count: 3,
|
||||
@@ -306,7 +306,7 @@ func testSesRoutesProcessMessage(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}}
|
||||
if !reflect.DeepEqual(rply, expected) {
|
||||
t.Errorf("Expected: %s, received: %s", utils.ToJSON(expected), utils.ToJSON(rply))
|
||||
}
|
||||
@@ -326,7 +326,7 @@ func testSesRoutesProcessMessage(t *testing.T) {
|
||||
}
|
||||
|
||||
expected = sessions.V1ProcessMessageReply{
|
||||
Routes: &engine.SortedRoutes{
|
||||
Routes: engine.SortedRoutesList{{
|
||||
ProfileID: "ROUTE_LEASTCOST_1",
|
||||
Sorting: "*lc",
|
||||
Count: 2,
|
||||
@@ -350,7 +350,7 @@ func testSesRoutesProcessMessage(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}}
|
||||
|
||||
args = sessions.NewV1ProcessMessageArgs(false, []string{},
|
||||
false, []string{}, false, []string{}, false, false,
|
||||
@@ -409,8 +409,8 @@ func testSesRoutesProcessEvent(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
expected := sessions.V1ProcessEventReply{
|
||||
Routes: map[string]*engine.SortedRoutes{
|
||||
utils.MetaRaw: {
|
||||
Routes: map[string]engine.SortedRoutesList{
|
||||
utils.MetaRaw: {{
|
||||
ProfileID: "ROUTE_LEASTCOST_1",
|
||||
Sorting: "*lc",
|
||||
Count: 3,
|
||||
@@ -442,8 +442,8 @@ func testSesRoutesProcessEvent(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
}}
|
||||
if !reflect.DeepEqual(rply, expected) {
|
||||
t.Errorf("Expected: %s, received: %s", utils.ToJSON(expected), utils.ToJSON(rply))
|
||||
}
|
||||
@@ -465,8 +465,8 @@ func testSesRoutesProcessEvent(t *testing.T) {
|
||||
}
|
||||
|
||||
expected = sessions.V1ProcessEventReply{
|
||||
Routes: map[string]*engine.SortedRoutes{
|
||||
utils.MetaRaw: {
|
||||
Routes: map[string]engine.SortedRoutesList{
|
||||
utils.MetaRaw: {{
|
||||
ProfileID: "ROUTE_LEASTCOST_1",
|
||||
Sorting: "*lc",
|
||||
Count: 2,
|
||||
@@ -490,8 +490,8 @@ func testSesRoutesProcessEvent(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
}}
|
||||
|
||||
args = sessions.V1ProcessEventArgs{
|
||||
Flags: []string{"*routes:*maxcost:1"},
|
||||
|
||||
@@ -149,7 +149,8 @@ cgrates (0.11.0~dev) UNRELEASED; urgency=medium
|
||||
* [RegistrarC] Renamed DispatcherH to RegistrarC
|
||||
* [DataDB] Added replication filtering
|
||||
* [ApierS] Moved Cache field as options
|
||||
|
||||
* [RouteS] Updated RouteSv1.GetRoutes API to return multiple profiles
|
||||
|
||||
-- DanB <danb@cgrates.org> Wed, 19 Feb 2020 13:25:52 +0200
|
||||
|
||||
cgrates (0.10.0) UNRELEASED; urgency=medium
|
||||
|
||||
Reference in New Issue
Block a user