From e5878f40b60a817a435a8b3807f94cc9511723d4 Mon Sep 17 00:00:00 2001 From: ionutboangiu Date: Thu, 5 May 2022 18:23:13 +0300 Subject: [PATCH] Add config files for ees blocker test --- apis/routes_it_test.go | 35 +++++++------- .../samples/ees_blocker_internal/cgrates.json | 46 ++++++++++++++++++ .../samples/ees_blocker_mongo/cgrates.json | 48 +++++++++++++++++++ general_tests/ees_blocker_it_test.go | 6 +-- 4 files changed, 114 insertions(+), 21 deletions(-) create mode 100644 data/conf/samples/ees_blocker_internal/cgrates.json create mode 100644 data/conf/samples/ees_blocker_mongo/cgrates.json diff --git a/apis/routes_it_test.go b/apis/routes_it_test.go index 34aeea85d..f9e84908f 100644 --- a/apis/routes_it_test.go +++ b/apis/routes_it_test.go @@ -44,9 +44,10 @@ var ( sTestsRo = []func(t *testing.T){ testRouteSInitCfg, testRouteSInitDataDB, + testRoutesStartEngine, + testRoutesRPCConn, - testRouteSStartEngine, - testRouteSRPCConn, + // tests for AdminSv1 APIs testRoutesGetRouteProfileBeforeSet, testRoutesGetRouteProfileIDsBeforeSet, testRoutesGetRouteProfileCountBeforeSet, @@ -63,15 +64,15 @@ var ( testRoutesGetRouteProfilesAfterRemove, // RouteProfile blocker behaviour test - testRouteSRemoveRouteProfiles, - testRouteSSetRouteProfiles, - testRouteSGetRouteProfilesForEvent, + testRoutesBlockerRemoveRouteProfiles, + testRoutesBlockerSetRouteProfiles, + testRoutesBlockerGetRouteProfilesForEvent, // Route blocker behaviour test - testRouteSSetRouteProfile, - testRouteSGetRoutes, + testRoutesBlockerSetRouteProfile, + testRoutesBlockerGetRoutes, - testRouteSKillEngine, + testRoutesKillEngine, } ) @@ -109,13 +110,13 @@ func testRouteSInitDataDB(t *testing.T) { } // Start CGR Engine -func testRouteSStartEngine(t *testing.T) { +func testRoutesStartEngine(t *testing.T) { if _, err := engine.StopStartEngine(roCfgPath, *waitRater); err != nil { t.Fatal(err) } } -func testRouteSRPCConn(t *testing.T) { +func testRoutesRPCConn(t *testing.T) { var err error roRPC, err = newRPCClient(roCfg.ListenCfg()) // We connect over JSON so we can also troubleshoot if needed if err != nil { @@ -129,7 +130,7 @@ func testRoutesGetRouteProfileBeforeSet(t *testing.T) { &utils.TenantIDWithAPIOpts{ TenantID: &utils.TenantID{ Tenant: "cgrates.org", - ID: "TestA_Route1", + ID: "TestA_ROUTE1", }}, &replyRouteProfile); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Errorf("expected: <%+v>, \nreceived: <%+v>", utils.ErrNotFound, err) } @@ -710,7 +711,7 @@ func testRoutesGetRouteProfilesAfterRemove(t *testing.T) { } } -func testRouteSRemoveRouteProfiles(t *testing.T) { +func testRoutesBlockerRemoveRouteProfiles(t *testing.T) { args := &utils.ArgsItemIDs{ Tenant: "cgrates.org", } @@ -742,7 +743,7 @@ func testRouteSRemoveRouteProfiles(t *testing.T) { } } -func testRouteSSetRouteProfiles(t *testing.T) { +func testRoutesBlockerSetRouteProfiles(t *testing.T) { routeProfiles := []*engine.RouteProfileWithAPIOpts{ { RouteProfile: &engine.RouteProfile{ @@ -843,7 +844,7 @@ func testRouteSSetRouteProfiles(t *testing.T) { } } -func testRouteSGetRouteProfilesForEvent(t *testing.T) { +func testRoutesBlockerGetRouteProfilesForEvent(t *testing.T) { args := &utils.CGREvent{ Tenant: "cgrates.org", ID: "EventGetRouteProfiles", @@ -923,7 +924,7 @@ func testRouteSGetRouteProfilesForEvent(t *testing.T) { } } -func testRouteSSetRouteProfile(t *testing.T) { +func testRoutesBlockerSetRouteProfile(t *testing.T) { routeProfile := &engine.RouteProfileWithAPIOpts{ RouteProfile: &engine.RouteProfile{ ID: "ROUTE_BLOCKER_TEST", @@ -992,7 +993,7 @@ func testRouteSSetRouteProfile(t *testing.T) { } } -func testRouteSGetRoutes(t *testing.T) { +func testRoutesBlockerGetRoutes(t *testing.T) { args := &utils.CGREvent{ Tenant: "cgrates.org", ID: "EventGetRoutes", @@ -1041,7 +1042,7 @@ func testRouteSGetRoutes(t *testing.T) { } //Kill the engine when it is about to be finished -func testRouteSKillEngine(t *testing.T) { +func testRoutesKillEngine(t *testing.T) { if err := engine.KillEngine(100); err != nil { t.Error(err) } diff --git a/data/conf/samples/ees_blocker_internal/cgrates.json b/data/conf/samples/ees_blocker_internal/cgrates.json new file mode 100644 index 000000000..e3ab74ed5 --- /dev/null +++ b/data/conf/samples/ees_blocker_internal/cgrates.json @@ -0,0 +1,46 @@ +{ + + "general": { + "log_level": 7 + }, + + "listen": { + "rpc_json": ":2012", + "rpc_gob": ":2013", + "http": ":2080" + }, + + "data_db": { + "db_type": "*internal" + }, + + "ees": { + "enabled": true, + "cache": { + "*fileCSV": {"limit": -1, "ttl": "500ms", "static_ttl": false} + }, + "exporters": [ + { + "id": "CSVExporter1", + "type": "*fileCSV", + "export_path": "/tmp/CSVFile1", + "attempts": 1, + "blocker": true, + "field_separator": "," + }, + { + "id": "CSVExporter2", + "type": "*fileCSV", + "export_path": "/tmp/CSVFile2", + "attempts": 1, + "field_separator": "," + } + ] + }, + + + "admins": { + "enabled": true + } + +} \ No newline at end of file diff --git a/data/conf/samples/ees_blocker_mongo/cgrates.json b/data/conf/samples/ees_blocker_mongo/cgrates.json new file mode 100644 index 000000000..ccbea728f --- /dev/null +++ b/data/conf/samples/ees_blocker_mongo/cgrates.json @@ -0,0 +1,48 @@ +{ + + "general": { + "log_level": 7 + }, + + "listen": { + "rpc_json": ":2012", + "rpc_gob": ":2013", + "http": ":2080" + }, + + "data_db": { + "db_type": "mongo", + "db_name": "10", + "db_port": 27017 + }, + + "ees": { + "enabled": true, + "cache": { + "*fileCSV": {"limit": -1, "ttl": "500ms", "static_ttl": false} + }, + "exporters": [ + { + "id": "CSVExporter1", + "type": "*fileCSV", + "export_path": "/tmp/CSVFile1", + "attempts": 1, + "blocker": true, + "field_separator": "," + }, + { + "id": "CSVExporter2", + "type": "*fileCSV", + "export_path": "/tmp/CSVFile2", + "attempts": 1, + "field_separator": "," + } + ] + }, + + + "admins": { + "enabled": true + } + +} \ No newline at end of file diff --git a/general_tests/ees_blocker_it_test.go b/general_tests/ees_blocker_it_test.go index 4e4e95a98..806e2de79 100644 --- a/general_tests/ees_blocker_it_test.go +++ b/general_tests/ees_blocker_it_test.go @@ -56,13 +56,11 @@ var ( func TestEEsBlocker(t *testing.T) { switch *dbType { case utils.MetaInternal: - // eesBlockerConfDIR = "ees_blocker_internal" - t.SkipNow() + eesBlockerConfDIR = "ees_blocker_internal" case utils.MetaMySQL: eesBlockerConfDIR = "ees_blocker_mysql" case utils.MetaMongo: - // eesBlockerConfDIR = "ees_blocker_mongo" - t.SkipNow() + eesBlockerConfDIR = "ees_blocker_mongo" case utils.MetaPostgres: t.SkipNow() default: