Started using camelCase for opts in data_db

This commit is contained in:
andronache
2021-05-04 16:38:07 +03:00
committed by Dan Christian Bogos
parent 4d90083da2
commit 75815b3325
14 changed files with 59 additions and 59 deletions

View File

@@ -107,10 +107,10 @@ const CGRATES_CFG_JSON = `
"*indexes":{"remote":false, "replicate":false},
},
"opts":{
"redis_sentinel": "", // the name of sentinel when used
"redis_cluster": false, // if enabled the datadb will try to connect to the redis cluster
"redis_cluster_sync": "5s", // the sync interval for the redis cluster
"redis_cluster_ondown_delay": "0", // the delay before executing the commands if the redis cluster is in the CLUSTERDOWN state
"redisSentinel": "", // the name of sentinel when used
"redisCluster": false, // if enabled the datadb will try to connect to the redis cluster
"redisClusterSync": "5s", // the sync interval for the redis cluster
"redisClusterOndownDelay": "0", // the delay before executing the commands if the redis cluster is in the CLUSTERDOWN state
"query_timeout":"10s",
"redis_tls": false, // if true it will use a tls connection and use the redis_client_certificate certificate, redis_client_key and redis_ca_certificate for tls connection
"redis_client_certificate":"", // path to client certificate
@@ -941,10 +941,10 @@ const CGRATES_CFG_JSON = `
"out_stordb_password": "",
"users_filters":[],
"out_datadb_opts":{
"redis_sentinel": "",
"redis_cluster": false,
"redis_cluster_sync": "5s",
"redis_cluster_ondown_delay": "0",
"redisSentinel": "",
"redisCluster": false,
"redisClusterSync": "5s",
"redisClusterOndownDelay": "0",
"redis_tls": false, // enable TLS when connecting to Redis and use the redis_client_certificate, redis_client_key and redis_ca_certificate for TLS connection
"redis_client_certificate":"", // path to client certificate
"redis_client_key":"", // path to client key

View File

@@ -4840,7 +4840,7 @@ func TestV1GetConfigAsJSONGeneral(t *testing.T) {
func TestV1GetConfigAsJSONDataDB(t *testing.T) {
var reply string
expected := `{"data_db":{"db_host":"127.0.0.1","db_name":"10","db_password":"","db_port":6379,"db_type":"*redis","db_user":"cgrates","items":{"*accounts":{"remote":false,"replicate":false},"*action_profiles":{"remote":false,"replicate":false},"*actions":{"remote":false,"replicate":false},"*attribute_profiles":{"remote":false,"replicate":false},"*charger_profiles":{"remote":false,"replicate":false},"*destinations":{"remote":false,"replicate":false},"*dispatcher_hosts":{"remote":false,"replicate":false},"*dispatcher_profiles":{"remote":false,"replicate":false},"*filters":{"remote":false,"replicate":false},"*indexes":{"remote":false,"replicate":false},"*load_ids":{"remote":false,"replicate":false},"*rate_profiles":{"remote":false,"replicate":false},"*resource_profiles":{"remote":false,"replicate":false},"*resources":{"remote":false,"replicate":false},"*reverse_destinations":{"remote":false,"replicate":false},"*route_profiles":{"remote":false,"replicate":false},"*statqueue_profiles":{"remote":false,"replicate":false},"*statqueues":{"remote":false,"replicate":false},"*threshold_profiles":{"remote":false,"replicate":false},"*thresholds":{"remote":false,"replicate":false},"*timings":{"remote":false,"replicate":false}},"opts":{"query_timeout":"10s","redis_ca_certificate":"","redis_client_certificate":"","redis_client_key":"","redis_cluster":false,"redis_cluster_ondown_delay":"0","redis_cluster_sync":"5s","redis_sentinel":"","redis_tls":false},"remote_conn_id":"","remote_conns":[],"replication_cache":"","replication_conns":[],"replication_filtered":false}}`
expected := `{"data_db":{"db_host":"127.0.0.1","db_name":"10","db_password":"","db_port":6379,"db_type":"*redis","db_user":"cgrates","items":{"*account_action_plans":{"remote":false,"replicate":false},"*accounts":{"remote":false,"replicate":false},"*action_plans":{"remote":false,"replicate":false},"*action_triggers":{"remote":false,"replicate":false},"*actions":{"remote":false,"replicate":false},"*attribute_profiles":{"remote":false,"replicate":false},"*charger_profiles":{"remote":false,"replicate":false},"*destinations":{"remote":false,"replicate":false},"*dispatcher_hosts":{"remote":false,"replicate":false},"*dispatcher_profiles":{"remote":false,"replicate":false},"*filters":{"remote":false,"replicate":false},"*indexes":{"remote":false,"replicate":false},"*load_ids":{"remote":false,"replicate":false},"*rating_plans":{"remote":false,"replicate":false},"*rating_profiles":{"remote":false,"replicate":false},"*resource_profiles":{"remote":false,"replicate":false},"*resources":{"remote":false,"replicate":false},"*reverse_destinations":{"remote":false,"replicate":false},"*route_profiles":{"remote":false,"replicate":false},"*shared_groups":{"remote":false,"replicate":false},"*statqueue_profiles":{"remote":false,"replicate":false},"*statqueues":{"remote":false,"replicate":false},"*threshold_profiles":{"remote":false,"replicate":false},"*thresholds":{"remote":false,"replicate":false},"*timings":{"remote":false,"replicate":false}},"opts":{"query_timeout":"10s","redisCluster":false,"redisClusterOndownDelay":"0","redisClusterSync":"5s","redisSentinel":"","redis_ca_certificate":"","redis_client_certificate":"","redis_client_key":"","redis_tls":false},"remote_conn_id":"","remote_conns":[],"replication_cache":"","replication_conns":[],"replication_filtered":false}}`
cfgCgr := NewDefaultCGRConfig()
if err := cfgCgr.V1GetConfigAsJSON(context.Background(), &SectionWithAPIOpts{Sections: []string{DataDBJSON}}, &reply); err != nil {
t.Error(err)
@@ -5139,7 +5139,7 @@ func TestV1GetConfigAsJSONCgrLoader(t *testing.T) {
func TestV1GetConfigAsJSONCgrMigrator(t *testing.T) {
var reply string
expected := `{"migrator":{"out_datadb_encoding":"msgpack","out_datadb_host":"127.0.0.1","out_datadb_name":"10","out_datadb_opts":{"redis_ca_certificate":"","redis_client_certificate":"","redis_client_key":"","redis_cluster":false,"redis_cluster_ondown_delay":"0","redis_cluster_sync":"5s","redis_sentinel":"","redis_tls":false},"out_datadb_password":"","out_datadb_port":"6379","out_datadb_type":"redis","out_datadb_user":"cgrates","out_stordb_host":"127.0.0.1","out_stordb_name":"cgrates","out_stordb_opts":{},"out_stordb_password":"","out_stordb_port":"3306","out_stordb_type":"mysql","out_stordb_user":"cgrates","users_filters":[]}}`
expected := `{"migrator":{"out_datadb_encoding":"msgpack","out_datadb_host":"127.0.0.1","out_datadb_name":"10","out_datadb_opts":{"redisCluster":false,"redisClusterOndownDelay":"0","redisClusterSync":"5s","redisSentinel":"","redis_ca_certificate":"","redis_client_certificate":"","redis_client_key":"","redis_tls":false},"out_datadb_password":"","out_datadb_port":"6379","out_datadb_type":"redis","out_datadb_user":"cgrates","out_stordb_host":"127.0.0.1","out_stordb_name":"cgrates","out_stordb_opts":{},"out_stordb_password":"","out_stordb_port":"3306","out_stordb_type":"mysql","out_stordb_user":"cgrates","users_filters":[]}}`
cgrCfg := NewDefaultCGRConfig()
if err := cgrCfg.V1GetConfigAsJSON(context.Background(), &SectionWithAPIOpts{Sections: []string{MigratorJSON}}, &reply); err != nil {
t.Error(err)

View File

@@ -208,7 +208,7 @@ func TestDataDBRemoteReplication(t *testing.T) {
"db_user": "cgrates", // username to use when connecting to data_db
"db_password": "password", // password to use when connecting to data_db
"opts":{
"redis_sentinel":"sentinel", // redis_sentinel is the name of sentinel
"redisSentinel":"sentinel", // redisSentinel is the name of sentinel
},
"remote_conns":["Conn1"],
}
@@ -317,7 +317,7 @@ func TestDataDbCfgloadFromJsonCfgItems(t *testing.T) {
"*destinations": {"replicate":false},
} ,
"opts": {
"redis_sentinel":"sentinel", // redis_sentinel is the name of sentinel
"redisSentinel":"sentinel", // redisSentinel is the name of sentinel
}
},
}`
@@ -366,7 +366,7 @@ func TestDataDbCfgloadFromJsonCfgItems(t *testing.T) {
"db_user": "cgrates", // username to use when connecting to data_db
"db_password": "password", // password to use when connecting to data_db
"opts": {
"redis_sentinel":"sentinel", // redis_sentinel is the name of sentinel
"redisSentinel":"sentinel", // redisSentinel is the name of sentinel
},
"remote_conns":["Conn1"],
"items":{
@@ -424,7 +424,7 @@ func TestDataDbCfgloadFromJsonCfgItems(t *testing.T) {
"db_user": "cgrates", // username to use when connecting to data_db
"db_password": "password", // password to use when connecting to data_db
"opts": {
"redis_sentinel":"sentinel", // redis_sentinel is the name of sentinel
"redisSentinel":"sentinel", // redisSentinel is the name of sentinel
},
"remote_conns":["Conn1"],
"items":{
@@ -476,7 +476,7 @@ func TestDataDbCfgAsMapInterface(t *testing.T) {
"db_user": "cgrates",
"db_password": "",
"opts": {
"redis_sentinel":"",
"redisSentinel":"",
"query_timeout":"10s",
},
"remote_conns":[],

View File

@@ -93,12 +93,12 @@ func TestMigratorCgrCfgAsMapInterface(t *testing.T) {
"out_stordb_port": "1234",
"users_filters":["users","filters","Account"],
"out_datadb_opts":{
"redis_cluster": true,
"redis_cluster_sync": "2s",
"redis_cluster_ondown_delay": "1",
"redisCluster": true,
"redisClusterSync": "2s",
"redisClusterOndownDelay": "1",
},
"out_stordb_opts":{
"redis_cluster": true,
"redisCluster": true,
},
},
}`
@@ -143,7 +143,7 @@ func TestMigratorCgrCfgAsMapInterface1(t *testing.T) {
"out_stordb_password": "out_stordb_password",
"users_filters":["users","filters","Account"],
"out_datadb_opts": {
"redis_sentinel": "out_datadb_redis_sentinel",
"redisSentinel": "out_datadb_redis_sentinel",
},
},
}`

View File

@@ -44,7 +44,7 @@ var (
"db_name": "10",/*/*asd*/ // data_db database name to connect to
"db_user": "*env:TESTVAR", // username to use when connecting to data_db
"db_password": ",/**/", // password to use when connecting to data_db
"redis_sentinel":"", // redis_sentinel is the name of sentinel
"redisSentinel":"", // redisSentinel is the name of sentinel
},/*Multiline coment
Line1
Line2
@@ -55,8 +55,8 @@ var (
func TestEnvRawJsonReadByte(t *testing.T) {
raw := NewRjReaderFromBytes([]byte(envStr))
expected := []byte(`{"data_db":{"db_type":"redis","db_host":"127.0.0.1","db_port":6379,"db_name":"10","db_user":"*env:TESTVAR","db_password":",/**/","redis_sentinel":""}}`)
var reply []byte
expected := []byte(`{"data_db":{"db_type":"redis","db_host":"127.0.0.1","db_port":6379,"db_name":"10","db_user":"*env:TESTVAR","db_password":",/**/","redisSentinel":""}}`)
rply := []byte{}
bit, err := raw.ReadByte()
for ; err == nil; bit, err = raw.ReadByte() {
reply = append(reply, bit)
@@ -211,8 +211,8 @@ func TestEnvReaderRead(t *testing.T) {
t.Error(err)
}
envR := NewRjReaderFromBytes([]byte(envStr))
expected := []byte(`{"data_db":{"db_type":"redis","db_host":"127.0.0.1","db_port":6379,"db_name":"10","db_user":"cgRates","db_password":",/**/","redis_sentinel":""}}`)
var reply []byte
expected := []byte(`{"data_db":{"db_type":"redis","db_host":"127.0.0.1","db_port":6379,"db_name":"10","db_user":"cgRates","db_password":",/**/","redisSentinel":""}}`)
rply := []byte{}
buf := make([]byte, 20)
n, err := envR.Read(buf)
for ; err == nil && n > 0; n, err = envR.Read(buf) {
@@ -445,7 +445,7 @@ func TestGetErrorLine(t *testing.T) {
"db_name": "10",/*/*asd*/ // data_db database name to connect to
"db_user": "user", // username to use when connecting to data_db
"db_password": ",/**/", // password to use when connecting to data_db
"redis_sentinel":"", // redis_sentinel is the name of sentinel
"redisSentinel":"", // redisSentinel is the name of sentinel
},/*Multiline coment
Line1
Line2
@@ -478,7 +478,7 @@ func TestGetErrorLine2(t *testing.T) {
"db_name": "10",/*/*asd*/ // data_db database name to connect to
"db_user": "user", // username to use when connecting to data_db
"db_password": ",/**/", // password to use when connecting to data_db
"redis_sentinel":"", // redis_sentinel is the name of sentinel
"redisSentinel":"", // redisSentinel is the name of sentinel
},/*Multiline coment
Line1
Line2

View File

@@ -89,10 +89,10 @@
// "*indexes":{"remote":false, "replicate":false},
// },
// "opts":{
// "redis_sentinel": "", // the name of sentinel when used
// "redis_cluster": false, // if enabled the datadb will try to connect to the redis cluster
// "redis_cluster_sync": "5s", // the sync interval for the redis cluster
// "redis_cluster_ondown_delay": "0", // the delay before executing the commands if the redis cluster is in the CLUSTERDOWN state
// "redisSentinel": "", // the name of sentinel when used
// "redisCluster": false, // if enabled the datadb will try to connect to the redis cluster
// "redisClusterSync": "5s", // the sync interval for the redis cluster
// "redisClusterOndownDelay": "0", // the delay before executing the commands if the redis cluster is in the CLUSTERDOWN state
// "query_timeout":"10s",
// "redis_tls": false, // if true it will use a tls connection and use the redis_client_certificate certificate, redis_client_key and redis_ca_certificate for tls connection
// "redis_client_certificate":"", // path to client certificate
@@ -952,10 +952,10 @@
// "out_stordb_password": "",
// "users_filters":[],
// "out_datadb_opts":{
// "redis_sentinel": "",
// "redis_cluster": false,
// "redis_cluster_sync": "5s",
// "redis_cluster_ondown_delay": "0",
// "redisSentinel": "",
// "redisCluster": false,
// "redisClusterSync": "5s",
// "redisClusterOndownDelay": "0",
// "redis_tls": false, // enable TLS when connecting to Redis and use the redis_client_certificate, redis_client_key and redis_ca_certificate for TLS connection
// "redis_client_certificate":"", // path to client certificate
// "redis_client_key":"", // path to client key

View File

@@ -20,8 +20,8 @@
"db_host":"127.0.0.1:7001",
"db_name": "10", // data_db database name to connect to
"opts": {
"redis_cluster": true,
"redis_cluster_sync": "100ms", // the sync interval for the redis cluster
"redisCluster": true,
"redisClusterSync": "100ms", // the sync interval for the redis cluster
},
},

View File

@@ -20,7 +20,7 @@
"db_host":"127.0.0.1:16381;127.0.0.1:16382",
"db_name": "10", // data_db database name to connect to
"opts": {
"redis_sentinel":"redis-cluster",
"redisSentinel":"redis-cluster",
},
},

View File

@@ -55,9 +55,9 @@ Customisable through the use of :ref:`JSON configuration <configuration>` or com
The path to folder containing the data files (default "./")
-recursive
Loads data from folder recursive.
-redis_sentinel string
-redisSentinel string
The name of redis sentinel
-redis_cluster bool
-redisCluster bool
Is the redis datadb a cluster
-cluster_sync string
The sync interval for the redis cluster

View File

@@ -59,9 +59,9 @@ Customisable through the use of :ref:`JSON configuration <configuration>` or com
output StorDB type for move mode <*mysql|*postgres|*mongo> (default "*stordb")
-out_stordb_user string
output StorDB user (default "*stordb")
-redis_sentinel string
-redisSentinel string
the name of redis sentinel
-redis_cluster bool
-redisCluster bool
Is the redis datadb a cluster
-cluster_sync string
The sync interval for the redis cluster

View File

@@ -41,9 +41,9 @@ Command line stress testing tool configurable via command line arguments.
run n requests in parallel
-rater_address string
Rater address for remote tests. Empty for internal rater.
-redis_sentinel string
-redisSentinel string
The name of redis sentinel
-redis_cluster bool
-redisCluster bool
Is the redis datadb a cluster
-cluster_sync string
The sync interval for the redis cluster

View File

@@ -49,8 +49,8 @@ import (
* - configure the cluster with the following command:
* `./redis-trib.rb create --replicas 1 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005 127.0.0.1:7006`
*
* To run the tests you need to specify the `redis_cluster` flag and have the redis stoped:
* `go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*mysql -run=TestRedisCluster -redis_cluster -v`
* To run the tests you need to specify the `redisCluster` flag and have the redis stoped:
* `go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*mysql -run=TestRedisCluster -redisCluster -v`
*
* The configuration of the cluster is the following:
* - node1 127.0.0.1:7001 master
@@ -66,12 +66,12 @@ var (
clsrConfig *config.CGRConfig
clsrRPC *rpc.Client
clsrNodeCfgPath = path.Join(*dataDir, "redis_cluster", "node%v.conf")
clsrEngineCfgPath = path.Join(*dataDir, "conf", "samples", "redis_cluster")
clsrNodeCfgPath = path.Join(*dataDir, "redisCluster", "node%v.conf")
clsrEngineCfgPath = path.Join(*dataDir, "conf", "samples", "redisCluster")
clsrNodes = make(map[string]*exec.Cmd)
clsrOutput = make(map[string]*bytes.Buffer) // in order to debug if something is not working
clsrNoNodes = 6 // this is the minimum number of nodes for a cluster with 1 replica for each master
clsrRedisFlag = flag.Bool("redis_cluster", false, "Run tests for redis cluster")
clsrRedisFlag = flag.Bool("redisCluster", false, "Run tests for redis cluster")
clsrTests = []func(t *testing.T){
testClsrPrepare,
testClsrStartNodes,

View File

@@ -36,18 +36,18 @@ import (
)
var (
node1ConfigPath = path.Join(*dataDir, "redis_sentinel", "node1.conf")
node2ConfigPath = path.Join(*dataDir, "redis_sentinel", "node2.conf")
sentinel1ConfigPath = path.Join(*dataDir, "redis_sentinel", "sentinel1.conf")
sentinel2ConfigPath = path.Join(*dataDir, "redis_sentinel", "sentinel2.conf")
engineConfigPath = path.Join(*dataDir, "conf", "samples", "redis_sentinel")
node1ConfigPath = path.Join(*dataDir, "redisSentinel", "node1.conf")
node2ConfigPath = path.Join(*dataDir, "redisSentinel", "node2.conf")
sentinel1ConfigPath = path.Join(*dataDir, "redisSentinel", "sentinel1.conf")
sentinel2ConfigPath = path.Join(*dataDir, "redisSentinel", "sentinel2.conf")
engineConfigPath = path.Join(*dataDir, "conf", "samples", "redisSentinel")
sentinelConfig *config.CGRConfig
sentinelRPC *rpc.Client
node1Exec *exec.Cmd
node2Exec *exec.Cmd
stlExec1 *exec.Cmd
stlExec2 *exec.Cmd
redisSentinel = flag.Bool("redis_sentinel", false, "Run tests with redis sentinel")
redisSentinel = flag.Bool("redisSentinel", false, "Run tests with redis sentinel")
sTestsRds = []func(t *testing.T){
testRedisSentinelStartNodes,

View File

@@ -1783,10 +1783,10 @@ const (
DataDbNameCfg = "db_name"
DataDbUserCfg = "db_user"
DataDbPassCfg = "db_password"
RedisSentinelNameCfg = "redis_sentinel"
RedisClusterCfg = "redis_cluster"
RedisClusterSyncCfg = "redis_cluster_sync"
RedisClusterOnDownDelayCfg = "redis_cluster_ondown_delay"
RedisSentinelNameCfg = "redisSentinel"
RedisClusterCfg = "redisCluster"
RedisClusterSyncCfg = "redisClusterSync"
RedisClusterOnDownDelayCfg = "redisClusterOndownDelay"
RedisTLS = "redis_tls"
RedisClientCertificate = "redis_client_certificate"
RedisClientKey = "redis_client_key"