From 83dd4efeab8c1ba99e20a73af68e355d44b200eb Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Thu, 27 Feb 2014 09:34:48 +0200 Subject: [PATCH] more aliases tests --- engine/loader_csv_test.go | 13 +++++++++++++ engine/storage_test.go | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/engine/loader_csv_test.go b/engine/loader_csv_test.go index d28b2fa10..d2e27c23b 100644 --- a/engine/loader_csv_test.go +++ b/engine/loader_csv_test.go @@ -741,6 +741,19 @@ func TestLoadAccountActions(t *testing.T) { } } +func TestLoadAliases(t *testing.T) { + if len(csvr.aliases) != 5 { + t.Error("Failed to load aliases: ", csvr.aliases) + } + if csvr.aliases[RATING_PROFILE_PREFIX+"a1"] != "minu" || + csvr.aliases[RATING_PROFILE_PREFIX+"a2"] != "minu" || + csvr.aliases[RATING_PROFILE_PREFIX+"a3"] != "minu" || + csvr.aliases[ACCOUNT_PREFIX+"a1"] != "minitsboy" || + csvr.aliases[ACCOUNT_PREFIX+"a2"] != "minitsboy" { + t.Error("Error loading aliases: ", csvr.aliases) + } +} + /* vdf,minitsboy,*out,MORE_MINUTES,STANDARD_TRIGGER */ diff --git a/engine/storage_test.go b/engine/storage_test.go index 026ebbe3f..857bde3ae 100644 --- a/engine/storage_test.go +++ b/engine/storage_test.go @@ -21,6 +21,8 @@ package engine import ( "testing" "time" + + "github.com/cgrates/cgrates/cache2go" ) func TestMsgpackStructsAdded(t *testing.T) { @@ -107,6 +109,12 @@ func TestCacheRefresh(t *testing.T) { } } +func TestCacheAliases(t *testing.T) { + if subj, err := cache2go.GetCached(ALIAS_PREFIX + RATING_PROFILE_PREFIX + "a3"); err != nil || subj != "minu" { + t.Error("Error caching alias: ", subj, err) + } +} + // Install fails to detect them and starting server will panic, these tests will fix this func TestStoreInterfaces(t *testing.T) { rds := new(RedisStorage)