More fixed tests in services

This commit is contained in:
andronache
2020-12-21 17:08:46 +02:00
committed by Dan Christian Bogos
parent 586650811c
commit f12c620f94
6 changed files with 69 additions and 12 deletions

View File

@@ -43,13 +43,14 @@ func TestDNSAgentCoverage(t *testing.T) {
if srv.IsRunning() {
t.Errorf("Expected service to be down")
}
dns, _ := agents.NewDNSAgent(cfg, &engine.FilterS{}, nil)
srv2 := DNSAgent{
cfg: cfg,
filterSChan: filterSChan,
shdChan: shdChan,
connMgr: nil,
srvDep: srvDep,
dns: &agents.DNSAgent{},
dns: dns,
}
if !srv2.IsRunning() {
@@ -59,5 +60,17 @@ func TestDNSAgentCoverage(t *testing.T) {
if err == nil || err != utils.ErrServiceAlreadyRunning {
t.Errorf("\nExpecting <%+v>,\n Received <%+v>", utils.ErrServiceAlreadyRunning, err)
}
serviceName := srv2.ServiceName()
if serviceName != utils.DNSAgent {
t.Errorf("\nExpecting <%+v>,\n Received <%+v>", utils.DNSAgent, serviceName)
}
shouldRun := srv2.ShouldRun()
if shouldRun != false {
t.Errorf("\nExpecting <%+v>,\n Received <%+v>", false, shouldRun)
}
srv2.Reload()
srv2.Shutdown()
if srv.IsRunning() {
t.Errorf("Expected service to be down")
}
}

View File

@@ -17,7 +17,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package services
/*
import (
"reflect"
"testing"
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/utils"
)
func TestGlobalVarS(t *testing.T) {
cfg := config.NewDefaultCGRConfig()
@@ -45,4 +52,3 @@ func TestGlobalVarS(t *testing.T) {
t.Fatal(err)
}
}
*/

View File

@@ -17,7 +17,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package services
/*
import (
"reflect"
"sync"
"testing"
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/cores"
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/rpcclient"
)
//TestHTTPAgent for cover testing
func TestHTTPAgentCoverage(t *testing.T) {
cfg := config.NewDefaultCGRConfig()
@@ -69,4 +80,3 @@ func TestHTTPAgentCoverage(t *testing.T) {
t.Errorf("Expected service to be down")
}
}
*/

View File

@@ -17,7 +17,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package services
/*
import (
"reflect"
"sync"
"testing"
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/cores"
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/loaders"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/rpcclient"
)
//TestLoaderSCoverage for cover testing
func TestLoaderSCoverage(t *testing.T) {
cfg := config.NewDefaultCGRConfig()
@@ -57,4 +69,3 @@ func TestLoaderSCoverage(t *testing.T) {
}
}
*/

View File

@@ -17,7 +17,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package services
/*
import (
"reflect"
"sync"
"testing"
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/cores"
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/rpcclient"
)
//TestResponderCoverage for cover testing
func TestResponderCoverage(t *testing.T) {
cfg := config.NewDefaultCGRConfig()
@@ -58,4 +69,3 @@ func TestResponderCoverage(t *testing.T) {
t.Errorf("\nExpecting <%+v>,\n Received <%+v>", false, shouldRun)
}
}
*/

View File

@@ -17,7 +17,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package services
/*
import (
"sync"
"testing"
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
//TestStorDBServiceCoverage for cover testing
func TestStorDBServiceCoverage(t *testing.T) {
cfg := config.NewDefaultCGRConfig()
@@ -49,4 +57,3 @@ func TestStorDBServiceCoverage(t *testing.T) {
t.Errorf("\nExpecting <Error 1045: Access denied for user 'cgrates'@'localhost' (using password: NO)>,\n Received <%+v>", err2)
}
}
*/