From 7c9e106b64aec7befc4e91426159e5a8e91b43cf Mon Sep 17 00:00:00 2001 From: Ryan M Smith Date: Thu, 21 May 2020 16:09:20 -0700 Subject: [PATCH] durations from int64 to float64 Short tests would be truncated to 0s. For thousands of short tests, this is not useful. This fixes that issue. --- build.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/build.go b/build.go index 927ac027..59d7b24a 100644 --- a/build.go +++ b/build.go @@ -73,16 +73,16 @@ type generalObj struct { } type TestResult struct { - Duration int64 `json:"duration"` - Empty bool `json:"empty"` - FailCount int64 `json:"failCount"` - PassCount int64 `json:"passCount"` - SkipCount int64 `json:"skipCount"` + Duration float64 `json:"duration"` + Empty bool `json:"empty"` + FailCount int64 `json:"failCount"` + PassCount int64 `json:"passCount"` + SkipCount int64 `json:"skipCount"` Suites []struct { Cases []struct { Age int64 `json:"age"` ClassName string `json:"className"` - Duration int64 `json:"duration"` + Duration float64 `json:"duration"` ErrorDetails interface{} `json:"errorDetails"` ErrorStackTrace interface{} `json:"errorStackTrace"` FailedSince int64 `json:"failedSince"` @@ -93,7 +93,7 @@ type TestResult struct { Stderr interface{} `json:"stderr"` Stdout interface{} `json:"stdout"` } `json:"cases"` - Duration int64 `json:"duration"` + Duration float64 `json:"duration"` ID interface{} `json:"id"` Name string `json:"name"` Stderr interface{} `json:"stderr"` @@ -161,8 +161,8 @@ type BuildResponse struct { } `json:"changeSets"` Culprits []Culprit `json:"culprits"` Description interface{} `json:"description"` - Duration int64 `json:"duration"` - EstimatedDuration int64 `json:"estimatedDuration"` + Duration float64 `json:"duration"` + EstimatedDuration float64 `json:"estimatedDuration"` Executor interface{} `json:"executor"` DisplayName string `json:"displayName"` FullDisplayName string `json:"fullDisplayName"` @@ -434,7 +434,7 @@ func (b *Build) GetTimestamp() time.Time { return time.Unix(0, msInt*int64(time.Millisecond)) } -func (b *Build) GetDuration() int64 { +func (b *Build) GetDuration() float64 { return b.Raw.Duration }