fixing tests for ees

This commit is contained in:
gezimbll
2023-08-01 09:00:00 -04:00
committed by Dan Christian Bogos
parent 16238fb3cb
commit 990feb0f26
4 changed files with 18 additions and 6 deletions

View File

@@ -215,6 +215,11 @@ func TestCacheJsonCfg(t *testing.T) {
Ttl: utils.StringPointer(""), Static_ttl: utils.BoolPointer(false),
Remote: utils.BoolPointer(false), Replicate: utils.BoolPointer(false),
},
utils.MetaSentryPeer: {
Limit: utils.IntPointer(-1),
Ttl: utils.StringPointer("24h"), Static_ttl: utils.BoolPointer(true),
Remote: utils.BoolPointer(false), Replicate: utils.BoolPointer(false),
},
utils.MetaAPIBan: {Limit: utils.IntPointer(-1),
Ttl: utils.StringPointer("2m"), Static_ttl: utils.BoolPointer(false),
Remote: utils.BoolPointer(false), Replicate: utils.BoolPointer(false)},

File diff suppressed because one or more lines are too long

View File

@@ -47,9 +47,13 @@ func TestInitClient(t *testing.T) {
ee := &ElasticEE{
cfg: &config.EventExporterCfg{
ExportPath: "/\x00",
Opts: &config.EventExporterOpts{},
},
}
errExpect := `cannot create client: parse "/\x00": net/url: invalid control character in URL`
if err := ee.prepareOpts(); err != nil {
t.Error(err)
}
errExpect := `cannot create client: cannot parse url: parse "/\x00": net/url: invalid control character in URL`
if err := ee.Connect(); err == nil || err.Error() != errExpect {
t.Errorf("Expected %+v \n but got %+v", errExpect, err)
}
@@ -293,9 +297,10 @@ func TestElasticExportEvent3(t *testing.T) {
t.Error(err)
}
eEe.eClnt.Transport = new(mockClient)
// errExpect := `unsupported protocol scheme ""`
errExpect := `the client noticed that the server is not Elasticsearch and we do not support this unknown product`
cgrCfg.EEsCfg().Exporters[0].ComputeFields()
if err := eEe.ExportEvent(context.Background(), []byte{}, ""); err != nil {
if err := eEe.ExportEvent(context.Background(), []byte{}, ""); err == nil || err.Error() != errExpect {
t.Error(err)
}
}

View File

@@ -32,7 +32,7 @@ var (
extraDBPartition = NewStringSet([]string{CacheDispatchers,
CacheDispatcherRoutes, CacheDispatcherLoads, CacheDiameterMessages, CacheRPCResponses, CacheClosedSessions,
CacheCDRIDs, CacheRPCConnections, CacheUCH, CacheSTIR, CacheEventCharges, MetaAPIBan,
CacheCDRIDs, CacheRPCConnections, CacheUCH, CacheSTIR, CacheEventCharges, MetaAPIBan, MetaSentryPeer,
CacheCapsEvents, CacheReplicationHosts})
DataDBPartitions = NewStringSet([]string{