mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-14 12:49:54 +05:00
Updated loaders integration tests
This commit is contained in:
committed by
Dan Christian Bogos
parent
f1bb562b34
commit
c854687ea3
@@ -60,8 +60,8 @@ var (
|
||||
testLoadersGetActionProfile,
|
||||
testLoadersGetAttributeProfile,
|
||||
testLoadersGetChargerProfile,
|
||||
// testLoadersGetDispatcherProfile,
|
||||
// testLoadersGetDispatcherHost,
|
||||
testLoadersGetDispatcherProfile,
|
||||
testLoadersGetDispatcherHost,
|
||||
testLoadersGetFilter,
|
||||
testLoadersGetRateProfile,
|
||||
testLoadersGetResourceProfile,
|
||||
@@ -69,21 +69,20 @@ var (
|
||||
testLoadersGetStatQueueProfile,
|
||||
testLoadersGetThresholdProfile,
|
||||
|
||||
/*
|
||||
testLoadersRemove,
|
||||
testLoadersGetAccountAfterRemove,
|
||||
testLoadersGetActionProfileAfterRemove,
|
||||
testLoadersGetAttributeProfileAfterRemove,
|
||||
testLoadersGetChargerProfileAfterRemove,
|
||||
// testLoadersGetDispatcherProfileAfterRemove,
|
||||
// testLoadersGetDispatcherHostAfterRemove,
|
||||
testLoadersGetFilterAfterRemove,
|
||||
testLoadersGetRateProfileAfterRemove,
|
||||
testLoadersGetResourceProfileAfterRemove,
|
||||
testLoadersGetRouteProfileAfterRemove,
|
||||
testLoadersGetStatQueueProfileAfterRemove,
|
||||
testLoadersGetThresholdProfileAfterRemove,
|
||||
*/
|
||||
testLoadersRemove,
|
||||
testLoadersGetAccountAfterRemove,
|
||||
testLoadersGetActionProfileAfterRemove,
|
||||
testLoadersGetAttributeProfileAfterRemove,
|
||||
testLoadersGetChargerProfileAfterRemove,
|
||||
testLoadersGetDispatcherProfileAfterRemove,
|
||||
testLoadersGetDispatcherHostAfterRemove,
|
||||
testLoadersGetFilterAfterRemove,
|
||||
testLoadersGetRateProfileAfterRemove,
|
||||
testLoadersGetResourceProfileAfterRemove,
|
||||
testLoadersGetRouteProfileAfterRemove,
|
||||
testLoadersGetStatQueueProfileAfterRemove,
|
||||
testLoadersGetThresholdProfileAfterRemove,
|
||||
|
||||
testLoadersRemoveFolders,
|
||||
|
||||
testLoadersPing,
|
||||
@@ -472,77 +471,87 @@ func testLoadersGetChargerProfile(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// func testLoadersGetDispatcherProfile(t *testing.T) {
|
||||
// expIDs := []string{"DSP1"}
|
||||
// var dspPrfIDs []string
|
||||
// if err := ldrRPC.Call(context.Background(), utils.AdminSv1GetDispatcherProfileIDs,
|
||||
// &utils.PaginatorWithTenant{
|
||||
// Tenant: "cgrates.org",
|
||||
// Paginator: utils.Paginator{},
|
||||
// }, &dspPrfIDs); err != nil {
|
||||
// t.Error(err)
|
||||
// } else if !reflect.DeepEqual(dspPrfIDs, expIDs) {
|
||||
// t.Errorf("expected: <%+v>, \nreceived: <%+v>", expIDs, dspPrfIDs)
|
||||
// }
|
||||
func testLoadersGetDispatcherProfile(t *testing.T) {
|
||||
expIDs := []string{"DSP1"}
|
||||
var dspPrfIDs []string
|
||||
if err := ldrRPC.Call(context.Background(), utils.AdminSv1GetDispatcherProfileIDs,
|
||||
&utils.PaginatorWithTenant{
|
||||
Tenant: "cgrates.org",
|
||||
Paginator: utils.Paginator{},
|
||||
}, &dspPrfIDs); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(dspPrfIDs, expIDs) {
|
||||
t.Errorf("expected: <%+v>, \nreceived: <%+v>", expIDs, dspPrfIDs)
|
||||
}
|
||||
|
||||
// expDspPrf := engine.DispatcherProfile{
|
||||
// Tenant: "cgrates.org",
|
||||
// ID: "DSP1",
|
||||
// FilterIDs: []string{"FLTR_ACCOUNT_1001"},
|
||||
// Strategy: utils.MetaWeight,
|
||||
// Hosts: engine.DispatcherHostProfiles{
|
||||
// {
|
||||
// ID: "ALL",
|
||||
// FilterIDs: []string{},
|
||||
// Weight: 20,
|
||||
// Params: map[string]interface{}{},
|
||||
// },
|
||||
// },
|
||||
// Weight: 10,
|
||||
// }
|
||||
expDspPrf := engine.DispatcherProfile{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "DSP1",
|
||||
FilterIDs: []string{"FLTR_ACCOUNT_1001"},
|
||||
Strategy: utils.MetaWeight,
|
||||
StrategyParams: make(map[string]interface{}),
|
||||
Hosts: engine.DispatcherHostProfiles{
|
||||
{
|
||||
ID: "ALL",
|
||||
FilterIDs: []string{},
|
||||
Weight: 20,
|
||||
Params: map[string]interface{}{},
|
||||
},
|
||||
},
|
||||
Weight: 10,
|
||||
}
|
||||
|
||||
// var rplyDspPrf engine.ChargerProfile
|
||||
// if err := ldrRPC.Call(context.Background(), utils.AdminSv1GetDispatcherProfile,
|
||||
// utils.TenantID{
|
||||
// Tenant: "cgrates.org",
|
||||
// ID: expIDs[0],
|
||||
// }, &rplyDspPrf); err != nil {
|
||||
// t.Error(err)
|
||||
// } else if !reflect.DeepEqual(rplyDspPrf, expDspPrf) {
|
||||
// t.Errorf("expected: <%+v>, \nreceived: <%+v>",
|
||||
// utils.ToJSON(expDspPrf), utils.ToJSON(rplyDspPrf))
|
||||
// }
|
||||
// }
|
||||
var rplyDspPrf engine.DispatcherProfile
|
||||
if err := ldrRPC.Call(context.Background(), utils.AdminSv1GetDispatcherProfile,
|
||||
utils.TenantID{
|
||||
Tenant: "cgrates.org",
|
||||
ID: expIDs[0],
|
||||
}, &rplyDspPrf); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(rplyDspPrf, expDspPrf) {
|
||||
t.Errorf("expected: <%+v>, \nreceived: <%+v>",
|
||||
utils.ToJSON(expDspPrf), utils.ToJSON(rplyDspPrf))
|
||||
}
|
||||
}
|
||||
|
||||
// func testLoadersGetDispatcherHost(t *testing.T) {
|
||||
// expIDs := []string{"DSPHOST1"}
|
||||
// var dspHostIDs []string
|
||||
// if err := ldrRPC.Call(context.Background(), utils.AdminSv1GetDispatcherHostIDs,
|
||||
// &utils.PaginatorWithTenant{
|
||||
// Tenant: "cgrates.org",
|
||||
// Paginator: utils.Paginator{},
|
||||
// }, &dspHostIDs); err != nil {
|
||||
// t.Error(err)
|
||||
// } else if !reflect.DeepEqual(dspHostIDs, expIDs) {
|
||||
// t.Errorf("expected: <%+v>, \nreceived: <%+v>", expIDs, dspHostIDs)
|
||||
// }
|
||||
func testLoadersGetDispatcherHost(t *testing.T) {
|
||||
expIDs := []string{"DSPHOST1"}
|
||||
var dspHostIDs []string
|
||||
if err := ldrRPC.Call(context.Background(), utils.AdminSv1GetDispatcherHostIDs,
|
||||
&utils.PaginatorWithTenant{
|
||||
Tenant: "cgrates.org",
|
||||
Paginator: utils.Paginator{},
|
||||
}, &dspHostIDs); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(dspHostIDs, expIDs) {
|
||||
t.Errorf("expected: <%+v>, \nreceived: <%+v>", expIDs, dspHostIDs)
|
||||
}
|
||||
|
||||
// expDspHost := engine.DispatcherHost{
|
||||
// Tenant: "cgrates.org",
|
||||
// }
|
||||
expDspHost := engine.DispatcherHost{
|
||||
Tenant: "cgrates.org",
|
||||
RemoteHost: &config.RemoteHost{
|
||||
ID: expIDs[0],
|
||||
Address: utils.MetaInternal,
|
||||
Transport: utils.MetaJSON,
|
||||
ConnectAttempts: 1,
|
||||
Reconnects: 3,
|
||||
ConnectTimeout: time.Minute,
|
||||
ReplyTimeout: 2 * time.Minute,
|
||||
},
|
||||
}
|
||||
|
||||
// var rplyDspHost engine.DispatcherHost
|
||||
// if err := ldrRPC.Call(context.Background(), utils.AdminSv1GetDispatcherHost,
|
||||
// utils.TenantID{
|
||||
// Tenant: "cgrates.org",
|
||||
// ID: expIDs[0],
|
||||
// }, &rplyDspHost); err != nil {
|
||||
// t.Error(err)
|
||||
// } else if !reflect.DeepEqual(rplyDspHost, expDspHost) {
|
||||
// t.Errorf("expected: <%+v>, \nreceived: <%+v>",
|
||||
// utils.ToJSON(expDspHost), utils.ToJSON(rplyDspHost))
|
||||
// }
|
||||
// }
|
||||
var rplyDspHost engine.DispatcherHost
|
||||
if err := ldrRPC.Call(context.Background(), utils.AdminSv1GetDispatcherHost,
|
||||
utils.TenantID{
|
||||
Tenant: "cgrates.org",
|
||||
ID: expIDs[0],
|
||||
}, &rplyDspHost); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(rplyDspHost, expDspHost) {
|
||||
t.Errorf("expected: <%+v>, \nreceived: <%+v>",
|
||||
utils.ToJSON(expDspHost), utils.ToJSON(rplyDspHost))
|
||||
}
|
||||
}
|
||||
|
||||
func testLoadersGetFilter(t *testing.T) {
|
||||
expIDs := []string{"FLTR_ACCOUNT_1001"}
|
||||
@@ -810,6 +819,7 @@ func testLoadersRemove(t *testing.T) {
|
||||
var reply string
|
||||
if err := ldrRPC.Call(context.Background(), utils.LoaderSv1Run, //Remove,
|
||||
&loaders.ArgsProcessFolder{
|
||||
LoaderID: "remove",
|
||||
APIOpts: map[string]interface{}{
|
||||
utils.MetaCache: utils.MetaReload,
|
||||
utils.MetaStopOnError: true,
|
||||
@@ -901,45 +911,45 @@ func testLoadersGetChargerProfileAfterRemove(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// func testLoadersGetDispatcherProfileAfterRemove(t *testing.T) {
|
||||
// var dspPrfIDs []string
|
||||
// if err := ldrRPC.Call(context.Background(), utils.AdminSv1GetDispatcherProfileIDs,
|
||||
// &utils.PaginatorWithTenant{
|
||||
// Tenant: "cgrates.org",
|
||||
// Paginator: utils.Paginator{},
|
||||
// }, &dspPrfIDs); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
// t.Errorf("expected: <%+v>, \nreceived: <%+v>", utils.ErrNotFound, err)
|
||||
// }
|
||||
func testLoadersGetDispatcherProfileAfterRemove(t *testing.T) {
|
||||
var dspPrfIDs []string
|
||||
if err := ldrRPC.Call(context.Background(), utils.AdminSv1GetDispatcherProfileIDs,
|
||||
&utils.PaginatorWithTenant{
|
||||
Tenant: "cgrates.org",
|
||||
Paginator: utils.Paginator{},
|
||||
}, &dspPrfIDs); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Errorf("expected: <%+v>, \nreceived: <%+v>", utils.ErrNotFound, err)
|
||||
}
|
||||
|
||||
// var rplyDspPrf engine.ChargerProfile
|
||||
// if err := ldrRPC.Call(context.Background(), utils.AdminSv1GetDispatcherProfile,
|
||||
// utils.TenantID{
|
||||
// Tenant: "cgrates.org",
|
||||
// ID: "DSP1",
|
||||
// }, &rplyDspPrf); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
// t.Errorf("expected: <%+v>, \nreceived: <%+v>", utils.ErrNotFound, err)
|
||||
// }
|
||||
// }
|
||||
var rplyDspPrf engine.ChargerProfile
|
||||
if err := ldrRPC.Call(context.Background(), utils.AdminSv1GetDispatcherProfile,
|
||||
utils.TenantID{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "DSP1",
|
||||
}, &rplyDspPrf); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Errorf("expected: <%+v>, \nreceived: <%+v>", utils.ErrNotFound, err)
|
||||
}
|
||||
}
|
||||
|
||||
// func testLoadersGetDispatcherHostAfterRemove(t *testing.T) {
|
||||
// var dspHostIDs []string
|
||||
// if err := ldrRPC.Call(context.Background(), utils.AdminSv1GetDispatcherHostIDs,
|
||||
// &utils.PaginatorWithTenant{
|
||||
// Tenant: "cgrates.org",
|
||||
// Paginator: utils.Paginator{},
|
||||
// }, &dspHostIDs); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
// t.Errorf("expected: <%+v>, \nreceived: <%+v>", utils.ErrNotFound, err)
|
||||
// }
|
||||
func testLoadersGetDispatcherHostAfterRemove(t *testing.T) {
|
||||
var dspHostIDs []string
|
||||
if err := ldrRPC.Call(context.Background(), utils.AdminSv1GetDispatcherHostIDs,
|
||||
&utils.PaginatorWithTenant{
|
||||
Tenant: "cgrates.org",
|
||||
Paginator: utils.Paginator{},
|
||||
}, &dspHostIDs); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Errorf("expected: <%+v>, \nreceived: <%+v>", utils.ErrNotFound, err)
|
||||
}
|
||||
|
||||
// var rplyDspHost engine.DispatcherHost
|
||||
// if err := ldrRPC.Call(context.Background(), utils.AdminSv1GetDispatcherHost,
|
||||
// utils.TenantID{
|
||||
// Tenant: "cgrates.org",
|
||||
// ID: "DSPHOST1",
|
||||
// }, &rplyDspHost); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
// t.Errorf("expected: <%+v>, \nreceived: <%+v>", utils.ErrNotFound, err)
|
||||
// }
|
||||
// }
|
||||
var rplyDspHost engine.DispatcherHost
|
||||
if err := ldrRPC.Call(context.Background(), utils.AdminSv1GetDispatcherHost,
|
||||
utils.TenantID{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "DSPHOST1",
|
||||
}, &rplyDspHost); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Errorf("expected: <%+v>, \nreceived: <%+v>", utils.ErrNotFound, err)
|
||||
}
|
||||
}
|
||||
|
||||
func testLoadersGetFilterAfterRemove(t *testing.T) {
|
||||
var fltrIDs []string
|
||||
@@ -1123,7 +1133,4 @@ func TestLoadersLoad(t *testing.T) {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
// if err := lSv1.Remove(context.Background(), args, &reply); err != nil {
|
||||
// t.Error(err)
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -1,30 +1,110 @@
|
||||
{
|
||||
// CGRateS Configuration file
|
||||
// will be used in apis/loaders_it_test.go
|
||||
|
||||
"general": {
|
||||
"log_level": 7,
|
||||
},
|
||||
// CGRateS Configuration file
|
||||
// will be used in apis/loaders_it_test.go
|
||||
|
||||
"data_db": {
|
||||
"db_type": "*internal",
|
||||
},
|
||||
|
||||
"stor_db": {
|
||||
"db_type": "*internal",
|
||||
},
|
||||
|
||||
"loaders": [
|
||||
{
|
||||
"id": "*default",
|
||||
"enabled": true,
|
||||
"tenant": "cgrates.org",
|
||||
"tp_in_dir": "/tmp/TestLoadersIT/in",
|
||||
"tp_out_dir": "",
|
||||
},
|
||||
"general": {
|
||||
"log_level": 7,
|
||||
},
|
||||
|
||||
"data_db": {
|
||||
"db_type": "*internal",
|
||||
},
|
||||
|
||||
"stor_db": {
|
||||
"db_type": "*internal",
|
||||
},
|
||||
|
||||
"loaders": [
|
||||
{
|
||||
"id": "*default",
|
||||
"enabled": true,
|
||||
"tenant": "cgrates.org",
|
||||
"tp_in_dir": "/tmp/TestLoadersIT/in",
|
||||
"tp_out_dir": "",
|
||||
},
|
||||
{
|
||||
"id": "remove",
|
||||
"action": "*remove",
|
||||
"enabled": true,
|
||||
"tenant": "cgrates.org",
|
||||
"tp_in_dir": "/tmp/TestLoadersIT/in",
|
||||
"tp_out_dir": "",
|
||||
"data":[
|
||||
{
|
||||
"type": "*attributes",
|
||||
"file_name": "Attributes.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*resources",
|
||||
"file_name": "Resources.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*stats",
|
||||
"file_name": "Stats.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*thresholds",
|
||||
"file_name": "Thresholds.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*routes",
|
||||
"file_name": "Routes.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*chargers",
|
||||
"file_name": "Chargers.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*dispatchers",
|
||||
"file_name": "DispatcherProfiles.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*dispatcher_hosts",
|
||||
"file_name": "DispatcherHosts.csv",
|
||||
"fields": [
|
||||
{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"},
|
||||
{"tag": "Address", "path": "Address", "type": "*variable", "value": "~*req.2"},
|
||||
],
|
||||
},
|
||||
{
|
||||
"type": "*rate_profiles",
|
||||
"file_name": "Rates.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*action_profiles",
|
||||
"file_name": "Actions.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*accounts",
|
||||
"file_name": "Accounts.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*filters",
|
||||
"file_name": "Filters.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
"admins": {
|
||||
"enabled": true,
|
||||
}
|
||||
}
|
||||
"templates": {
|
||||
"baseTmpl": [
|
||||
{"tag": "Tenant", "path": "Tenant", "type": "*variable", "value": "~*req.0", "mandatory": true},
|
||||
{"tag": "ID", "path": "ID", "type": "*variable", "value": "~*req.1", "mandatory": true}
|
||||
]
|
||||
},
|
||||
|
||||
"admins": {
|
||||
"enabled": true,
|
||||
}
|
||||
}
|
||||
@@ -1,34 +1,114 @@
|
||||
{
|
||||
// CGRateS Configuration file
|
||||
// will be used in apis/loaders_it_test.go
|
||||
|
||||
"general": {
|
||||
"log_level": 7,
|
||||
},
|
||||
// CGRateS Configuration file
|
||||
// will be used in apis/loaders_it_test.go
|
||||
|
||||
"data_db": {
|
||||
"db_type": "mongo",
|
||||
"db_name": "10",
|
||||
"db_port": 27017,
|
||||
},
|
||||
|
||||
"stor_db": {
|
||||
"db_type": "mongo",
|
||||
"db_name": "cgrates",
|
||||
"db_port": 27017,
|
||||
},
|
||||
|
||||
"loaders": [
|
||||
{
|
||||
"id": "*default",
|
||||
"enabled": true,
|
||||
"tenant": "cgrates.org",
|
||||
"tp_in_dir": "/tmp/TestLoadersIT/in",
|
||||
"tp_out_dir": "",
|
||||
},
|
||||
],
|
||||
"general": {
|
||||
"log_level": 7,
|
||||
},
|
||||
|
||||
"admins": {
|
||||
"data_db": {
|
||||
"db_type": "mongo",
|
||||
"db_name": "10",
|
||||
"db_port": 27017,
|
||||
},
|
||||
|
||||
"stor_db": {
|
||||
"db_type": "mongo",
|
||||
"db_name": "cgrates",
|
||||
"db_port": 27017,
|
||||
},
|
||||
|
||||
"loaders": [
|
||||
{
|
||||
"id": "*default",
|
||||
"enabled": true,
|
||||
}
|
||||
"tenant": "cgrates.org",
|
||||
"tp_in_dir": "/tmp/TestLoadersIT/in",
|
||||
"tp_out_dir": "",
|
||||
},
|
||||
{
|
||||
"id": "remove",
|
||||
"action": "*remove",
|
||||
"enabled": true,
|
||||
"tenant": "cgrates.org",
|
||||
"tp_in_dir": "/tmp/TestLoadersIT/in",
|
||||
"tp_out_dir": "",
|
||||
"data":[
|
||||
{
|
||||
"type": "*attributes",
|
||||
"file_name": "Attributes.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*resources",
|
||||
"file_name": "Resources.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*stats",
|
||||
"file_name": "Stats.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*thresholds",
|
||||
"file_name": "Thresholds.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*routes",
|
||||
"file_name": "Routes.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*chargers",
|
||||
"file_name": "Chargers.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*dispatchers",
|
||||
"file_name": "DispatcherProfiles.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*dispatcher_hosts",
|
||||
"file_name": "DispatcherHosts.csv",
|
||||
"fields": [
|
||||
{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"},
|
||||
{"tag": "Address", "path": "Address", "type": "*variable", "value": "~*req.2"},
|
||||
],
|
||||
},
|
||||
{
|
||||
"type": "*rate_profiles",
|
||||
"file_name": "Rates.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*action_profiles",
|
||||
"file_name": "Actions.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*accounts",
|
||||
"file_name": "Accounts.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*filters",
|
||||
"file_name": "Filters.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
"templates": {
|
||||
"baseTmpl": [
|
||||
{"tag": "Tenant", "path": "Tenant", "type": "*variable", "value": "~*req.0", "mandatory": true},
|
||||
{"tag": "ID", "path": "ID", "type": "*variable", "value": "~*req.1", "mandatory": true}
|
||||
]
|
||||
},
|
||||
|
||||
"admins": {
|
||||
"enabled": true,
|
||||
}
|
||||
}
|
||||
@@ -1,31 +1,111 @@
|
||||
{
|
||||
// CGRateS Configuration file
|
||||
// will be used in apis/loaders_it_test.go
|
||||
"general": {
|
||||
"log_level": 7,
|
||||
},
|
||||
// CGRateS Configuration file
|
||||
// will be used in apis/loaders_it_test.go
|
||||
"general": {
|
||||
"log_level": 7,
|
||||
},
|
||||
|
||||
"data_db": { // database used to store runtime data (eg: accounts, cdr stats)
|
||||
"db_type": "redis", // data_db type: <redis|mongo>
|
||||
"db_port": 6379, // data_db port to reach the database
|
||||
"db_name": "10", // data_db database name to connect to
|
||||
},
|
||||
|
||||
"stor_db": {
|
||||
"db_password": "CGRateS.org",
|
||||
},
|
||||
"data_db": { // database used to store runtime data (eg: accounts, cdr stats)
|
||||
"db_type": "redis", // data_db type: <redis|mongo>
|
||||
"db_port": 6379, // data_db port to reach the database
|
||||
"db_name": "10", // data_db database name to connect to
|
||||
},
|
||||
|
||||
"loaders": [
|
||||
{
|
||||
"id": "*default",
|
||||
"enabled": true,
|
||||
"tenant": "cgrates.org",
|
||||
"tp_in_dir": "/tmp/TestLoadersIT/in",
|
||||
"tp_out_dir": "",
|
||||
},
|
||||
],
|
||||
"stor_db": {
|
||||
"db_password": "CGRateS.org",
|
||||
},
|
||||
|
||||
"admins": {
|
||||
"loaders": [
|
||||
{
|
||||
"id": "*default",
|
||||
"enabled": true,
|
||||
}
|
||||
}
|
||||
"tenant": "cgrates.org",
|
||||
"tp_in_dir": "/tmp/TestLoadersIT/in",
|
||||
"tp_out_dir": "",
|
||||
},
|
||||
{
|
||||
"id": "remove",
|
||||
"action": "*remove",
|
||||
"enabled": true,
|
||||
"tenant": "cgrates.org",
|
||||
"tp_in_dir": "/tmp/TestLoadersIT/in",
|
||||
"tp_out_dir": "",
|
||||
"data":[
|
||||
{
|
||||
"type": "*attributes",
|
||||
"file_name": "Attributes.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*resources",
|
||||
"file_name": "Resources.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*stats",
|
||||
"file_name": "Stats.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*thresholds",
|
||||
"file_name": "Thresholds.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*routes",
|
||||
"file_name": "Routes.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*chargers",
|
||||
"file_name": "Chargers.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*dispatchers",
|
||||
"file_name": "DispatcherProfiles.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*dispatcher_hosts",
|
||||
"file_name": "DispatcherHosts.csv",
|
||||
"fields": [
|
||||
{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"},
|
||||
{"tag": "Address", "path": "Address", "type": "*variable", "value": "~*req.2"},
|
||||
],
|
||||
},
|
||||
{
|
||||
"type": "*rate_profiles",
|
||||
"file_name": "Rates.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*action_profiles",
|
||||
"file_name": "Actions.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*accounts",
|
||||
"file_name": "Accounts.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
{
|
||||
"type": "*filters",
|
||||
"file_name": "Filters.csv",
|
||||
"fields": [{"tag": "BaseTmpl","type": "*template", "value": "baseTmpl"}],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
"templates": {
|
||||
"baseTmpl": [
|
||||
{"tag": "Tenant", "path": "Tenant", "type": "*variable", "value": "~*req.0", "mandatory": true},
|
||||
{"tag": "ID", "path": "ID", "type": "*variable", "value": "~*req.1", "mandatory": true}
|
||||
]
|
||||
},
|
||||
|
||||
"admins": {
|
||||
"enabled": true,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,10 +137,12 @@ func testV1AccLoadTarrifPlans(t *testing.T) {
|
||||
caching = utils.MetaNone
|
||||
}
|
||||
var reply string
|
||||
if err := accRpc.Call(context.Background(), utils.LoaderSv1Load,
|
||||
if err := accRpc.Call(context.Background(), utils.LoaderSv1Run,
|
||||
&loaders.ArgsProcessFolder{
|
||||
StopOnError: true,
|
||||
Caching: utils.StringPointer(caching),
|
||||
APIOpts: map[string]interface{}{
|
||||
utils.MetaStopOnError: true,
|
||||
utils.MetaCache: caching,
|
||||
},
|
||||
}, &reply); err != nil {
|
||||
t.Error(err)
|
||||
} else if reply != utils.OK {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -93,7 +93,6 @@ func testRateStartEngine(t *testing.T) {
|
||||
}
|
||||
|
||||
func testRateConfigSReloadRates(t *testing.T) {
|
||||
|
||||
var replyPingBf string
|
||||
if err := testRateRPC.Call(context.Background(), utils.RateSv1CostForEvent, &utils.CGREvent{}, &replyPingBf); err == nil || err.Error() != "rpc: can't find service RateSv1.CostForEvent" {
|
||||
t.Error(err)
|
||||
@@ -107,7 +106,7 @@ func testRateConfigSReloadRates(t *testing.T) {
|
||||
} else if reply != utils.OK {
|
||||
t.Errorf("Expected OK received: %+v", reply)
|
||||
}
|
||||
cfgStr := "{\"rates\":{\"enabled\":true,\"indexed_selects\":true,\"nested_fields\":false,\"prefix_indexed_fields\":[],\"rate_indexed_selects\":true,\"rate_nested_fields\":false,\"rate_prefix_indexed_fields\":[],\"rate_suffix_indexed_fields\":[],\"suffix_indexed_fields\":[],\"verbosity\":1000}}"
|
||||
cfgStr := "{\"rates\":{\"enabled\":true,\"indexed_selects\":true,\"nested_fields\":false,\"opts\":{\"*intervalStart\":[],\"*profileIDs\":[],\"*profileIgnoreFilters\":[],\"*startTime\":[],\"*usage\":[]},\"prefix_indexed_fields\":[],\"rate_indexed_selects\":true,\"rate_nested_fields\":false,\"rate_prefix_indexed_fields\":[],\"rate_suffix_indexed_fields\":[],\"suffix_indexed_fields\":[],\"verbosity\":1000}}"
|
||||
var rpl string
|
||||
if err := testRateRPC.Call(context.Background(), utils.ConfigSv1GetConfigAsJSON, &config.SectionWithAPIOpts{
|
||||
Tenant: "cgrates.org",
|
||||
|
||||
@@ -1123,16 +1123,16 @@ const (
|
||||
AdminSv1GetChargersIndexesHealth = "AdminSv1.GetChargersIndexesHealth"
|
||||
AdminSv1GetAttributesIndexesHealth = "AdminSv1.GetAttributesIndexesHealth"
|
||||
AdminSv1GetDispatchersIndexesHealth = "AdminSv1.GetDispatchersIndexesHealth"
|
||||
APIerSv1Ping = "APIerSv1.Ping"
|
||||
APIerSv1SetDispatcherProfile = "APIerSv1.SetDispatcherProfile"
|
||||
APIerSv1GetDispatcherProfile = "APIerSv1.GetDispatcherProfile"
|
||||
APIerSv1GetDispatcherProfileIDs = "APIerSv1.GetDispatcherProfileIDs"
|
||||
APIerSv1RemoveDispatcherProfile = "APIerSv1.RemoveDispatcherProfile"
|
||||
AdminSv1Ping = "AdminSv1.Ping"
|
||||
AdminSv1SetDispatcherProfile = "AdminSv1.SetDispatcherProfile"
|
||||
AdminSv1GetDispatcherProfile = "AdminSv1.GetDispatcherProfile"
|
||||
AdminSv1GetDispatcherProfileIDs = "AdminSv1.GetDispatcherProfileIDs"
|
||||
AdminSv1RemoveDispatcherProfile = "AdminSv1.RemoveDispatcherProfile"
|
||||
APIerSv1SetBalances = "APIerSv1.SetBalances"
|
||||
APIerSv1SetDispatcherHost = "APIerSv1.SetDispatcherHost"
|
||||
APIerSv1GetDispatcherHost = "APIerSv1.GetDispatcherHost"
|
||||
APIerSv1GetDispatcherHostIDs = "APIerSv1.GetDispatcherHostIDs"
|
||||
APIerSv1RemoveDispatcherHost = "APIerSv1.RemoveDispatcherHost"
|
||||
AdminSv1SetDispatcherHost = "AdminSv1.SetDispatcherHost"
|
||||
AdminSv1GetDispatcherHost = "AdminSv1.GetDispatcherHost"
|
||||
AdminSv1GetDispatcherHostIDs = "AdminSv1.GetDispatcherHostIDs"
|
||||
AdminSv1RemoveDispatcherHost = "AdminSv1.RemoveDispatcherHost"
|
||||
APIerSv1GetEventCost = "APIerSv1.GetEventCost"
|
||||
APIerSv1LoadTariffPlanFromFolder = "APIerSv1.LoadTariffPlanFromFolder"
|
||||
APIerSv1ExportToFolder = "APIerSv1.ExportToFolder"
|
||||
|
||||
Reference in New Issue
Block a user