mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-12 18:46:24 +05:00
Add skel for HTTP EventExporter tests
This commit is contained in:
committed by
Dan Christian Bogos
parent
1302ffb8fe
commit
d8ecd904a8
@@ -54,7 +54,7 @@ var (
|
||||
testCsvVerifyExports,
|
||||
testCsvExportComposedEvent,
|
||||
testCsvVerifyComposedExports,
|
||||
testCsvStopCgrEngine,
|
||||
testStopCgrEngine,
|
||||
testCleanDirectory,
|
||||
}
|
||||
)
|
||||
@@ -326,9 +326,3 @@ func testCsvVerifyComposedExports(t *testing.T) {
|
||||
t.Errorf("Expecting: \n<%q>, \nreceived: \n<%q>", eCnt, string(outContent1))
|
||||
}
|
||||
}
|
||||
|
||||
func testCsvStopCgrEngine(t *testing.T) {
|
||||
if err := engine.KillEngine(100); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ var (
|
||||
testFwvRPCConn,
|
||||
testFwvExportEvent,
|
||||
testFwvVerifyExports,
|
||||
testFwvStopCgrEngine,
|
||||
testStopCgrEngine,
|
||||
testCleanDirectory,
|
||||
}
|
||||
)
|
||||
@@ -156,9 +156,3 @@ func testFwvVerifyExports(t *testing.T) {
|
||||
t.Errorf("Expecting: <%+v>, received: <%+v>", len(eHdr+eTrl+eCnt), len(outContent1))
|
||||
}
|
||||
}
|
||||
|
||||
func testFwvStopCgrEngine(t *testing.T) {
|
||||
if err := engine.KillEngine(100); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
88
ees/httpjsonmap_it_test.go
Normal file
88
ees/httpjsonmap_it_test.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// +build integration
|
||||
|
||||
/*
|
||||
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
|
||||
Copyright (C) ITsysCOM GmbH
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package ees
|
||||
|
||||
import (
|
||||
"net/rpc"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
)
|
||||
|
||||
var (
|
||||
httpJSONMapConfigDir string
|
||||
httpJSONMapCfgPath string
|
||||
httpJSONMapCfg *config.CGRConfig
|
||||
httpJSONMapRpc *rpc.Client
|
||||
|
||||
sTestsHTTPJsonMap = []func(t *testing.T){
|
||||
testHTTPJsonMapLoadConfig,
|
||||
testHTTPJsonMapResetDataDB,
|
||||
testHTTPJsonMapResetStorDb,
|
||||
testHTTPJsonMapStartEngine,
|
||||
testHTTPJsonMapRPCConn,
|
||||
|
||||
testStopCgrEngine,
|
||||
}
|
||||
)
|
||||
|
||||
func TestHTTPJsonMapExport(t *testing.T) {
|
||||
httpJSONMapConfigDir = "ees"
|
||||
for _, stest := range sTestsHTTPJsonMap {
|
||||
t.Run(httpJSONMapConfigDir, stest)
|
||||
}
|
||||
}
|
||||
|
||||
func testHTTPJsonMapLoadConfig(t *testing.T) {
|
||||
var err error
|
||||
httpJSONMapCfgPath = path.Join(*dataDir, "conf", "samples", httpJSONMapConfigDir)
|
||||
if httpJSONMapCfg, err = config.NewCGRConfigFromPath(httpJSONMapCfgPath); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func testHTTPJsonMapResetDataDB(t *testing.T) {
|
||||
if err := engine.InitDataDb(httpJSONMapCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func testHTTPJsonMapResetStorDb(t *testing.T) {
|
||||
if err := engine.InitStorDb(httpJSONMapCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func testHTTPJsonMapStartEngine(t *testing.T) {
|
||||
if _, err := engine.StopStartEngine(httpJSONMapCfgPath, *waitRater); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func testHTTPJsonMapRPCConn(t *testing.T) {
|
||||
var err error
|
||||
httpJSONMapRpc, err = newRPCClient(httpJSONMapCfg.ListenCfg())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
88
ees/httppost_it_test.go
Normal file
88
ees/httppost_it_test.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// +build integration
|
||||
|
||||
/*
|
||||
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
|
||||
Copyright (C) ITsysCOM GmbH
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package ees
|
||||
|
||||
import (
|
||||
"net/rpc"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
)
|
||||
|
||||
var (
|
||||
httpPostConfigDir string
|
||||
httpPostCfgPath string
|
||||
httpPostCfg *config.CGRConfig
|
||||
httpPostRpc *rpc.Client
|
||||
|
||||
sTestsHTTPPost = []func(t *testing.T){
|
||||
testHTTPPostLoadConfig,
|
||||
testHTTPPostResetDataDB,
|
||||
testHTTPPostResetStorDb,
|
||||
testHTTPPostStartEngine,
|
||||
testHTTPPostRPCConn,
|
||||
|
||||
testStopCgrEngine,
|
||||
}
|
||||
)
|
||||
|
||||
func TestHTTPPostExport(t *testing.T) {
|
||||
httpPostConfigDir = "ees"
|
||||
for _, stest := range sTestsHTTPPost {
|
||||
t.Run(httpPostConfigDir, stest)
|
||||
}
|
||||
}
|
||||
|
||||
func testHTTPPostLoadConfig(t *testing.T) {
|
||||
var err error
|
||||
httpPostCfgPath = path.Join(*dataDir, "conf", "samples", httpPostConfigDir)
|
||||
if httpPostCfg, err = config.NewCGRConfigFromPath(httpPostCfgPath); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func testHTTPPostResetDataDB(t *testing.T) {
|
||||
if err := engine.InitDataDb(httpPostCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func testHTTPPostResetStorDb(t *testing.T) {
|
||||
if err := engine.InitStorDb(httpPostCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func testHTTPPostStartEngine(t *testing.T) {
|
||||
if _, err := engine.StopStartEngine(httpPostCfgPath, *waitRater); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func testHTTPPostRPCConn(t *testing.T) {
|
||||
var err error
|
||||
httpPostRpc, err = newRPCClient(httpPostCfg.ListenCfg())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,8 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
@@ -67,3 +69,9 @@ func testCleanDirectory(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testStopCgrEngine(t *testing.T) {
|
||||
if err := engine.KillEngine(100); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user