mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-21 23:28:44 +05:00
Cover the remainder of engine/destinations.go
This commit is contained in:
committed by
Dan Christian Bogos
parent
65bf6eeb2c
commit
7a71b07223
@@ -126,6 +126,28 @@ func TestDestinationNonCachedDestWrongPrefix(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDestinationcontainsPrefixNilDestination(t *testing.T) {
|
||||
var d *Destination
|
||||
rcv := d.containsPrefix("prefix")
|
||||
if rcv != 0 {
|
||||
t.Errorf("\nexpected: <%+v>, \nreceived: <%+v>", 0, rcv)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDestinationString(t *testing.T) {
|
||||
d := &Destination{
|
||||
Id: "ID",
|
||||
Prefixes: []string{"prefix1", "prefix2", "prefix3"},
|
||||
}
|
||||
|
||||
exp := "ID: prefix1, prefix2, prefix3"
|
||||
rcv := d.String()
|
||||
|
||||
if rcv != exp {
|
||||
t.Errorf("\nexpected: <%+v>, \nreceived: <%+v>", exp, rcv)
|
||||
}
|
||||
}
|
||||
|
||||
/********************************* Benchmarks **********************************/
|
||||
|
||||
func BenchmarkDestinationStorageStoreRestore(b *testing.B) {
|
||||
|
||||
@@ -302,10 +302,15 @@ func TestVersionCheckVersionsCompareNonNilMsg(t *testing.T) {
|
||||
testcase: "Compare returns non-nil message",
|
||||
}
|
||||
|
||||
experr := fmt.Sprintf("Migration needed: please backup cgr data and run : <%s>", "cgr-migrator -exec=*cost_details")
|
||||
experr1 := fmt.Sprintf("Migration needed: please backup cgr data and run : <%s>", "cgr-migrator -exec=*cost_details")
|
||||
experr2 := fmt.Sprintf("Migration needed: please backup cgr data and run : <%s>", "cgr-migrator -exec=*sessions_costs")
|
||||
err := CheckVersions(storage)
|
||||
|
||||
if err == nil || err.Error() != experr {
|
||||
t.Errorf("\nexpected: <%+v>, \nreceived: <%+v>", experr, err)
|
||||
if err == nil || (err.Error() != experr1 && err.Error() != experr2) {
|
||||
if err.Error() == experr1 {
|
||||
t.Errorf("\nexpected: <%+v>, \nreceived: <%+v>", experr1, err)
|
||||
} else {
|
||||
t.Errorf("\nexpected: <%+v>, \nreceived: <%+v>", experr2, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user