diff --git a/engine/attributes_test.go b/engine/attributes_test.go
index a5ed2936b..7a53ba365 100644
--- a/engine/attributes_test.go
+++ b/engine/attributes_test.go
@@ -2217,3 +2217,11 @@ func TestAttrSGetAttributeForEventErrs(t *testing.T) {
})
}
}
+
+func TestLibEngineShutdown(t *testing.T) {
+ service := &AttributeService{}
+ err := service.Shutdown()
+ if err != nil {
+ t.Errorf("Expected no error, but got %v", err)
+ }
+}
diff --git a/engine/callcost_test.go b/engine/callcost_test.go
index c38355f21..2c3eb7288 100644
--- a/engine/callcost_test.go
+++ b/engine/callcost_test.go
@@ -327,3 +327,15 @@ func TestCallCostUpdateRatedUsage(t *testing.T) {
t.Error(rcv)
}
}
+
+func TestCallCostSetRpSubjectPrefixMatching(t *testing.T) {
+ SetRpSubjectPrefixMatching(true)
+ if rpSubjectPrefixMatching != true {
+ t.Errorf("Expected rpSubjectPrefixMatching to be true, but got %v", rpSubjectPrefixMatching)
+ SetRpSubjectPrefixMatching(false)
+ if rpSubjectPrefixMatching != false {
+ t.Errorf("Expected rpSubjectPrefixMatching to be false, but got %v", rpSubjectPrefixMatching)
+
+ }
+ }
+}
diff --git a/engine/cdr_test.go b/engine/cdr_test.go
index 71f71742a..cfed96832 100644
--- a/engine/cdr_test.go
+++ b/engine/cdr_test.go
@@ -1637,3 +1637,55 @@ func TestCDRCloneNil(t *testing.T) {
t.Error(rcv)
}
}
+
+func TestTotalExportedCdrs(t *testing.T) {
+ cdre := &CDRExporter{
+ numberOfRecords: 42,
+ }
+ result := cdre.TotalExportedCdrs()
+ if result != 42 {
+ t.Errorf("TotalExportedCdrs() = %d; want 42", result)
+ }
+}
+
+func TestPositiveExports(t *testing.T) {
+ cdre := &CDRExporter{
+ positiveExports: []string{"export1", "export2", "export3"},
+ }
+ result := cdre.PositiveExports()
+ expected := []string{"export1", "export2", "export3"}
+ if len(result) != len(expected) {
+ t.Errorf("PositiveExports() has different length; got %d, want %d", len(result), len(expected))
+ }
+ for i, v := range expected {
+ if result[i] != v {
+ t.Errorf("PositiveExports() = %v; want %v", result, expected)
+ break
+ }
+ }
+}
+
+func TestNegativeExports(t *testing.T) {
+ cdre := &CDRExporter{
+ negativeExports: map[string]string{
+ "cgrid1": "error 1",
+ "cgrid2": "error 2",
+ "cgrid3": "error 3",
+ },
+ }
+ result := cdre.NegativeExports()
+ expected := map[string]string{
+ "cgrid1": "error 1",
+ "cgrid2": "error 2",
+ "cgrid3": "error 3",
+ }
+ if len(result) != len(expected) {
+ t.Errorf("NegativeExports() has different length; got %d, want %d", len(result), len(expected))
+ }
+ for key, value := range expected {
+ if resultValue, exists := result[key]; !exists || resultValue != value {
+ t.Errorf("NegativeExports() = %v; want %v", result, expected)
+ break
+ }
+ }
+}
diff --git a/engine/libengine_test.go b/engine/libengine_test.go
new file mode 100644
index 000000000..acc24a37c
--- /dev/null
+++ b/engine/libengine_test.go
@@ -0,0 +1,49 @@
+/*
+Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
+Copyright (C) ITsysCOM GmbH
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see
+*/
+
+package engine
+
+import (
+ "testing"
+)
+
+func TestNewRPCClientSet(t *testing.T) {
+ tests := []struct {
+ name string
+ clientSet *RPCClientSet
+ }{
+ {
+ name: "default case",
+ clientSet: NewRPCClientSet(),
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+
+ if tt.clientSet == nil {
+ t.Errorf("Expected RPCClientSet to be non-nil")
+ }
+ if tt.clientSet.set == nil {
+ t.Errorf("Expected 'set' map to be initialized, got nil")
+ }
+ if len(tt.clientSet.set) != 0 {
+ t.Errorf("Expected 'set' map to be empty, got %d items", len(tt.clientSet.set))
+ }
+ })
+ }
+}
diff --git a/engine/libtest_test.go b/engine/libtest_test.go
new file mode 100644
index 000000000..90c76625c
--- /dev/null
+++ b/engine/libtest_test.go
@@ -0,0 +1,76 @@
+/*
+Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
+Copyright (C) ITsysCOM GmbH
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see
+*/
+
+package engine
+
+import (
+ "reflect"
+ "testing"
+
+ "github.com/cgrates/cgrates/utils"
+ "github.com/cgrates/ltcache"
+)
+
+func TestGetDefaultEmptyCacheStats(t *testing.T) {
+ expected := map[string]*ltcache.CacheStats{
+ utils.MetaDefault: {Items: 0, Groups: 0},
+ utils.CacheAccountActionPlans: {Items: 0, Groups: 0},
+ utils.CacheActionPlans: {Items: 0, Groups: 0},
+ utils.CacheActionTriggers: {Items: 0, Groups: 0},
+ utils.CacheActions: {Items: 0, Groups: 0},
+ utils.CacheAttributeFilterIndexes: {Items: 0, Groups: 0},
+ utils.CacheAttributeProfiles: {Items: 0, Groups: 0},
+ utils.CacheChargerFilterIndexes: {Items: 0, Groups: 0},
+ utils.CacheChargerProfiles: {Items: 0, Groups: 0},
+ utils.CacheDispatcherFilterIndexes: {Items: 0, Groups: 0},
+ utils.CacheReverseFilterIndexes: {Items: 0, Groups: 0},
+ utils.CacheDispatcherProfiles: {Items: 0, Groups: 0},
+ utils.CacheDispatcherHosts: {Items: 0, Groups: 0},
+ utils.CacheDispatcherRoutes: {Items: 0, Groups: 0},
+ utils.CacheDestinations: {Items: 0, Groups: 0},
+ utils.CacheEventResources: {Items: 0, Groups: 0},
+ utils.CacheFilters: {Items: 0, Groups: 0},
+ utils.CacheRatingPlans: {Items: 0, Groups: 0},
+ utils.CacheRatingProfiles: {Items: 0, Groups: 0},
+ utils.CacheResourceFilterIndexes: {Items: 0, Groups: 0},
+ utils.CacheResourceProfiles: {Items: 0, Groups: 0},
+ utils.CacheResources: {Items: 0, Groups: 0},
+ utils.CacheReverseDestinations: {Items: 0, Groups: 0},
+ utils.CacheRPCResponses: {Items: 0, Groups: 0},
+ utils.CacheSharedGroups: {Items: 0, Groups: 0},
+ utils.CacheStatFilterIndexes: {Items: 0, Groups: 0},
+ utils.CacheStatQueueProfiles: {Items: 0, Groups: 0},
+ utils.CacheStatQueues: {Items: 0, Groups: 0},
+ utils.CacheSupplierFilterIndexes: {Items: 0, Groups: 0},
+ utils.CacheSupplierProfiles: {Items: 0, Groups: 0},
+ utils.CacheThresholdFilterIndexes: {Items: 0, Groups: 0},
+ utils.CacheThresholdProfiles: {Items: 0, Groups: 0},
+ utils.CacheThresholds: {Items: 0, Groups: 0},
+ utils.CacheTimings: {Items: 0, Groups: 0},
+ utils.CacheDiameterMessages: {Items: 0, Groups: 0},
+ utils.CacheClosedSessions: {Items: 0, Groups: 0},
+ utils.CacheLoadIDs: {Items: 0, Groups: 0},
+ utils.CacheRPCConnections: {Items: 0, Groups: 0},
+ utils.CacheCDRIDs: {Items: 0, Groups: 0},
+ utils.CacheRatingProfilesTmp: {Items: 0, Groups: 0},
+ }
+ result := GetDefaultEmptyCacheStats()
+ if !reflect.DeepEqual(result, expected) {
+ t.Errorf("expected %v, got %v", expected, result)
+ }
+}