last usage test fixes

This commit is contained in:
Radu Ioan Fericean
2016-03-29 19:43:45 +03:00
parent 33401a78f7
commit c3feacac7d
2 changed files with 4 additions and 4 deletions

View File

@@ -258,7 +258,7 @@ func TestSMGDataLastUsedMultipleData(t *testing.T) {
if maxUsage != 1.048576e+06 {
t.Error("Bad max usage: ", maxUsage)
}
eAcntVal = 49997849600.000000 // 20480
eAcntVal = 49998883840.000000 // 20480
if err := smgRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
t.Error(err)
} else if acnt.BalanceMap[utils.DATA].GetTotalValue() != eAcntVal {
@@ -285,7 +285,7 @@ func TestSMGDataLastUsedMultipleData(t *testing.T) {
if maxUsage != 1.048576e+06 {
t.Error("Bad max usage: ", maxUsage)
}
eAcntVal = 49997829120.000000 // 20480
eAcntVal = 49998863360.000000 // 20480
if err := smgRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
t.Error(err)
} else if acnt.BalanceMap[utils.DATA].GetTotalValue() != eAcntVal {
@@ -311,7 +311,7 @@ func TestSMGDataLastUsedMultipleData(t *testing.T) {
if maxUsage != 1.048576e+06 {
t.Error("Bad max usage: ", maxUsage)
}
eAcntVal = 49996774400.000000 // 1054720
eAcntVal = 49998842880.000000 // 20480
if err := smgRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
t.Error(err)
} else if acnt.BalanceMap[utils.DATA].GetTotalValue() != eAcntVal {

View File

@@ -96,6 +96,7 @@ func (self *SMGSession) debit(dur time.Duration, lastUsed time.Duration) (time.D
return ccDuration, nil
}
//utils.Logger.Debug(fmt.Sprintf("dur: %f", dur.Seconds()))
initialExtraDuration := self.extraDuration
self.extraDuration = 0
if self.cd.LoopIndex > 0 {
self.cd.TimeStart = self.cd.TimeEnd
@@ -111,7 +112,6 @@ func (self *SMGSession) debit(dur time.Duration, lastUsed time.Duration) (time.D
self.cd.TimeEnd = cc.GetEndTime() // set debited timeEnd
// update call duration with real debited duration
ccDuration := cc.GetDuration()
initialExtraDuration := self.extraDuration
if ccDuration != dur {
self.extraDuration = ccDuration - dur
}