From e537659f0eec83abd9f4e24564d37e09f0dbc7bc Mon Sep 17 00:00:00 2001 From: DanB Date: Sun, 1 May 2016 19:30:14 +0200 Subject: [PATCH] Check CDRs in CDR .csv test --- cdrc/csv_it_test.go | 17 ++++++++++++++--- data/conf/samples/cdrccsv/cgrates.json | 4 ++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/cdrc/csv_it_test.go b/cdrc/csv_it_test.go index ea2491e05..f43cef288 100644 --- a/cdrc/csv_it_test.go +++ b/cdrc/csv_it_test.go @@ -30,6 +30,7 @@ import ( "github.com/cgrates/cgrates/config" "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" ) /* @@ -86,7 +87,6 @@ func TestCsvITInitCdrDb(t *testing.T) { } } -/* func TestCsvITCreateCdrDirs(t *testing.T) { if !*testIT { return @@ -105,7 +105,6 @@ func TestCsvITCreateCdrDirs(t *testing.T) { } } - func TestCsvITStartEngine(t *testing.T) { if !*testIT { return @@ -114,7 +113,6 @@ func TestCsvITStartEngine(t *testing.T) { t.Fatal(err) } } -*/ // Connect rpc client to rater func TestCsvITRpcConn(t *testing.T) { @@ -175,6 +173,19 @@ func TestCsvITProcessedFiles(t *testing.T) { } } +func TestCsvITAnalyseCDRs(t *testing.T) { + if !*testIT { + return + } + var reply []*engine.ExternalCDR + req := utils.RPCCDRsFilter{} + if err := cdrcRpc.Call("ApierV2.GetCdrs", req, &reply); err != nil { + t.Error("Unexpected error: ", err.Error()) + } else if len(reply) != 6 { // 1 injected, 1 rated, 1 *raw and it's pair in *default run + t.Error("Unexpected number of CDRs returned: ", len(reply)) + } +} + func TestCsvITKillEngine(t *testing.T) { if !*testIT { return diff --git a/data/conf/samples/cdrccsv/cgrates.json b/data/conf/samples/cdrccsv/cgrates.json index 91c0ca30a..7793ec97b 100644 --- a/data/conf/samples/cdrccsv/cgrates.json +++ b/data/conf/samples/cdrccsv/cgrates.json @@ -7,6 +7,10 @@ // This is what you get when you load CGRateS with an empty configuration file. + "rals": { + "enabled": true // so we can query CDRs + }, + "cdrs": { "enabled": true, "rals_conns": [], // no rating support, just *raw CDR testing