mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-17 06:09:53 +05:00
Fix failing tests after renaming stats apis consts
This commit is contained in:
committed by
Dan Christian Bogos
parent
a2bc6f5cd3
commit
040371968f
@@ -26,7 +26,7 @@ import (
|
||||
func init() {
|
||||
c := &CmdGetStatQueueProfile{
|
||||
name: "stats_profile",
|
||||
rpcMethod: utils.APIerSv1GetStatQueueProfile,
|
||||
rpcMethod: utils.AdminSv1GetStatQueueProfile,
|
||||
rpcParams: &utils.TenantID{},
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
func init() {
|
||||
c := &CmdGetStatQueueIDs{
|
||||
name: "stats_profile_ids",
|
||||
rpcMethod: utils.APIerSv1GetStatQueueProfileIDs,
|
||||
rpcMethod: utils.AdminSv1GetStatQueueProfileIDs,
|
||||
rpcParams: &utils.PaginatorWithTenant{},
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
|
||||
@@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils"
|
||||
func init() {
|
||||
c := &CmdRemoveStatQueue{
|
||||
name: "stats_profile_remove",
|
||||
rpcMethod: utils.APIerSv1RemoveStatQueueProfile,
|
||||
rpcMethod: utils.AdminSv1RemoveStatQueueProfile,
|
||||
rpcParams: &utils.TenantIDWithAPIOpts{},
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
func init() {
|
||||
c := &CmdSetStatQueue{
|
||||
name: "stats_profile_set",
|
||||
rpcMethod: utils.APIerSv1SetStatQueueProfile,
|
||||
rpcMethod: utils.AdminSv1SetStatQueueProfile,
|
||||
rpcParams: &engine.StatQueueProfileWithAPIOpts{},
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
|
||||
@@ -464,7 +464,7 @@ func testV2CDRsGetCdrs5(t *testing.T) {
|
||||
|
||||
func testV2CDRsSetStats(t *testing.T) {
|
||||
var reply *engine.StatQueueProfile
|
||||
if err := cdrsRpc.Call(utils.APIerSv1GetStatQueueProfile,
|
||||
if err := cdrsRpc.Call(utils.AdminSv1GetStatQueueProfile,
|
||||
&utils.TenantID{Tenant: "cgrates.org", ID: "STS_PoccessCDR"}, &reply); err == nil ||
|
||||
err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Error(err)
|
||||
@@ -486,12 +486,12 @@ func testV2CDRsSetStats(t *testing.T) {
|
||||
},
|
||||
}
|
||||
var result string
|
||||
if err := cdrsRpc.Call(utils.APIerSv1SetStatQueueProfile, statConfig, &result); err != nil {
|
||||
if err := cdrsRpc.Call(utils.AdminSv1SetStatQueueProfile, statConfig, &result); err != nil {
|
||||
t.Error(err)
|
||||
} else if result != utils.OK {
|
||||
t.Error("Unexpected reply returned", result)
|
||||
}
|
||||
if err := cdrsRpc.Call(utils.APIerSv1GetStatQueueProfile,
|
||||
if err := cdrsRpc.Call(utils.AdminSv1GetStatQueueProfile,
|
||||
&utils.TenantID{Tenant: "cgrates.org", ID: "STS_PoccessCDR"}, &reply); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(statConfig.StatQueueProfile, reply) {
|
||||
|
||||
@@ -103,7 +103,7 @@ func testdoubleRemoveRpcConn(t *testing.T) {
|
||||
func testdoubleRemoveStatQueueProfile(t *testing.T) {
|
||||
// check
|
||||
var reply *engine.StatQueueProfile
|
||||
if err := sesRPC.Call(utils.APIerSv1GetStatQueueProfile,
|
||||
if err := sesRPC.Call(utils.AdminSv1GetStatQueueProfile,
|
||||
&utils.TenantID{Tenant: doubleRemoveTenant, ID: "TEST_PROFILE1"}, &reply); err == nil ||
|
||||
err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Error(err)
|
||||
@@ -132,13 +132,13 @@ func testdoubleRemoveStatQueueProfile(t *testing.T) {
|
||||
},
|
||||
}
|
||||
var result string
|
||||
if err := sesRPC.Call(utils.APIerSv1SetStatQueueProfile, statConfig, &result); err != nil {
|
||||
if err := sesRPC.Call(utils.AdminSv1SetStatQueueProfile, statConfig, &result); err != nil {
|
||||
t.Error(err)
|
||||
} else if result != utils.OK {
|
||||
t.Error("Unexpected reply returned", result)
|
||||
}
|
||||
//check
|
||||
if err := sesRPC.Call(utils.APIerSv1GetStatQueueProfile,
|
||||
if err := sesRPC.Call(utils.AdminSv1GetStatQueueProfile,
|
||||
&utils.TenantID{Tenant: doubleRemoveTenant, ID: "TEST_PROFILE1"}, &reply); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(statConfig.StatQueueProfile, reply) {
|
||||
@@ -146,24 +146,24 @@ func testdoubleRemoveStatQueueProfile(t *testing.T) {
|
||||
}
|
||||
|
||||
//remove
|
||||
if err := sesRPC.Call(utils.APIerSv1RemoveStatQueueProfile,
|
||||
if err := sesRPC.Call(utils.AdminSv1RemoveStatQueueProfile,
|
||||
&utils.TenantID{Tenant: doubleRemoveTenant, ID: "TEST_PROFILE1"}, &result); err != nil {
|
||||
t.Error(err)
|
||||
} else if result != utils.OK {
|
||||
t.Error("Unexpected reply returned", result)
|
||||
}
|
||||
if err := sesRPC.Call(utils.APIerSv1RemoveStatQueueProfile,
|
||||
if err := sesRPC.Call(utils.AdminSv1RemoveStatQueueProfile,
|
||||
&utils.TenantID{Tenant: doubleRemoveTenant, ID: "TEST_PROFILE1"}, &result); err == nil ||
|
||||
err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Error(err)
|
||||
}
|
||||
if err := sesRPC.Call(utils.APIerSv1RemoveStatQueueProfile,
|
||||
if err := sesRPC.Call(utils.AdminSv1RemoveStatQueueProfile,
|
||||
&utils.TenantID{Tenant: doubleRemoveTenant, ID: "TEST_PROFILE1"}, &result); err == nil ||
|
||||
err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Error(err)
|
||||
}
|
||||
// check
|
||||
if err := sesRPC.Call(utils.APIerSv1GetStatQueueProfile,
|
||||
if err := sesRPC.Call(utils.AdminSv1GetStatQueueProfile,
|
||||
&utils.TenantID{Tenant: doubleRemoveTenant, ID: "TEST_PROFILE1"}, &reply); err == nil ||
|
||||
err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Error(err)
|
||||
|
||||
@@ -279,7 +279,7 @@ func testExpVerifyStats(t *testing.T) {
|
||||
ThresholdIDs: []string{utils.MetaNone},
|
||||
}
|
||||
var reply *engine.StatQueueProfile
|
||||
if err := expRpc.Call(utils.APIerSv1GetStatQueueProfile,
|
||||
if err := expRpc.Call(utils.AdminSv1GetStatQueueProfile,
|
||||
&utils.TenantID{Tenant: "cgrates.org", ID: "Stat_1"}, &reply); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/birpc"
|
||||
v2 "github.com/cgrates/cgrates/apier/v2"
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
@@ -581,11 +582,11 @@ func testFltrRplStatQueueProfile(t *testing.T) {
|
||||
},
|
||||
}
|
||||
// empty
|
||||
if err := fltrRplEngine1RPC.Call(utils.APIerSv1GetStatQueueProfileIDs, &utils.PaginatorWithTenant{}, &rplyIDs); err == nil ||
|
||||
if err := fltrRplEngine1RPC.Call(utils.AdminSv1GetStatQueueProfileIDs, &utils.PaginatorWithTenant{}, &rplyIDs); err == nil ||
|
||||
err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
if err := fltrRplEngine2RPC.Call(utils.APIerSv1GetStatQueueProfileIDs, &utils.PaginatorWithTenant{}, &rplyIDs); err == nil ||
|
||||
if err := fltrRplEngine2RPC.Call(utils.AdminSv1GetStatQueueProfileIDs, &utils.PaginatorWithTenant{}, &rplyIDs); err == nil ||
|
||||
err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
@@ -599,12 +600,12 @@ func testFltrRplStatQueueProfile(t *testing.T) {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
|
||||
if err := fltrRplInternalRPC.Call(utils.APIerSv1SetStatQueueProfile, stPrf, &result); err != nil {
|
||||
if err := fltrRplInternalRPC.Call(utils.AdminSv1SetStatQueueProfile, stPrf, &result); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if result != utils.OK {
|
||||
t.Error("Unexpected reply returned", result)
|
||||
}
|
||||
if err := fltrRplInternalRPC.Call(utils.APIerSv1GetStatQueueProfile,
|
||||
if err := fltrRplInternalRPC.Call(utils.AdminSv1GetStatQueueProfile,
|
||||
&utils.TenantID{Tenant: "cgrates.org", ID: stID}, &replyPrfl); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -613,11 +614,11 @@ func testFltrRplStatQueueProfile(t *testing.T) {
|
||||
}
|
||||
replyPrfl = nil
|
||||
|
||||
if err := fltrRplEngine1RPC.Call(utils.APIerSv1GetStatQueueProfileIDs, &utils.PaginatorWithTenant{}, &rplyIDs); err == nil ||
|
||||
if err := fltrRplEngine1RPC.Call(utils.AdminSv1GetStatQueueProfileIDs, &utils.PaginatorWithTenant{}, &rplyIDs); err == nil ||
|
||||
err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
if err := fltrRplEngine2RPC.Call(utils.APIerSv1GetStatQueueProfileIDs, &utils.PaginatorWithTenant{}, &rplyIDs); err == nil ||
|
||||
if err := fltrRplEngine2RPC.Call(utils.AdminSv1GetStatQueueProfileIDs, &utils.PaginatorWithTenant{}, &rplyIDs); err == nil ||
|
||||
err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
@@ -631,7 +632,7 @@ func testFltrRplStatQueueProfile(t *testing.T) {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
|
||||
if err := fltrRplEngine1RPC.Call(utils.APIerSv1GetStatQueueProfile,
|
||||
if err := fltrRplEngine1RPC.Call(utils.AdminSv1GetStatQueueProfile,
|
||||
&utils.TenantID{Tenant: "cgrates.org", ID: stID}, &replyPrfl); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -652,12 +653,12 @@ func testFltrRplStatQueueProfile(t *testing.T) {
|
||||
|
||||
replyPrfl = nil
|
||||
stPrf.Weight = 15
|
||||
if err := fltrRplInternalRPC.Call(utils.APIerSv1SetStatQueueProfile, stPrf, &result); err != nil {
|
||||
if err := fltrRplInternalRPC.Call(utils.AdminSv1SetStatQueueProfile, stPrf, &result); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if result != utils.OK {
|
||||
t.Error("Unexpected reply returned", result)
|
||||
}
|
||||
if err := fltrRplInternalRPC.Call(utils.APIerSv1GetStatQueueProfile,
|
||||
if err := fltrRplInternalRPC.Call(utils.AdminSv1GetStatQueueProfile,
|
||||
&utils.TenantID{Tenant: "cgrates.org", ID: stID}, &replyPrfl); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -675,7 +676,7 @@ func testFltrRplStatQueueProfile(t *testing.T) {
|
||||
t.Errorf("Expecting : %s, received: %s", utils.ToJSON(stPrf.StatQueueProfile), utils.ToJSON(replyPrfl))
|
||||
}
|
||||
|
||||
if err := fltrRplEngine2RPC.Call(utils.APIerSv1GetStatQueueProfileIDs, &utils.PaginatorWithTenant{}, &rplyIDs); err == nil ||
|
||||
if err := fltrRplEngine2RPC.Call(utils.AdminSv1GetStatQueueProfileIDs, &utils.PaginatorWithTenant{}, &rplyIDs); err == nil ||
|
||||
err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
@@ -710,17 +711,17 @@ func testFltrRplStatQueueProfile(t *testing.T) {
|
||||
t.Errorf("Expecting : %s, received: %s", utils.ToJSON(sq), utils.ToJSON(replySq))
|
||||
}
|
||||
|
||||
if err := fltrRplInternalRPC.Call(utils.APIerSv1RemoveStatQueueProfile,
|
||||
if err := fltrRplInternalRPC.Call(utils.AdminSv1RemoveStatQueueProfile,
|
||||
utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: stID}}, &result); err != nil {
|
||||
t.Error(err)
|
||||
} else if result != utils.OK {
|
||||
t.Error("Unexpected reply returned", result)
|
||||
}
|
||||
if err := fltrRplEngine1RPC.Call(utils.APIerSv1GetStatQueueProfileIDs, &utils.PaginatorWithTenant{}, &rplyIDs); err == nil ||
|
||||
if err := fltrRplEngine1RPC.Call(utils.AdminSv1GetStatQueueProfileIDs, &utils.PaginatorWithTenant{}, &rplyIDs); err == nil ||
|
||||
err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
if err := fltrRplEngine2RPC.Call(utils.APIerSv1GetStatQueueProfileIDs, &utils.PaginatorWithTenant{}, &rplyIDs); err == nil ||
|
||||
if err := fltrRplEngine2RPC.Call(utils.AdminSv1GetStatQueueProfileIDs, &utils.PaginatorWithTenant{}, &rplyIDs); err == nil ||
|
||||
err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
|
||||
@@ -622,14 +622,14 @@ func testV1FltrPopulateResourcesAvailableUnits(t *testing.T) {
|
||||
Weight: 50,
|
||||
},
|
||||
}
|
||||
if err := fltrRpc.Call(utils.APIerSv1SetStatQueueProfile, statsPrf, &result); err != nil {
|
||||
if err := fltrRpc.Call(utils.AdminSv1SetStatQueueProfile, statsPrf, &result); err != nil {
|
||||
t.Error(err)
|
||||
} else if result != utils.OK {
|
||||
t.Error("Unexpected reply returned", result)
|
||||
}
|
||||
|
||||
var replyStats *engine.StatQueueProfile
|
||||
if err := fltrRpc.Call(utils.APIerSv1GetStatQueueProfile, &utils.TenantID{Tenant: "cgrates.org",
|
||||
if err := fltrRpc.Call(utils.AdminSv1GetStatQueueProfile, &utils.TenantID{Tenant: "cgrates.org",
|
||||
ID: "STATS_RES_TEST12"}, &replyStats); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(statsPrf.StatQueueProfile, replyStats) {
|
||||
|
||||
Reference in New Issue
Block a user