mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Update test for go 1.10 and update travis to run on go 1.10
This commit is contained in:
committed by
Dan Christian Bogos
parent
3e15ab12ef
commit
6f4a0025dd
@@ -1,7 +1,7 @@
|
||||
language: go
|
||||
|
||||
go:
|
||||
- 1.9
|
||||
- 1.10
|
||||
|
||||
install:
|
||||
- go get github.com/Masterminds/glide
|
||||
|
||||
@@ -160,7 +160,7 @@ func (sm *FSsessions) onChannelPark(fsev FSEvent, connId string) {
|
||||
}
|
||||
if authArgs.AuthorizeResources {
|
||||
if _, err := sm.conns[connId].SendApiCmd(fmt.Sprintf("uuid_setvar %s %s %s\n\n",
|
||||
fsev.GetUUID(), CGRResourceAllocation, authReply.ResourceAllocation)); err != nil {
|
||||
fsev.GetUUID(), CGRResourceAllocation, *authReply.ResourceAllocation)); err != nil {
|
||||
utils.Logger.Info(
|
||||
fmt.Sprintf("<%s> error %s setting channel variabile: %s",
|
||||
utils.FreeSWITCHAgent, err.Error(), CGRResourceAllocation))
|
||||
|
||||
@@ -167,7 +167,7 @@ func (ra *RadiusAgent) processRequest(reqProcessor *config.RARequestProcessor,
|
||||
return false, err
|
||||
}
|
||||
if reqProcessor.DryRun {
|
||||
utils.Logger.Info(fmt.Sprintf("<%s> DRY_RUN, CGREvent: %s", utils.ToJSON(cgrEv)))
|
||||
utils.Logger.Info(fmt.Sprintf("<%s> DRY_RUN, CGREvent: %s",utils.RadiusAgent, utils.ToJSON(cgrEv)))
|
||||
} else { // process with RPC
|
||||
switch procVars[MetaRadReqType] {
|
||||
case MetaRadAuth:
|
||||
@@ -215,7 +215,7 @@ func (ra *RadiusAgent) processRequest(reqProcessor *config.RARequestProcessor,
|
||||
return false, err
|
||||
}
|
||||
if reqProcessor.DryRun {
|
||||
utils.Logger.Info(fmt.Sprintf("<RadiusAgent> DRY_RUN, radius reply: %s", reply))
|
||||
utils.Logger.Info(fmt.Sprintf("<RadiusAgent> DRY_RUN, radius reply: %+v", reply))
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
2
cache/cache.go
vendored
2
cache/cache.go
vendored
@@ -168,7 +168,7 @@ func GetCloned(key string) (cln interface{}, err error) {
|
||||
if !hasIt {
|
||||
return nil, utils.NewCGRError(utils.Cache,
|
||||
utils.NotFoundCaps, utils.ItemNotFound,
|
||||
fmt.Sprintf("item with key <%s> was not found in <%s>", key))
|
||||
fmt.Sprintf("item with key <%s> was not found in <%s>", key,cln))
|
||||
} else if origVal == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -503,7 +503,7 @@ func (self *CdrServer) replicateCDRs(cdrs []*CDR) (err error) {
|
||||
continue
|
||||
}
|
||||
if err = cdre.ExportCDRs(); err != nil {
|
||||
utils.Logger.Err(fmt.Sprintf("<CDRS> Replicating CDR: %+v, got error: <%s>", err.Error()))
|
||||
utils.Logger.Err(fmt.Sprintf("<CDRS> Replicating CDR: %+v, got error: <%s>",cdrs, err.Error()))
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
@@ -620,7 +620,7 @@ func TestNewEventCostFromCallCost(t *testing.T) {
|
||||
if cc.Timespans[i].RateInterval.Rating != nil &&
|
||||
!reflect.DeepEqual(cc.Timespans[i].RateInterval.Rating.Rates,
|
||||
ec.Rates[ec.Rating[ec.Charges[i].RatingID].RatesID]) {
|
||||
t.Errorf("Index: %d, expecting: %s, received: %s",
|
||||
t.Errorf("Index: %d, expecting: %+v, received: %+v",
|
||||
i, utils.ToJSON(cc.Timespans[i].RateInterval.Rating.Rates),
|
||||
ec.Rates[ec.Rating[ec.Charges[i].RatingID].RatesID])
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ func TestLcrRequestAsCallDescriptor(t *testing.T) {
|
||||
callDur := time.Duration(1) * time.Minute
|
||||
lcrReq := &LcrRequest{Account: "2001", SetupTime: sTime.String()}
|
||||
if _, err := lcrReq.AsCallDescriptor(""); err == nil || err != utils.ErrMandatoryIeMissing {
|
||||
t.Error("Unexpected error received: %v", err)
|
||||
t.Errorf("Unexpected error received: %v", err)
|
||||
}
|
||||
lcrReq = &LcrRequest{Account: "2001", Destination: "2002", SetupTime: sTime.String()}
|
||||
eCd := &CallDescriptor{
|
||||
|
||||
@@ -95,7 +95,7 @@ func StartEngine(cfgPath string, waitEngine int) (*exec.Cmd, error) {
|
||||
}
|
||||
}
|
||||
if !connected {
|
||||
return nil, fmt.Errorf("engine did not open port <%d>", cfg.RPCJSONListen)
|
||||
return nil, fmt.Errorf("engine did not open port <%s>", cfg.RPCJSONListen)
|
||||
}
|
||||
return engine, nil
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ func (spS *SupplierService) costForEvent(ev *utils.CGREvent,
|
||||
if maxDur, err := cd.GetMaxSessionDuration(); err != nil {
|
||||
utils.Logger.Warning(
|
||||
fmt.Sprintf("<%s> ignoring cost for account: %s, err: %s",
|
||||
anctID, err.Error()))
|
||||
utils.SupplierS,anctID, err.Error()))
|
||||
} else if maxDur >= usage {
|
||||
return map[string]interface{}{
|
||||
utils.Cost: 0.0,
|
||||
|
||||
@@ -69,18 +69,18 @@ func TestCGRReplyGetFieldAsString(t *testing.T) {
|
||||
if strVal, err := cgrRply.GetFieldAsString("*cgrReply>Error", ">"); err != nil {
|
||||
t.Error(err)
|
||||
} else if strVal != "" {
|
||||
t.Error("received: <%s>", strVal)
|
||||
t.Errorf("received: <%s>", strVal)
|
||||
}
|
||||
eVal := "Val1"
|
||||
if strVal, err := cgrRply.GetFieldAsString("*cgrReply>FirstLevel>SecondLevel>ThirdLevel>Fld1", ">"); err != nil {
|
||||
t.Error(err)
|
||||
} else if strVal != eVal {
|
||||
t.Error("expecting: <%s> received: <%s>", eVal, strVal)
|
||||
t.Errorf("expecting: <%s> received: <%s>", eVal, strVal)
|
||||
}
|
||||
eVal = "ValAnotherFirstLevel"
|
||||
if strVal, err := cgrRply.GetFieldAsString("*cgrReply>AnotherFirstLevel", ">"); err != nil {
|
||||
t.Error(err)
|
||||
} else if strVal != eVal {
|
||||
t.Error("expecting: <%s> received: <%s>", eVal, strVal)
|
||||
t.Errorf("expecting: <%s> received: <%s>", eVal, strVal)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ func TestNewDerivedCharger(t *testing.T) {
|
||||
}
|
||||
if dc1, err := NewDerivedCharger("test1", "", "reqtype1", "direction1", "tenant1", "tor1", "account1", "subject1", "destination1",
|
||||
"setuptime1", "pdd1", "answertime1", "duration1", "supplier1", "NORMAL_CLEARING", "rated1", "cost1"); err != nil {
|
||||
t.Error("Unexpected error", err.Error)
|
||||
t.Error("Unexpected error", err.Error())
|
||||
} else if !reflect.DeepEqual(edc1, dc1) {
|
||||
t.Errorf("Expecting: %v, received: %v", edc1, dc1)
|
||||
}
|
||||
|
||||
@@ -34,42 +34,42 @@ func TestReflectFieldAsStringOnStruct(t *testing.T) {
|
||||
if strVal, err := ReflectFieldAsString(mystruct, "Title", "ExtraFields"); err != nil {
|
||||
t.Error(err)
|
||||
} else if strVal != "Title1" {
|
||||
t.Error("Received: %s", strVal)
|
||||
t.Errorf("Received: %s", strVal)
|
||||
}
|
||||
if strVal, err := ReflectFieldAsString(mystruct, "Count", "ExtraFields"); err != nil {
|
||||
t.Error(err)
|
||||
} else if strVal != "5" {
|
||||
t.Error("Received: %s", strVal)
|
||||
t.Errorf("Received: %s", strVal)
|
||||
}
|
||||
if strVal, err := ReflectFieldAsString(mystruct, "Count64", "ExtraFields"); err != nil {
|
||||
t.Error(err)
|
||||
} else if strVal != "6" {
|
||||
t.Error("Received: %s", strVal)
|
||||
t.Errorf("Received: %s", strVal)
|
||||
}
|
||||
if strVal, err := ReflectFieldAsString(mystruct, "Val", "ExtraFields"); err != nil {
|
||||
t.Error(err)
|
||||
} else if strVal != "7.3" {
|
||||
t.Error("Received: %s", strVal)
|
||||
t.Errorf("Received: %s", strVal)
|
||||
}
|
||||
if strVal, err := ReflectFieldAsString(mystruct, "a", "ExtraFields"); err != nil {
|
||||
t.Error(err)
|
||||
} else if strVal != "Title2" {
|
||||
t.Error("Received: %s", strVal)
|
||||
t.Errorf("Received: %s", strVal)
|
||||
}
|
||||
if strVal, err := ReflectFieldAsString(mystruct, "b", "ExtraFields"); err != nil {
|
||||
t.Error(err)
|
||||
} else if strVal != "15" {
|
||||
t.Error("Received: %s", strVal)
|
||||
t.Errorf("Received: %s", strVal)
|
||||
}
|
||||
if strVal, err := ReflectFieldAsString(mystruct, "c", "ExtraFields"); err != nil {
|
||||
t.Error(err)
|
||||
} else if strVal != "16" {
|
||||
t.Error("Received: %s", strVal)
|
||||
t.Errorf("Received: %s", strVal)
|
||||
}
|
||||
if strVal, err := ReflectFieldAsString(mystruct, "d", "ExtraFields"); err != nil {
|
||||
t.Error(err)
|
||||
} else if strVal != "17.3" {
|
||||
t.Error("Received: %s", strVal)
|
||||
t.Errorf("Received: %s", strVal)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,42 +79,42 @@ func TestReflectFieldAsStringOnMap(t *testing.T) {
|
||||
if strVal, err := ReflectFieldAsString(myMap, "Title", ""); err != nil {
|
||||
t.Error(err)
|
||||
} else if strVal != "Title1" {
|
||||
t.Error("Received: %s", strVal)
|
||||
t.Errorf("Received: %s", strVal)
|
||||
}
|
||||
if strVal, err := ReflectFieldAsString(myMap, "Count", ""); err != nil {
|
||||
t.Error(err)
|
||||
} else if strVal != "5" {
|
||||
t.Error("Received: %s", strVal)
|
||||
t.Errorf("Received: %s", strVal)
|
||||
}
|
||||
if strVal, err := ReflectFieldAsString(myMap, "Count64", ""); err != nil {
|
||||
t.Error(err)
|
||||
} else if strVal != "6" {
|
||||
t.Error("Received: %s", strVal)
|
||||
t.Errorf("Received: %s", strVal)
|
||||
}
|
||||
if strVal, err := ReflectFieldAsString(myMap, "Val", ""); err != nil {
|
||||
t.Error(err)
|
||||
} else if strVal != "7.3" {
|
||||
t.Error("Received: %s", strVal)
|
||||
t.Errorf("Received: %s", strVal)
|
||||
}
|
||||
if strVal, err := ReflectFieldAsString(myMap, "a", ""); err != nil {
|
||||
t.Error(err)
|
||||
} else if strVal != "Title2" {
|
||||
t.Error("Received: %s", strVal)
|
||||
t.Errorf("Received: %s", strVal)
|
||||
}
|
||||
if strVal, err := ReflectFieldAsString(myMap, "b", ""); err != nil {
|
||||
t.Error(err)
|
||||
} else if strVal != "15" {
|
||||
t.Error("Received: %s", strVal)
|
||||
t.Errorf("Received: %s", strVal)
|
||||
}
|
||||
if strVal, err := ReflectFieldAsString(myMap, "c", ""); err != nil {
|
||||
t.Error(err)
|
||||
} else if strVal != "16" {
|
||||
t.Error("Received: %s", strVal)
|
||||
t.Errorf("Received: %s", strVal)
|
||||
}
|
||||
if strVal, err := ReflectFieldAsString(myMap, "d", ""); err != nil {
|
||||
t.Error(err)
|
||||
} else if strVal != "17.3" {
|
||||
t.Error("Received: %s", strVal)
|
||||
t.Errorf("Received: %s", strVal)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user