@@ -30,24 +30,25 @@ import (
3030)
3131
3232const (
33- NightlyDataBucket = "nightly-test-data"
33+ nightlyDataBucket = "nightly-test-data"
34+ tcTimeFormat = "20060102T150405Z0700"
3435)
3536
3637var cntsRequiredEnvironmentVariables = [... ]string {
3738 "TEAMCITY_TOKEN" ,
3839}
3940
4041type TestInfo struct {
41- Name string `json:"name"`
42- Status string `json:"status"`
43- Service string `json:"service"`
44- ErrorMessage string `json:"error_message"`
45- LogLink string `json"log_link`
46- ProviderVersion string `json:"provider_version"`
47- QueuedDate string `json:"queuedDate "`
48- StartDate string `json:"startDate "`
49- FinishDate string `json:"finishDate "`
50- Duration int `json:"duration"`
42+ Name string `json:"name"`
43+ Status string `json:"status"`
44+ Service string `json:"service"`
45+ ErrorMessage string `json:"error_message"`
46+ LogLink string `json: "log_link" `
47+ ProviderVersion string `json:"provider_version"`
48+ QueuedDate time. Time `json:"queued_date "`
49+ StartDate time. Time `json:"start_date "`
50+ FinishDate time. Time `json:"finish_date "`
51+ Duration int `json:"duration"`
5152}
5253
5354// collectNightlyTestStatusCmd represents the collectNightlyTestStatus command
@@ -168,17 +169,31 @@ func createTestReport(pVersion provider.Version, tc TeamcityClient, gcs Cloudsto
168169 if testResult .Status == "FAILURE" || testResult .Status == "UNKNOWN" {
169170 errorMessage = convertErrorMessage (testResult .ErrorMessage )
170171 }
172+
173+ queuedTime , err := time .Parse (tcTimeFormat , build .QueuedDate )
174+ if err != nil {
175+ return fmt .Errorf ("failed to parse QueuedDate: %v" , err )
176+ }
177+ startTime , err := time .Parse (tcTimeFormat , build .StartDate )
178+ if err != nil {
179+ return fmt .Errorf ("failed to parse StartDate: %v" , err )
180+ }
181+ finishTime , err := time .Parse (tcTimeFormat , build .FinishDate )
182+ if err != nil {
183+ return fmt .Errorf ("failed to parse FinishDate: %v" , err )
184+ }
185+
171186 testInfoList = append (testInfoList , TestInfo {
172187 Name : testResult .Name ,
173188 Status : testResult .Status ,
174189 Service : serviceName ,
175190 ErrorMessage : errorMessage ,
176191 LogLink : logLink ,
177- ProviderVersion : pVersion .String (),
192+ ProviderVersion : strings . ToUpper ( pVersion .String () ),
178193 Duration : testResult .Duration ,
179- QueuedDate : build . QueuedDate ,
180- StartDate : build . StartDate ,
181- FinishDate : build . FinishDate ,
194+ QueuedDate : queuedTime ,
195+ StartDate : startTime ,
196+ FinishDate : finishTime ,
182197 })
183198 }
184199 }
@@ -193,7 +208,7 @@ func createTestReport(pVersion provider.Version, tc TeamcityClient, gcs Cloudsto
193208
194209 // Upload test status data file to gcs bucket
195210 objectName := fmt .Sprintf ("test-metadata/%s/%s" , pVersion .String (), testStatusFileName )
196- err = gcs .WriteToGCSBucket (NightlyDataBucket , objectName , testStatusFileName )
211+ err = gcs .WriteToGCSBucket (nightlyDataBucket , objectName , testStatusFileName )
197212 if err != nil {
198213 return err
199214 }
0 commit comments