From 5cf8306f428b1a1f092ffcef5daee71a4ca8ff5f Mon Sep 17 00:00:00 2001 From: Trial97 Date: Thu, 30 Jan 2020 11:16:11 +0200 Subject: [PATCH] Updated integration tests --- config/config_it_test.go | 44 ++-- data/conf/cgrates/cgrates.json | 6 +- .../dispatchers/all2_mongo/cgrates.json | 2 +- .../dispatchers/all2_mysql/cgrates.json | 176 ++++++++-------- .../dispatchers/all_mysql/cgrates.json | 189 +++++++++--------- general_tests/cdrs_post_failover_it_test.go | 2 +- 6 files changed, 208 insertions(+), 211 deletions(-) diff --git a/config/config_it_test.go b/config/config_it_test.go index e773c26bd..c842a5d73 100644 --- a/config/config_it_test.go +++ b/config/config_it_test.go @@ -429,17 +429,17 @@ func testCGRConfigReloadERs(t *testing.T) { flags, _ := utils.FlagsWithParamsFromSlice([]string{"*dryrun"}) flagsDefault, _ := utils.FlagsWithParamsFromSlice([]string{}) content := []*FCTemplate{ - &FCTemplate{Tag: "ToR", Path: utils.ToR, Type: utils.META_COMPOSED, Value: NewRSRParsersMustCompile("~*req.2", true, utils.INFIELD_SEP), Mandatory: true}, - &FCTemplate{Tag: utils.OriginID, Path: utils.OriginID, Type: utils.META_COMPOSED, Value: NewRSRParsersMustCompile("~*req.3", true, utils.INFIELD_SEP), Mandatory: true}, - &FCTemplate{Tag: utils.RequestType, Path: utils.RequestType, Type: utils.META_COMPOSED, Value: NewRSRParsersMustCompile("~*req.4", true, utils.INFIELD_SEP), Mandatory: true}, - &FCTemplate{Tag: utils.Tenant, Path: utils.Tenant, Type: utils.META_COMPOSED, Value: NewRSRParsersMustCompile("~*req.6", true, utils.INFIELD_SEP), Mandatory: true}, - &FCTemplate{Tag: utils.Category, Path: utils.Category, Type: utils.META_COMPOSED, Value: NewRSRParsersMustCompile("~*req.7", true, utils.INFIELD_SEP), Mandatory: true}, - &FCTemplate{Tag: utils.Account, Path: utils.Account, Type: utils.META_COMPOSED, Value: NewRSRParsersMustCompile("~*req.8", true, utils.INFIELD_SEP), Mandatory: true}, - &FCTemplate{Tag: utils.Subject, Path: utils.Subject, Type: utils.META_COMPOSED, Value: NewRSRParsersMustCompile("~*req.9", true, utils.INFIELD_SEP), Mandatory: true}, - &FCTemplate{Tag: utils.Destination, Path: utils.Destination, Type: utils.META_COMPOSED, Value: NewRSRParsersMustCompile("~*req.10", true, utils.INFIELD_SEP), Mandatory: true}, - &FCTemplate{Tag: utils.SetupTime, Path: utils.SetupTime, Type: utils.META_COMPOSED, Value: NewRSRParsersMustCompile("~*req.11", true, utils.INFIELD_SEP), Mandatory: true}, - &FCTemplate{Tag: utils.AnswerTime, Path: utils.AnswerTime, Type: utils.META_COMPOSED, Value: NewRSRParsersMustCompile("~*req.12", true, utils.INFIELD_SEP), Mandatory: true}, - &FCTemplate{Tag: utils.Usage, Path: utils.Usage, Type: utils.META_COMPOSED, Value: NewRSRParsersMustCompile("~*req.13", true, utils.INFIELD_SEP), Mandatory: true}, + &FCTemplate{Tag: "ToR", Path: utils.ToR, Type: utils.MetaVariable, Value: NewRSRParsersMustCompile("~*req.2", true, utils.INFIELD_SEP), Mandatory: true}, + &FCTemplate{Tag: utils.OriginID, Path: utils.OriginID, Type: utils.MetaVariable, Value: NewRSRParsersMustCompile("~*req.3", true, utils.INFIELD_SEP), Mandatory: true}, + &FCTemplate{Tag: utils.RequestType, Path: utils.RequestType, Type: utils.MetaVariable, Value: NewRSRParsersMustCompile("~*req.4", true, utils.INFIELD_SEP), Mandatory: true}, + &FCTemplate{Tag: utils.Tenant, Path: utils.Tenant, Type: utils.MetaVariable, Value: NewRSRParsersMustCompile("~*req.6", true, utils.INFIELD_SEP), Mandatory: true}, + &FCTemplate{Tag: utils.Category, Path: utils.Category, Type: utils.MetaVariable, Value: NewRSRParsersMustCompile("~*req.7", true, utils.INFIELD_SEP), Mandatory: true}, + &FCTemplate{Tag: utils.Account, Path: utils.Account, Type: utils.MetaVariable, Value: NewRSRParsersMustCompile("~*req.8", true, utils.INFIELD_SEP), Mandatory: true}, + &FCTemplate{Tag: utils.Subject, Path: utils.Subject, Type: utils.MetaVariable, Value: NewRSRParsersMustCompile("~*req.9", true, utils.INFIELD_SEP), Mandatory: true}, + &FCTemplate{Tag: utils.Destination, Path: utils.Destination, Type: utils.MetaVariable, Value: NewRSRParsersMustCompile("~*req.10", true, utils.INFIELD_SEP), Mandatory: true}, + &FCTemplate{Tag: utils.SetupTime, Path: utils.SetupTime, Type: utils.MetaVariable, Value: NewRSRParsersMustCompile("~*req.11", true, utils.INFIELD_SEP), Mandatory: true}, + &FCTemplate{Tag: utils.AnswerTime, Path: utils.AnswerTime, Type: utils.MetaVariable, Value: NewRSRParsersMustCompile("~*req.12", true, utils.INFIELD_SEP), Mandatory: true}, + &FCTemplate{Tag: utils.Usage, Path: utils.Usage, Type: utils.MetaVariable, Value: NewRSRParsersMustCompile("~*req.13", true, utils.INFIELD_SEP), Mandatory: true}, } expAttr := &ERsCfg{ Enabled: true, @@ -569,7 +569,7 @@ func testCgrCfgV1ReloadConfigSection(t *testing.T) { "Strip": "", "Tag": "ToR", "Timezone": "", - "Type": "*composed", + "Type": "*variable", "Value": []interface{}{ map[string]interface{}{ "AllFiltersMatch": true, @@ -594,7 +594,7 @@ func testCgrCfgV1ReloadConfigSection(t *testing.T) { "Strip": "", "Tag": "OriginID", "Timezone": "", - "Type": "*composed", + "Type": "*variable", "Value": []interface{}{ map[string]interface{}{ "AllFiltersMatch": true, @@ -619,7 +619,7 @@ func testCgrCfgV1ReloadConfigSection(t *testing.T) { "Strip": "", "Tag": "RequestType", "Timezone": "", - "Type": "*composed", + "Type": "*variable", "Value": []interface{}{ map[string]interface{}{ "AllFiltersMatch": true, @@ -644,7 +644,7 @@ func testCgrCfgV1ReloadConfigSection(t *testing.T) { "Strip": "", "Tag": "Tenant", "Timezone": "", - "Type": "*composed", + "Type": "*variable", "Value": []interface{}{ map[string]interface{}{ "AllFiltersMatch": true, @@ -669,7 +669,7 @@ func testCgrCfgV1ReloadConfigSection(t *testing.T) { "Strip": "", "Tag": "Category", "Timezone": "", - "Type": "*composed", + "Type": "*variable", "Value": []interface{}{ map[string]interface{}{ "AllFiltersMatch": true, @@ -694,7 +694,7 @@ func testCgrCfgV1ReloadConfigSection(t *testing.T) { "Strip": "", "Tag": "Account", "Timezone": "", - "Type": "*composed", + "Type": "*variable", "Value": []interface{}{ map[string]interface{}{ "AllFiltersMatch": true, @@ -719,7 +719,7 @@ func testCgrCfgV1ReloadConfigSection(t *testing.T) { "Strip": "", "Tag": "Subject", "Timezone": "", - "Type": "*composed", + "Type": "*variable", "Value": []interface{}{ map[string]interface{}{ "AllFiltersMatch": true, @@ -744,7 +744,7 @@ func testCgrCfgV1ReloadConfigSection(t *testing.T) { "Strip": "", "Tag": "Destination", "Timezone": "", - "Type": "*composed", + "Type": "*variable", "Value": []interface{}{ map[string]interface{}{ "AllFiltersMatch": true, @@ -769,7 +769,7 @@ func testCgrCfgV1ReloadConfigSection(t *testing.T) { "Strip": "", "Tag": "SetupTime", "Timezone": "", - "Type": "*composed", + "Type": "*variable", "Value": []interface{}{ map[string]interface{}{ "AllFiltersMatch": true, @@ -794,7 +794,7 @@ func testCgrCfgV1ReloadConfigSection(t *testing.T) { "Strip": "", "Tag": "AnswerTime", "Timezone": "", - "Type": "*composed", + "Type": "*variable", "Value": []interface{}{ map[string]interface{}{ "AllFiltersMatch": true, @@ -819,7 +819,7 @@ func testCgrCfgV1ReloadConfigSection(t *testing.T) { "Strip": "", "Tag": "Usage", "Timezone": "", - "Type": "*composed", + "Type": "*variable", "Value": []interface{}{ map[string]interface{}{ "AllFiltersMatch": true, diff --git a/data/conf/cgrates/cgrates.json b/data/conf/cgrates/cgrates.json index 792a992b0..5a1cb84b3 100755 --- a/data/conf/cgrates/cgrates.json +++ b/data/conf/cgrates/cgrates.json @@ -296,8 +296,7 @@ // "timezone": "", // timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB> // "filters": [], // limit parsing based on the filters // "flags": [], // flags to influence the event processing -// "header_fields": [], // template of the import header fields -// "content_fields":[ // import content_fields template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value +// "fields":[ // import content_fields template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value // {"tag": "ToR", "path": "ToR", "type": "*variable", "value": "~*req.2", "mandatory": true}, // {"tag": "OriginID", "path": "OriginID", "type": "*variable", "value": "~*req.3", "mandatory": true}, // {"tag": "RequestType", "path": "RequestType", "type": "*variable", "value": "~*req.4", "mandatory": true}, @@ -789,7 +788,8 @@ // }, -// "apier": { +// "apiers": { +// "enabled": false, // "caches_conns":["*internal"], // "scheduler_conns": [], // connections to SchedulerS for reloads // "attributes_conns": [], // connections to AttributeS for CDRExporter diff --git a/data/conf/samples/dispatchers/all2_mongo/cgrates.json b/data/conf/samples/dispatchers/all2_mongo/cgrates.json index 77f0cbf23..eac1d6060 100644 --- a/data/conf/samples/dispatchers/all2_mongo/cgrates.json +++ b/data/conf/samples/dispatchers/all2_mongo/cgrates.json @@ -17,7 +17,7 @@ "data_db": { "db_type": "mongo", - "db_name": "10", + "db_name": "12", "db_port": 27017, }, diff --git a/data/conf/samples/dispatchers/all2_mysql/cgrates.json b/data/conf/samples/dispatchers/all2_mysql/cgrates.json index 3a109dedd..38d6d5f92 100644 --- a/data/conf/samples/dispatchers/all2_mysql/cgrates.json +++ b/data/conf/samples/dispatchers/all2_mysql/cgrates.json @@ -1,93 +1,93 @@ -{ -// CGRateS Configuration file -// + { + // CGRateS Configuration file + // -"general": { - "node_id": "ALL2", - "log_level": 7 -}, - - -"listen": { - "rpc_json": ":7012", - "rpc_gob": ":7013", - "http": ":7080", -}, - -"data_db": { // database used to store runtime data (eg: accounts, cdr stats) - "db_type": "redis", // data_db type: - "db_port": 6379, // data_db port to reach the database - "db_name": "12", // data_db database name to connect to -}, - -"stor_db": { - "db_type":"*internal", -}, - - -"rpc_conns": { - "conn1": { - "strategy": "*first", - "conns": [{"address": "127.0.0.1:7012", "transport":"*json"}], + "general": { + "node_id": "ALL2", + "log_level": 7 }, -}, - -"attributes": { - "enabled": true -}, - -"rals": { - "enabled": true, -}, - -"schedulers": { - "enabled": true, -}, - -"chargers": { - "enabled": true, - "attributes_conns": ["*internal"], -}, - -"thresholds": { - "enabled": true, -}, - -"suppliers": { - "enabled": true, -}, - -"stats": { - "enabled": true, -}, - -"resources": { - "enabled": true, -}, - -"cdrs": { - "enabled": true, - "chargers_conns":["*internal"], - "rals_conns": ["*internal"], -}, - -"sessions": { - "enabled": true, - "listen_bijson": ":7014", - "suppliers_conns": ["*internal"], - "resources_conns": ["*internal"], - "attributes_conns": ["*internal"], - "rals_conns": ["*internal"], - "cdrs_conns": ["*internal"], - "chargers_conns": ["*internal"], -}, - -"apiers": { - "enabled": true, - "caches_conns":["conn1"], - "scheduler_conns": ["*internal"], -}, -} + "listen": { + "rpc_json": ":7012", + "rpc_gob": ":7013", + "http": ":7080", + }, + + "data_db": { // database used to store runtime data (eg: accounts, cdr stats) + "db_type": "redis", // data_db type: + "db_port": 6379, // data_db port to reach the database + "db_name": "12", // data_db database name to connect to + }, + + "stor_db": { + "db_type":"*internal", + }, + + + "rpc_conns": { + "conn1": { + "strategy": "*first", + "conns": [{"address": "127.0.0.1:7012", "transport":"*json"}], + }, + }, + + "attributes": { + "enabled": true + }, + + "rals": { + "enabled": true, + }, + + "schedulers": { + "enabled": true, + }, + + "chargers": { + "enabled": true, + "attributes_conns": ["*internal"], + }, + + "thresholds": { + "enabled": true, + }, + + "suppliers": { + "enabled": true, + }, + + "stats": { + "enabled": true, + }, + + "resources": { + "enabled": true, + }, + + "cdrs": { + "enabled": true, + "chargers_conns":["*internal"], + "rals_conns": ["*internal"], + }, + + "sessions": { + "enabled": true, + "listen_bijson": ":7014", + "suppliers_conns": ["*internal"], + "resources_conns": ["*internal"], + "attributes_conns": ["*internal"], + "rals_conns": ["*internal"], + "cdrs_conns": ["*internal"], + "chargers_conns": ["*internal"], + }, + + "apiers": { + "enabled": true, + "caches_conns":["conn1"], + "scheduler_conns": ["*internal"], + }, + + + } diff --git a/data/conf/samples/dispatchers/all_mysql/cgrates.json b/data/conf/samples/dispatchers/all_mysql/cgrates.json index 1ad0c5c7b..b93205cfe 100644 --- a/data/conf/samples/dispatchers/all_mysql/cgrates.json +++ b/data/conf/samples/dispatchers/all_mysql/cgrates.json @@ -1,100 +1,97 @@ { - // CGRateS Configuration file - // - - - "general": { - "node_id": "ALL", - "log_level": 7 - }, - - - "listen": { - "rpc_json": ":6012", - "rpc_gob": ":6013", - "http": ":6080", - }, - - "data_db": { // database used to store runtime data (eg: accounts, cdr stats) - "db_type": "redis", // data_db type: - "db_port": 6379, // data_db port to reach the database - "db_name": "11", // data_db database name to connect to - }, - - "stor_db": { - "db_password": "CGRateS.org", - }, - - - "rpc_conns": { - "conn1": { - "strategy": "*first", - "conns": [{"address": "127.0.0.1:6012", "transport":"*json"}], - }, - "rplConn": { - "strategy": "*broadcast_sync", - "conns": [{"address": "127.0.0.1:7012", "transport":"*json"}], - } - }, - - +// CGRateS Configuration file +// - - "attributes": { - "enabled": true + +"general": { + "node_id": "ALL", + "log_level": 7 +}, + + +"listen": { + "rpc_json": ":6012", + "rpc_gob": ":6013", + "http": ":6080", +}, + +"data_db": { // database used to store runtime data (eg: accounts, cdr stats) + "db_type": "redis", // data_db type: + "db_port": 6379, // data_db port to reach the database + "db_name": "11", // data_db database name to connect to +}, + +"stor_db": { + "db_password": "CGRateS.org", +}, + + +"rpc_conns": { + "conn1": { + "strategy": "*first", + "conns": [{"address": "127.0.0.1:6012", "transport":"*json"}], }, - - "rals": { - "enabled": true, - }, - - "schedulers": { - "enabled": true, - }, - - "chargers": { - "enabled": true, - "attributes_conns": ["*internal"], - }, - - "thresholds": { - "enabled": true, - }, - - "suppliers": { - "enabled": true, - }, - - "stats": { - "enabled": true, - }, - - "resources": { - "enabled": true, - }, - - "cdrs": { - "enabled": true, - "chargers_conns":["*internal"], - "rals_conns": ["*internal"], - }, - - "sessions": { - "enabled": true, - "listen_bijson": ":6014", - "suppliers_conns": ["*internal"], - "resources_conns": ["*internal"], - "attributes_conns": ["*internal"], - "rals_conns": ["*internal"], - "chargers_conns": ["*internal"], - "cdrs_conns": ["*internal"], - }, - - "apiers": { - "enabled": true, - "caches_conns":["conn1"], - "scheduler_conns": ["*internal"], - }, - + "rplConn": { + "strategy": "*broadcast_sync", + "conns": [{"address": "127.0.0.1:7012", "transport":"*json"}], + } +}, + + +"attributes": { + "enabled": true +}, + +"rals": { + "enabled": true, +}, + +"schedulers": { + "enabled": true, +}, + +"chargers": { + "enabled": true, + "attributes_conns": ["*internal"], +}, + +"thresholds": { + "enabled": true, +}, + +"suppliers": { + "enabled": true, +}, + +"stats": { + "enabled": true, +}, + +"resources": { + "enabled": true, +}, + +"cdrs": { + "enabled": true, + "chargers_conns":["*internal"], + "rals_conns": ["*internal"], +}, + +"sessions": { + "enabled": true, + "listen_bijson": ":6014", + "suppliers_conns": ["*internal"], + "resources_conns": ["*internal"], + "attributes_conns": ["*internal"], + "rals_conns": ["*internal"], + "chargers_conns": ["*internal"], + "cdrs_conns": ["*internal"], +}, + +"apiers": { + "enabled": true, + "caches_conns":["conn1"], + "scheduler_conns": ["*internal"], +}, + } - \ No newline at end of file diff --git a/general_tests/cdrs_post_failover_it_test.go b/general_tests/cdrs_post_failover_it_test.go index 98991cabe..3568beeb8 100644 --- a/general_tests/cdrs_post_failover_it_test.go +++ b/general_tests/cdrs_post_failover_it_test.go @@ -57,7 +57,7 @@ func TestCDRsPostFailoverIT(t *testing.T) { switch *dbType { case utils.MetaInternal: cdrsPostFailConfDIR = "cdrsv_failover_internal" - case utils.MetaSQL: + case utils.MetaMySQL: cdrsPostFailConfDIR = "cdrsv_failover_mysql" case utils.MetaMongo: cdrsPostFailConfDIR = "cdrsv_failover_mongo"