From b7aa3fd13c0e7cddec9a69045ba41f1d0b431318 Mon Sep 17 00:00:00 2001 From: TeoV Date: Thu, 15 Oct 2020 18:08:12 +0300 Subject: [PATCH] Update config name for redis_tls --- .../{tutredis_tls => redis_tls}/cgrates.json | 0 general_tests/redis_tls_it_test.go | 52 ++++--------------- 2 files changed, 9 insertions(+), 43 deletions(-) rename data/conf/samples/{tutredis_tls => redis_tls}/cgrates.json (100%) diff --git a/data/conf/samples/tutredis_tls/cgrates.json b/data/conf/samples/redis_tls/cgrates.json similarity index 100% rename from data/conf/samples/tutredis_tls/cgrates.json rename to data/conf/samples/redis_tls/cgrates.json diff --git a/general_tests/redis_tls_it_test.go b/general_tests/redis_tls_it_test.go index 9691a4702..c334bc5a2 100644 --- a/general_tests/redis_tls_it_test.go +++ b/general_tests/redis_tls_it_test.go @@ -25,18 +25,18 @@ import ( "net/rpc" "os/exec" "path" - "reflect" "testing" + "github.com/cgrates/cgrates/utils" + "github.com/cgrates/cgrates/config" "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" ) var ( redisTLS = flag.Bool("redis_tls", false, "Run tests with redis tls") redisTLSServer *exec.Cmd - redisTLSEngineCfg = path.Join(*dataDir, "conf", "samples", "tutredis_tls") + redisTLSEngineCfg = path.Join(*dataDir, "conf", "samples", "redis_tls") redisTLSCfg *config.CGRConfig redisTLSRPC *rpc.Client @@ -57,15 +57,6 @@ func TestRedisTLS(t *testing.T) { if !*redisTLS { return } - switch *dbType { - case utils.MetaMySQL: - case utils.MetaInternal, - utils.MetaMongo, - utils.MetaPostgres: - t.SkipNow() - default: - t.Fatal("Unknown Database type") - } for _, stest := range sTestsRedisTLS { t.Run("TestRedisTLS", stest) } @@ -113,43 +104,18 @@ func testRedisTLSRPCCon(t *testing.T) { } func testRedisTLSSetGetAttribute(t *testing.T) { - alsPrf := &engine.AttributeProfile{ - Tenant: "cgrates.org", - ID: "ApierTest", - Contexts: []string{utils.MetaSessionS, utils.MetaCDRs}, - FilterIDs: []string{"*string:~*req.Account:1001"}, - Attributes: []*engine.Attribute{ - { - Path: utils.MetaReq + utils.NestingSep + utils.Subject, - Value: config.NewRSRParsersMustCompile("1001", utils.INFIELD_SEP), - }, - }, - Weight: 20, - } - alsPrf.Compile() - var result string - if err := redisTLSRPC.Call(utils.APIerSv1SetAttributeProfile, alsPrf, &result); err != nil { + // status command to check if the engine starts + var rply map[string]interface{} + if err := redisTLSRPC.Call(utils.CoreSv1Status, &utils.TenantWithOpts{}, &rply); err != nil { t.Error(err) - } else if result != utils.OK { - t.Error("Unexpected reply returned", result) - } - var reply *engine.AttributeProfile - if err := redisTLSRPC.Call(utils.APIerSv1GetAttributeProfile, - &utils.TenantID{Tenant: "cgrates.org", ID: "ApierTest"}, &reply); err != nil { - t.Fatal(err) - } - reply.Compile() - if !reflect.DeepEqual(alsPrf, reply) { - t.Errorf("Expecting : %+v, received: %+v", alsPrf, reply) } } func testRedisTLSKillEngine(t *testing.T) { - if err := exec.Command("pkill", "redis-server").Run(); err != nil { - t.Error(err) - } - if err := engine.KillEngine(2000); err != nil { t.Error(err) } + if err := exec.Command("pkill", "redis-server").Run(); err != nil { + t.Error(err) + } }