Rename default_opts to opts

This commit is contained in:
ionutboangiu
2021-09-07 14:54:26 +03:00
committed by Dan Christian Bogos
parent e8ea08c109
commit adfaea31c5
18 changed files with 101 additions and 95 deletions

View File

@@ -153,7 +153,7 @@ func testCfgGetConfig(t *testing.T) {
"resources_conns": []string{"*localhost"},
"stats_conns": []string{"*localhost"},
"suffix_indexed_fields": []string{},
utils.DefaultOptsCfg: map[string]interface{}{
utils.OptsCfg: map[string]interface{}{
utils.OptsAttributesProcessRuns: float64(1),
},
},
@@ -189,7 +189,7 @@ func testCfgSetGetConfig(t *testing.T) {
"resources_conns": []string{"*internal"},
"stats_conns": []string{"*internal"},
"suffix_indexed_fields": []string{},
utils.DefaultOptsCfg: map[string]interface{}{
utils.OptsCfg: map[string]interface{}{
utils.OptsAttributesProcessRuns: 2,
},
},
@@ -212,7 +212,7 @@ func testCfgSetGetConfig(t *testing.T) {
"resources_conns": []string{"*internal"},
"stats_conns": []string{"*internal"},
"suffix_indexed_fields": []string{},
utils.DefaultOptsCfg: map[string]interface{}{
utils.OptsCfg: map[string]interface{}{
utils.OptsAttributesProcessRuns: float64(2),
},
},
@@ -302,7 +302,7 @@ func testCfgSetJSONGetJSONConfig(t *testing.T) {
&config.SetConfigFromJSONArgs{
APIOpts: nil,
Tenant: "",
Config: "{\"attributes\":{\"accounts_conns\":[\"*internal\"],\"enabled\":true,\"indexed_selects\":false,\"nested_fields\":false,\"prefix_indexed_fields\":[],\"resources_conns\":[\"*internal\"],\"stats_conns\":[\"*localhost\"],\"suffix_indexed_fields\":[],\"default_opts\":{\"*processRuns\":2}}}",
Config: "{\"attributes\":{\"accounts_conns\":[\"*internal\"],\"enabled\":true,\"indexed_selects\":false,\"nested_fields\":false,\"prefix_indexed_fields\":[],\"resources_conns\":[\"*internal\"],\"stats_conns\":[\"*localhost\"],\"suffix_indexed_fields\":[],\"opts\":{\"*processRuns\":2}}}",
DryRun: false,
},
&reply); err != nil {
@@ -311,7 +311,7 @@ func testCfgSetJSONGetJSONConfig(t *testing.T) {
if !reflect.DeepEqual(`"OK"`, utils.ToJSON(reply)) {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", "OK", utils.ToJSON(reply))
}
expectedGet := "{\"attributes\":{\"accounts_conns\":[\"*internal\"],\"default_opts\":{\"*processRuns\":2},\"enabled\":true,\"indexed_selects\":false,\"nested_fields\":false,\"prefix_indexed_fields\":[],\"resources_conns\":[\"*internal\"],\"stats_conns\":[\"*localhost\"],\"suffix_indexed_fields\":[]}}"
expectedGet := "{\"attributes\":{\"accounts_conns\":[\"*internal\"],\"opts\":{\"*processRuns\":2},\"enabled\":true,\"indexed_selects\":false,\"nested_fields\":false,\"prefix_indexed_fields\":[],\"resources_conns\":[\"*internal\"],\"stats_conns\":[\"*localhost\"],\"suffix_indexed_fields\":[]}}"
var replyGet string
if err := cfgRPC.Call(context.Background(), utils.ConfigSv1GetConfigAsJSON,
&config.SectionWithAPIOpts{
@@ -430,7 +430,7 @@ func testCfgGetConfigStore(t *testing.T) {
Prefix_indexed_fields: nil,
Suffix_indexed_fields: nil,
Nested_fields: nil,
Default_opts: make(map[string]interface{}),
Opts: make(map[string]interface{}),
}
if !reflect.DeepEqual(attr, expected) {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", utils.ToJSON(expected), utils.ToJSON(attr))
@@ -454,7 +454,7 @@ func testCfgSetGetConfigStore(t *testing.T) {
"resources_conns": []string{"*internal"},
"stats_conns": []string{"*internal"},
"suffix_indexed_fields": []string{},
utils.DefaultOptsCfg: map[string]interface{}{
utils.OptsCfg: map[string]interface{}{
utils.OptsAttributesProcessRuns: 2,
},
},
@@ -477,7 +477,7 @@ func testCfgSetGetConfigStore(t *testing.T) {
"resources_conns": []string{"*internal"},
"stats_conns": []string{"*internal"},
"suffix_indexed_fields": []string{},
utils.DefaultOptsCfg: map[string]interface{}{
utils.OptsCfg: map[string]interface{}{
utils.OptsAttributesProcessRuns: 2,
},
},
@@ -512,7 +512,7 @@ func testCfgGetConfigStoreAgain(t *testing.T) {
Prefix_indexed_fields: nil,
Suffix_indexed_fields: nil,
Nested_fields: nil,
Default_opts: map[string]interface{}{
Opts: map[string]interface{}{
utils.OptsAttributesProcessRuns: float64(2),
},
}
@@ -532,7 +532,7 @@ func testCfgMdfSectConfigStore(t *testing.T) {
Prefix_indexed_fields: nil,
Suffix_indexed_fields: nil,
Nested_fields: nil,
Default_opts: map[string]interface{}{
Opts: map[string]interface{}{
utils.OptsAttributesProcessRuns: float64(2),
},
}
@@ -571,7 +571,7 @@ func testCfgGetAfterReloadStore(t *testing.T) {
"resources_conns": []string{"*internal"},
"stats_conns": []string{"*internal"},
"suffix_indexed_fields": []string{},
utils.DefaultOptsCfg: map[string]interface{}{
utils.OptsCfg: map[string]interface{}{
utils.OptsAttributesProcessRuns: 2,
},
},

View File

@@ -73,7 +73,7 @@ func TestConfigSetGetConfig(t *testing.T) {
"resources_conns": []string{"*localhost"},
"stats_conns": []string{"*localhost"},
"suffix_indexed_fields": []string{},
utils.DefaultOptsCfg: map[string]interface{}{
utils.OptsCfg: map[string]interface{}{
utils.OptsAttributesProcessRuns: float64(1),
},
utils.ProfileRunsCfg: 0,
@@ -109,7 +109,7 @@ func TestConfigSetGetReloadConfig(t *testing.T) {
"resources_conns": []string{"*internal"},
"stats_conns": []string{"*internal"},
"suffix_indexed_fields": []string{},
utils.DefaultOptsCfg: map[string]interface{}{
utils.OptsCfg: map[string]interface{}{
utils.OptsAttributesProcessRuns: 2,
},
},
@@ -140,7 +140,7 @@ func TestConfigSetGetReloadConfig(t *testing.T) {
"resources_conns": []string{"*localhost"},
"stats_conns": []string{"*localhost"},
"suffix_indexed_fields": []string{},
utils.DefaultOptsCfg: map[string]interface{}{
utils.OptsCfg: map[string]interface{}{
utils.OptsAttributesProcessRuns: float64(1),
},
utils.ProfileRunsCfg: 0,
@@ -181,7 +181,7 @@ func TestConfigSetGetReloadConfig(t *testing.T) {
"resources_conns": []string{"*localhost"},
"stats_conns": []string{"*localhost"},
"suffix_indexed_fields": []string{},
utils.DefaultOptsCfg: map[string]interface{}{
utils.OptsCfg: map[string]interface{}{
utils.OptsAttributesProcessRuns: float64(1),
},
utils.ProfileRunsCfg: 0,
@@ -207,7 +207,7 @@ func TestConfigGetSetConfigFromJSONErr(t *testing.T) {
args := &config.SetConfigFromJSONArgs{
APIOpts: nil,
Tenant: utils.CGRateSorg,
Config: "{\"attributes\":{\"accounts_conns\":[\"*localhost\"],\"default_opts\":{\"*processRuns\":2},\"enabled\":true,\"indexed_selects\":true,\"nested_fields\":false,\"prefix_indexed_fields\":[],\"resources_conns\":[\"*localhost\"],\"stats_conns\":[\"*localhost\"],\"suffix_indexed_fields\":[]}}",
Config: "{\"attributes\":{\"accounts_conns\":[\"*localhost\"],\"opts\":{\"*processRuns\":2},\"enabled\":true,\"indexed_selects\":true,\"nested_fields\":false,\"prefix_indexed_fields\":[],\"resources_conns\":[\"*localhost\"],\"stats_conns\":[\"*localhost\"],\"suffix_indexed_fields\":[]}}",
DryRun: true,
}
var reply string
@@ -227,7 +227,11 @@ func TestConfigGetSetConfigFromJSONErr(t *testing.T) {
}
var replyGet string
errGet := rlcCfg.GetConfigAsJSON(context.Background(), argsGet, &replyGet)
<<<<<<< HEAD
expectedGet := `{"attributes":{"accounts_conns":["*localhost"],"default_opts":{"*processRuns":1},"enabled":true,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"profile_runs":0,"resources_conns":["*localhost"],"stats_conns":["*localhost"],"suffix_indexed_fields":[]}}`
=======
expectedGet := "{\"attributes\":{\"accounts_conns\":[\"*localhost\"],\"enabled\":true,\"indexed_selects\":true,\"nested_fields\":false,\"opts\":{\"*processRuns\":1},\"prefix_indexed_fields\":[],\"resources_conns\":[\"*localhost\"],\"stats_conns\":[\"*localhost\"],\"suffix_indexed_fields\":[]}}"
>>>>>>> 3df2de22e (Rename default_opts to opts)
if err != nil {
t.Errorf("Expected <%+v>, \nReceived <%+v>", nil, errGet)
}