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.
This commit is contained in:
ionutboangiu
2023-10-27 11:36:49 -04:00
committed by Dan Christian Bogos
parent 88f31c189d
commit 1a19fddda1
2 changed files with 9 additions and 8 deletions

View File

@@ -21,11 +21,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
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)
}
}

View File

@@ -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 {