diff --git a/apier/v1/versions_it_test.go b/apier/v1/versions_it_test.go index d745febce..d872c2a27 100644 --- a/apier/v1/versions_it_test.go +++ b/apier/v1/versions_it_test.go @@ -48,6 +48,8 @@ var sTestsVrs = []func(t *testing.T){ testVrsRpcConn, testVrsDataDB, testVrsStorDB, + testVrsSetDataDBVrs, + testVrsSetStorDBVrs, testVrsKillEngine, } @@ -130,6 +132,76 @@ func testVrsStorDB(t *testing.T) { } } +func testVrsSetDataDBVrs(t *testing.T) { + var reply string + args := SetVersionsArg{ + Versions: engine.Versions{ + "Attributes": 3, + }, + } + if err := vrsRPC.Call("ApierV1.SetDataDBVersions", args, &reply); err != nil { + t.Error(err) + } else if reply != utils.OK { + t.Errorf("Expecting: %+v, received: %+v", utils.OK, reply) + } + + var result engine.Versions + expectedVrs := engine.Versions{"ActionTriggers": 2, + "Actions": 2, "RQF": 1, "ReverseDestinations": 1, "Attributes": 3, "RatingPlan": 1, + "RatingProfile": 1, "User": 1, "Accounts": 3, "ActionPlans": 2, "Chargers": 1, + "Destinations": 1, "SharedGroups": 2, "Stats": 2, "Resource": 1, + "Subscribers": 1, "Suppliers": 1, "Thresholds": 3, "Timing": 1} + if err := vrsRPC.Call("ApierV1.GetDataDBVersions", "", &result); err != nil { + t.Error(err) + } else if expectedVrs.Compare(result, vrsStorageType, true) != "" { + t.Errorf("Expecting: %+v, received: %+v", result, expectedVrs) + } + + args = SetVersionsArg{ + Versions: nil, + } + if err := vrsRPC.Call("ApierV1.SetDataDBVersions", args, &reply); err != nil { + t.Error(err) + } else if reply != utils.OK { + t.Errorf("Expecting: %+v, received: %+v", utils.OK, reply) + } +} + +func testVrsSetStorDBVrs(t *testing.T) { + var reply string + args := SetVersionsArg{ + Versions: engine.Versions{ + "TpResources": 2, + }, + } + if err := vrsRPC.Call("ApierV1.SetStorDBVersions", args, &reply); err != nil { + t.Error(err) + } else if reply != utils.OK { + t.Errorf("Expecting: %+v, received: %+v", utils.OK, reply) + } + + var result engine.Versions + expectedVrs := engine.Versions{"TpDestinations": 1, "TpResource": 1, "TpThresholds": 1, + "TpActions": 1, "TpDestinationRates": 1, "TpFilters": 1, "TpRates": 1, "CDRs": 2, "TpActionTriggers": 1, "TpRatingPlans": 1, + "TpSharedGroups": 1, "TpSuppliers": 1, "SessionSCosts": 3, "TpRatingProfiles": 1, "TpStats": 1, "TpTiming": 1, + "CostDetails": 2, "TpAccountActions": 1, "TpActionPlans": 1, "TpChargers": 1, "TpRatingProfile": 1, + "TpRatingPlan": 1, "TpResources": 2} + if err := vrsRPC.Call("ApierV1.GetStorDBVersions", "", &result); err != nil { + t.Error(err) + } else if expectedVrs.Compare(result, vrsStorageType, true) != "" { + t.Errorf("Expecting: %+v, received: %+v", result, expectedVrs) + } + + args = SetVersionsArg{ + Versions: nil, + } + if err := vrsRPC.Call("ApierV1.SetStorDBVersions", args, &reply); err != nil { + t.Error(err) + } else if reply != utils.OK { + t.Errorf("Expecting: %+v, received: %+v", utils.OK, reply) + } +} + func testVrsKillEngine(t *testing.T) { if err := engine.KillEngine(vrsDelay); err != nil { t.Error(err)