Skip to content

Commit eac19ea

Browse files
authored
Update nightly test data ingestion (GoogleCloudPlatform#13956)
1 parent fdc3317 commit eac19ea

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed

.ci/magician/cmd/collect_nightly_test_status.go

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,16 @@ var cntsRequiredEnvironmentVariables = [...]string{
3838
}
3939

4040
type 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`
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"`
4651
}
4752

4853
// collectNightlyTestStatusCmd represents the collectNightlyTestStatus command
@@ -87,8 +92,8 @@ var collectNightlyTestStatusCmd = &cobra.Command{
8792
// check if a specific date is provided
8893
if customDate != "" {
8994
parsedDate, err := time.Parse("2006-01-02", customDate) // input format YYYY-MM-DD
90-
// Set the time to 6pm PT
91-
date = time.Date(parsedDate.Year(), parsedDate.Month(), parsedDate.Day(), 18, 0, 0, 0, loc)
95+
// Set the time to 7pm PT
96+
date = time.Date(parsedDate.Year(), parsedDate.Month(), parsedDate.Day(), 19, 0, 0, 0, loc)
9297
if err != nil {
9398
return fmt.Errorf("invalid input time format: %w", err)
9499
}
@@ -164,11 +169,16 @@ func createTestReport(pVersion provider.Version, tc TeamcityClient, gcs Cloudsto
164169
errorMessage = convertErrorMessage(testResult.ErrorMessage)
165170
}
166171
testInfoList = append(testInfoList, TestInfo{
167-
Name: testResult.Name,
168-
Status: testResult.Status,
169-
Service: serviceName,
170-
ErrorMessage: errorMessage,
171-
LogLink: logLink,
172+
Name: testResult.Name,
173+
Status: testResult.Status,
174+
Service: serviceName,
175+
ErrorMessage: errorMessage,
176+
LogLink: logLink,
177+
ProviderVersion: pVersion.String(),
178+
Duration: testResult.Duration,
179+
QueuedDate: build.QueuedDate,
180+
StartDate: build.StartDate,
181+
FinishDate: build.FinishDate,
172182
})
173183
}
174184
}

.ci/magician/teamcity/get.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ type Build struct {
2828
BuildConfName string `json:"buildConfName"`
2929
WebUrl string `json:"webUrl"`
3030
Number string `json:"number"`
31+
QueuedDate string `json:"queuedDate"`
32+
StartDate string `json:"startDate"`
33+
FinishDate string `json:"finishDate"`
3134
}
3235

3336
type Builds struct {
@@ -52,7 +55,7 @@ type FirstFailed struct {
5255
}
5356

5457
func (tc *Client) GetBuilds(project, finishCut, startCut string) (Builds, error) {
55-
url := fmt.Sprintf("https://hashicorp.teamcity.com/app/rest/builds?locator=count:500,tag:cron-trigger,project:%s,branch:refs/heads/nightly-test,finishDate:(date:%s,condition:before),startDate:(date:%s,condition:after)", project, finishCut, startCut)
58+
url := fmt.Sprintf("https://hashicorp.teamcity.com/app/rest/builds?locator=count:500,tag:cron-trigger,project:%s,branch:refs/heads/nightly-test,queuedDate:(date:%s,condition:before),queuedDate:(date:%s,condition:after)&fields=build(id,buildTypeId,buildConfName,webUrl,number,queuedDate,startDate,finishDate)", project, finishCut, startCut)
5659

5760
var builds Builds
5861

@@ -62,7 +65,7 @@ func (tc *Client) GetBuilds(project, finishCut, startCut string) (Builds, error)
6265
}
6366

6467
func (tc *Client) GetTestResults(build Build) (TestResults, error) {
65-
url := fmt.Sprintf("https://hashicorp.teamcity.com/app/rest/testOccurrences?locator=count:5000,build:(id:%d)&fields=testOccurrence(id,name,status,duration,firstFailed(href),details,build(webUrl))", build.Id)
68+
url := fmt.Sprintf("https://hashicorp.teamcity.com/app/rest/testOccurrences?locator=count:5000,build:(id:%d)&fields=testOccurrence(id,name,status,duration,firstFailed(href),details)", build.Id)
6669

6770
var testResults TestResults
6871

0 commit comments

Comments
 (0)