Updated config APIs and added integration tests

This commit is contained in:
Trial97
2020-11-18 13:08:25 +02:00
committed by Dan Christian Bogos
parent b0208c29f0
commit ffcb95e2ca
37 changed files with 178 additions and 123 deletions

View File

@@ -80,7 +80,7 @@ func TestApiersReload(t *testing.T) {
t.Errorf("Expected service to be down")
}
var reply string
if err := cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithOpts{
if err := cfg.V1ReloadConfig(&config.ConfigReloadArgs{
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "tutmongo"),
Section: config.ApierS,
}, &reply); err != nil {

View File

@@ -65,7 +65,7 @@ func TestAsteriskAgentReload(t *testing.T) {
t.Errorf("Expected service to be down")
}
var reply string
if err := cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithOpts{
if err := cfg.V1ReloadConfig(&config.ConfigReloadArgs{
Path: path.Join("/usr", "share", "cgrates", "tutorial_tests", "asterisk_ari", "cgrates", "etc", "cgrates"),
Section: config.AsteriskAgentJSN,
}, &reply); err != nil {

View File

@@ -69,7 +69,7 @@ func TestAttributeSReload(t *testing.T) {
}
var reply string
if err := cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithOpts{
if err := cfg.V1ReloadConfig(&config.ConfigReloadArgs{
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "tutmongo"),
Section: config.ATTRIBUTE_JSN,
}, &reply); err != nil {

View File

@@ -91,7 +91,7 @@ func TestCdrsReload(t *testing.T) {
}
cfg.RalsCfg().Enabled = true
var reply string
if err := cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithOpts{
if err := cfg.V1ReloadConfig(&config.ConfigReloadArgs{
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "tutmongo"),
Section: config.CDRS_JSN,
}, &reply); err != nil {

View File

@@ -69,7 +69,7 @@ func TestChargerSReload(t *testing.T) {
t.Errorf("Expected service to be down")
}
var reply string
if err = cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithOpts{
if err = cfg.V1ReloadConfig(&config.ConfigReloadArgs{
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "tutmongo"),
Section: config.ChargerSCfgJson,
}, &reply); err != nil {

View File

@@ -64,7 +64,7 @@ func TestDataDBReload(t *testing.T) {
}
var reply string
cfg.AttributeSCfg().Enabled = true
if err := cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithOpts{
if err := cfg.V1ReloadConfig(&config.ConfigReloadArgs{
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "tutmongo"),
Section: config.DATADB_JSN,
}, &reply); err != nil {

View File

@@ -65,7 +65,7 @@ func TestDiameterAgentReload(t *testing.T) {
t.Errorf("Expected service to be down")
}
var reply string
if err := cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithOpts{
if err := cfg.V1ReloadConfig(&config.ConfigReloadArgs{
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "diamagent_mysql"),
Section: config.DA_JSN,
}, &reply); err != nil {

View File

@@ -71,7 +71,7 @@ func TestDispatcherSReload(t *testing.T) {
t.Errorf("Expected service to be down")
}
var reply string
if err = cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithOpts{
if err = cfg.V1ReloadConfig(&config.ConfigReloadArgs{
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "dispatchers", "dispatchers_mysql"),
Section: config.DispatcherSJson,

View File

@@ -65,7 +65,7 @@ func TestDNSAgentReload(t *testing.T) {
t.Errorf("Expected service to be down")
}
var reply string
if err := cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithOpts{
if err := cfg.V1ReloadConfig(&config.ConfigReloadArgs{
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "dnsagent_reload"),
Section: config.DNSAgentJson,
}, &reply); err != nil {

View File

@@ -83,7 +83,7 @@ func TestEventExporterSReload(t *testing.T) {
fcTmp.ComputePath()
cfg.TemplatesCfg()["requiredFields"] = []*config.FCTemplate{fcTmp}
var reply string
if err := cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithOpts{
if err := cfg.V1ReloadConfig(&config.ConfigReloadArgs{
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "ees"),
Section: config.EEsJson,
}, &reply); err != nil {

View File

@@ -69,7 +69,7 @@ func TestEventReaderSReload(t *testing.T) {
t.Errorf("Expected service to be down")
}
var reply string
if err := cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithOpts{
if err := cfg.V1ReloadConfig(&config.ConfigReloadArgs{
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "ers_reload", "internal"),
Section: config.ERsJson,
}, &reply); err != nil {

View File

@@ -65,7 +65,7 @@ func TestFreeSwitchAgentReload(t *testing.T) {
t.Errorf("Expected service to be down")
}
var reply string
if err := cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithOpts{
if err := cfg.V1ReloadConfig(&config.ConfigReloadArgs{
Path: path.Join("/usr", "share", "cgrates", "tutorial_tests", "fs_evsock", "cgrates", "etc", "cgrates"),
Section: config.FreeSWITCHAgentJSN,
}, &reply); err != nil {

View File

@@ -65,7 +65,7 @@ func TestKamailioAgentReload(t *testing.T) {
t.Errorf("Expected service to be down")
}
var reply string
if err := cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithOpts{
if err := cfg.V1ReloadConfig(&config.ConfigReloadArgs{
Path: path.Join("/usr", "share", "cgrates", "tutorial_tests", "kamevapi", "cgrates", "etc", "cgrates"),
Section: config.KamailioAgentJSN,
}, &reply); err != nil {

View File

@@ -65,7 +65,7 @@ func TestRadiusAgentReload(t *testing.T) {
t.Errorf("Expected service to be down")
}
var reply string
if err := cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithOpts{
if err := cfg.V1ReloadConfig(&config.ConfigReloadArgs{
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "radagent_mysql"),
Section: config.RA_JSN,
}, &reply); err != nil {

View File

@@ -86,7 +86,7 @@ func TestRalsReload(t *testing.T) {
t.Errorf("Expected service to be down")
}
var reply string
if err := cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithOpts{
if err := cfg.V1ReloadConfig(&config.ConfigReloadArgs{
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "tutmongo"),
Section: config.RALS_JSN,
}, &reply); err != nil {

View File

@@ -61,7 +61,7 @@ func TestRateSReload(t *testing.T) {
t.Errorf("Expected service to be down")
}
var reply string
if err := cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithOpts{
if err := cfg.V1ReloadConfig(&config.ConfigReloadArgs{
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "rates"),
Section: config.RateSJson,
}, &reply); err != nil {

View File

@@ -71,7 +71,7 @@ func TestResourceSReload(t *testing.T) {
t.Errorf("Expected service to be down")
}
var reply string
if err = cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithOpts{
if err = cfg.V1ReloadConfig(&config.ConfigReloadArgs{
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "tutmongo"),
Section: config.RESOURCES_JSON,
}, &reply); err != nil {

View File

@@ -69,7 +69,7 @@ func TestSupplierSReload(t *testing.T) {
t.Errorf("Expected service to be down")
}
var reply string
if err := cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithOpts{
if err := cfg.V1ReloadConfig(&config.ConfigReloadArgs{
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "tutmongonew"),
Section: config.RouteSJson,
}, &reply); err != nil {

View File

@@ -62,7 +62,7 @@ func TestSchedulerSReload(t *testing.T) {
t.Errorf("Expected service to be down")
}
var reply string
if err := cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithOpts{
if err := cfg.V1ReloadConfig(&config.ConfigReloadArgs{
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "tutmongonew"),
Section: config.SCHEDULER_JSN,
}, &reply); err != nil {

View File

@@ -97,7 +97,7 @@ func TestSessionSReload(t *testing.T) {
t.Errorf("Expected service to be down")
}
var reply string
if err := cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithOpts{
if err := cfg.V1ReloadConfig(&config.ConfigReloadArgs{
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "tutmongonew"),
Section: config.SessionSJson,
}, &reply); err != nil {

View File

@@ -65,7 +65,7 @@ func TestSIPAgentReload(t *testing.T) {
t.Errorf("Expected service to be down")
}
var reply string
if err := cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithOpts{
if err := cfg.V1ReloadConfig(&config.ConfigReloadArgs{
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "sipagent_mysql"),
Section: config.SIPAgentJson,
}, &reply); err != nil {

View File

@@ -71,7 +71,7 @@ func TestStatSReload(t *testing.T) {
t.Errorf("Expected service to be down")
}
var reply string
if err = cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithOpts{
if err = cfg.V1ReloadConfig(&config.ConfigReloadArgs{
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "tutmongo"),
Section: config.STATS_JSON,
}, &reply); err != nil {

View File

@@ -65,7 +65,7 @@ func TestThresholdSReload(t *testing.T) {
t.Errorf("Expected service to be down")
}
var reply string
if err = cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithOpts{
if err = cfg.V1ReloadConfig(&config.ConfigReloadArgs{
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "tutmongo"),
Section: config.THRESHOLDS_JSON,
}, &reply); err != nil {