Update unit test to pass with go 1.15

This commit is contained in:
TeoV
2020-08-21 12:30:55 +03:00
committed by Dan Christian Bogos
parent 2fba6b21da
commit 4cd252f027
5 changed files with 9 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
language: go
go:
- 1.14
- 1.15
script: go test -v ./...

2
go.mod
View File

@@ -1,6 +1,6 @@
module github.com/cgrates/cgrates
go 1.14
go 1.15
// replace github.com/cgrates/radigo => /home/dan/go/src/github.com/cgrates/radigo
// replace github.com/cgrates/rpcclient => ../rpcclient

View File

@@ -111,7 +111,7 @@ func TestNewRateSlot(t *testing.T) {
eOut.RateUnit = "a"
rcv, err = NewRateSlot(eOut.ConnectFee, eOut.Rate, eOut.RateUnit, eOut.RateIncrement, eOut.GroupIntervalStart)
//must receive from time an error: "invalid duration a"
if err == nil || err.Error() != "time: invalid duration a" {
if err == nil || err.Error() != "time: invalid duration \"a\"" {
t.Error(err)
}
}
@@ -128,19 +128,19 @@ func TestSetDurations(t *testing.T) {
}
rs.RateUnit = "a"
//at RateUnit if, must receive from time an error: "invalid duration a"
if err := rs.SetDurations(); err == nil || err.Error() != "time: invalid duration a" {
if err := rs.SetDurations(); err == nil || err.Error() != "time: invalid duration \"a\"" {
t.Error(err)
}
rs.RateUnit = "1"
rs.RateIncrement = "a"
//at RateIncrement, must receive from time an error: "invalid duration a"
if err := rs.SetDurations(); err == nil || err.Error() != "time: invalid duration a" {
if err := rs.SetDurations(); err == nil || err.Error() != "time: invalid duration \"a\"" {
t.Error(err)
}
rs.RateIncrement = "1"
rs.GroupIntervalStart = "a"
//at GroupIntervalStart, must receive from time an error: "invalid duration a"
if err := rs.SetDurations(); err == nil || err.Error() != "time: invalid duration a" {
if err := rs.SetDurations(); err == nil || err.Error() != "time: invalid duration \"a\"" {
t.Error(err)
}
}

View File

@@ -145,7 +145,7 @@ func TestVerifyCredential(t *testing.T) {
{"foo", "bar", map[string]string{"test": "1234", "foo": hashedPasswords["bar"]}, true},
{"foo", "1234", map[string]string{"test": "1234", "foo": hashedPasswords["bar"]}, false},
{"none", "1234", map[string]string{"test": "1234", "foo": hashedPasswords["bar"]}, false},
{"test", "1234", map[string]string{"test": "1234" + string(0), "foo": hashedPasswords["bar"]}, false},
{"test", "1234", map[string]string{"test": "12340", "foo": hashedPasswords["bar"]}, false},
}
for _, tt := range verifyCredentialTests {

View File

@@ -170,14 +170,14 @@ func TestNewDurationSecondsConverter(t *testing.T) {
func TestDurationSecondsConverterConvert(t *testing.T) {
mS := &DurationSecondsConverter{}
if _, err := mS.Convert("string"); err.Error() != "time: invalid duration string" {
if _, err := mS.Convert("string"); err.Error() != "time: invalid duration \"string\"" {
t.Error(err)
}
}
func TestDurationNanosecondsConverterConvert(t *testing.T) {
nS := &DurationNanosecondsConverter{}
if _, err := nS.Convert("string"); err.Error() != "time: invalid duration string" {
if _, err := nS.Convert("string"); err.Error() != "time: invalid duration \"string\"" {
t.Error(err)
}
}