From 1a19fddda1bdd31616bed291bcb1ca295f24764c Mon Sep 17 00:00:00 2001 From: ionutboangiu Date: Fri, 27 Oct 2023 11:36:49 -0400 Subject: [PATCH] Update failing integration tests due to changes libengine_it_test.go: - handle postgres dbtype as well - after rpcclient update, we receive context deadline exceeded instead of REPLY_TIMEOUT, so the expected value had to be updated. tut_smgeneric_it_test.go - an additional attribute profile has been added to oldtutorial tariffplans, which changed the amount of profiles and indexes existing in the storage when testing. Expected values have been updated. --- general_tests/libengine_it_test.go | 11 ++++++----- general_tests/tut_smgeneric_it_test.go | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/general_tests/libengine_it_test.go b/general_tests/libengine_it_test.go index 5cb40489b..0b009f501 100644 --- a/general_tests/libengine_it_test.go +++ b/general_tests/libengine_it_test.go @@ -21,11 +21,11 @@ along with this program. If not, see package general_tests import ( + "errors" "path" "testing" "time" - "github.com/cgrates/birpc" "github.com/cgrates/birpc/context" "github.com/cgrates/cgrates/config" "github.com/cgrates/cgrates/engine" @@ -35,7 +35,6 @@ import ( var ( libengCfg *config.CGRConfig - libengRpc *birpc.Client libengCfgPath string libengConfigDIR string @@ -57,6 +56,8 @@ func TestLibEngineIT(t *testing.T) { libengConfigDIR = "tutmysql" case utils.MetaMongo: libengConfigDIR = "tutmongo" + case utils.MetaPostgres: + libengConfigDIR = "tutpostgres" default: t.Fatal("Unknown database type") } @@ -120,9 +121,9 @@ func testLibengITRPCConnection(t *testing.T) { t.Error(err) } //We check if we get a reply timeout error when calling a sleep bigger than the reply timeout from connection config. - errExpect := "REPLY_TIMEOUT" - if err := conn.Call(context.Background(), utils.CoreSv1Sleep, args, &reply); err.Error() != errExpect { - t.Errorf("Expected %v \n but received \n %v", errExpect, err.Error()) + if err := conn.Call(context.Background(), utils.CoreSv1Sleep, args, + &reply); !errors.Is(err, context.DeadlineExceeded) { + t.Errorf("expected: %v, received %v", context.DeadlineExceeded, err) } } diff --git a/general_tests/tut_smgeneric_it_test.go b/general_tests/tut_smgeneric_it_test.go index 7bfe05130..907610084 100644 --- a/general_tests/tut_smgeneric_it_test.go +++ b/general_tests/tut_smgeneric_it_test.go @@ -151,7 +151,7 @@ func testTutSMGCacheStats(t *testing.T) { expectedStats[utils.CacheThresholdProfiles].Items = 7 expectedStats[utils.CacheFilters].Items = 15 expectedStats[utils.CacheRouteProfiles].Items = 3 - expectedStats[utils.CacheAttributeProfiles].Items = 2 + expectedStats[utils.CacheAttributeProfiles].Items = 3 expectedStats[utils.MetaDefault].Items = 1 expectedStats[utils.CacheActionTriggers].Items = 1 expectedStats[utils.CacheLoadIDs].Items = 31 @@ -168,8 +168,8 @@ func testTutSMGCacheStats(t *testing.T) { expectedStats[utils.CacheResourceFilterIndexes].Groups = 1 expectedStats[utils.CacheChargerFilterIndexes].Items = 1 expectedStats[utils.CacheChargerFilterIndexes].Groups = 1 - expectedStats[utils.CacheAttributeFilterIndexes].Items = 3 - expectedStats[utils.CacheAttributeFilterIndexes].Groups = 2 + expectedStats[utils.CacheAttributeFilterIndexes].Items = 5 + expectedStats[utils.CacheAttributeFilterIndexes].Groups = 3 expectedStats[utils.CacheReverseFilterIndexes].Items = 15 expectedStats[utils.CacheReverseFilterIndexes].Groups = 13 if err := tutSMGRpc.Call(context.Background(), utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithAPIOpts), &rcvStats); err != nil {