Skip to content

Commit

Permalink
Rename master/pr to base/head
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexcles committed Dec 10, 2018
1 parent 1f58ff6 commit e4a5af7
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions api/checks/summaries/_pr_and_master_specs.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Run | Spec
--- | ---
`master` | {{ .MasterRun.String }}
`{{ printf "%.7s" .PRRun.FullRevisionHash }}` | {{ .PRRun.String }}
`master` | {{ .BaseRun.String }}
`{{ printf "%.7s" .HeadRun.FullRevisionHash }}` | {{ .HeadRun.String }}
8 changes: 4 additions & 4 deletions api/checks/summaries/compile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ func TestGetSummary_Completed(t *testing.T) {
pr.Revision = "0123456789"
pr.FullRevisionHash = strings.Repeat(pr.Revision, 4)
foo := Completed{}
foo.MasterRun = master
foo.PRRun = pr
foo.BaseRun = master
foo.HeadRun = pr
foo.DiffURL = "https://foo.com/diff?before=chrome[master]&after=chrome@0123456789"
foo.HostName = "foo.com"
foo.HostURL = "https://foo.com/"
Expand Down Expand Up @@ -78,8 +78,8 @@ func TestGetSummary_Regressed(t *testing.T) {
pr.Revision = "0123456789"
pr.FullRevisionHash = strings.Repeat(pr.Revision, 4)
foo := Regressed{}
foo.MasterRun = master
foo.PRRun = pr
foo.BaseRun = master
foo.HeadRun = pr
foo.HostName = "foo.com"
foo.HostURL = "https://foo.com/"
foo.DiffURL = "https://foo.com/?products=chrome@0000000000,chrome@0123456789&diff"
Expand Down
4 changes: 2 additions & 2 deletions api/checks/summaries/completed.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
// ResultsComparison is all the fields shared across summaries that
// involve a result comparison.
type ResultsComparison struct {
MasterRun shared.TestRun
PRRun shared.TestRun
BaseRun shared.TestRun
HeadRun shared.TestRun
MasterDiffURL string
DiffURL string // URL for the diff-view of the results
HostName string // Host environment name, e.g. "wpt.fyi"
Expand Down
8 changes: 4 additions & 4 deletions api/checks/summaries/completed.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ There were no regressions detected in the results.

### Results

Test | `{{ printf "%.7s" .PRRun.FullRevisionHash }}`
Test | `{{ printf "%.7s" .HeadRun.FullRevisionHash }}`
--- | ---
{{ range $test, $results := .Results -}}
{{ $test }} | {{ index $results 0 }} / {{ index $results 1 }}
Expand All @@ -18,8 +18,8 @@ And {{ .More }} others...
[Visual comparison of the results]({{ .DiffURL }})

Other views that might be useful:
- [`{{ printf "%.7s" .PRRun.FullRevisionHash }}` vs `master`@`{{ printf "%.7s" .MasterRun.FullRevisionHash }}`]({{ .DiffURL }})
- [`{{ printf "%.7s" .PRRun.FullRevisionHash }}` vs latest master]({{ .MasterDiffURL }})
- [Latest results for `{{ printf "%.7s" .PRRun.FullRevisionHash }}`]({{.HostURL}}?sha={{.PRRun.Revision}})
- [`{{ printf "%.7s" .HeadRun.FullRevisionHash }}` vs its merge base]({{ .DiffURL }})
- [`{{ printf "%.7s" .HeadRun.FullRevisionHash }}` vs latest master]({{ .MasterDiffURL }})
- [Latest results for `{{ printf "%.7s" .HeadRun.FullRevisionHash }}`]({{.HostURL}}?sha={{.HeadRun.Revision}})

{{ template "_file_an_issue.md" . }}
8 changes: 4 additions & 4 deletions api/checks/summaries/regressed.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ to the latest run against the `master` branch.

### Regressions

Test | `master` | `{{ printf "%.7s" .PRRun.FullRevisionHash }}`
Test | `master` | `{{ printf "%.7s" .HeadRun.FullRevisionHash }}`
--- | --- | ---
{{ range $test, $results := .Regressions -}}
{{ $test }} | {{ $results.PassingBefore }} / {{ $results.TotalBefore }} | {{ $results.PassingAfter }} / {{ $results.TotalAfter }}
Expand All @@ -19,8 +19,8 @@ And {{ .More }} others...
[Visual comparison of the results]({{ .DiffURL }})

Other views that might be useful:
- [`{{ printf "%.7s" .PRRun.FullRevisionHash }}` vs `master`@`{{ printf "%.7s" .MasterRun.FullRevisionHash }}`]({{ .DiffURL }})
- [`{{ printf "%.7s" .PRRun.FullRevisionHash }}` vs latest master]({{ .MasterDiffURL }})
- [Latest results for `{{ printf "%.7s" .PRRun.FullRevisionHash }}`]({{.HostURL}}?sha={{.PRRun.Revision}})
- [`{{ printf "%.7s" .HeadRun.FullRevisionHash }}` vs its merge base]({{ .DiffURL }})
- [`{{ printf "%.7s" .HeadRun.FullRevisionHash }}` vs latest master]({{ .MasterDiffURL }})
- [Latest results for `{{ printf "%.7s" .HeadRun.FullRevisionHash }}`]({{.HostURL}}?sha={{.HeadRun.Revision}})

{{ template "_file_an_issue.md" . }}
24 changes: 12 additions & 12 deletions api/checks/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ func updateCheckHandler(w http.ResponseWriter, r *http.Request) {
return
}
filter.SHA = sha[:10]
prRun, masterRun, err := loadRunsToCompare(ctx, filter)
if prRun == nil || masterRun == nil || err != nil {
headRun, baseRun, err := loadRunsToCompare(ctx, filter)
if err != nil {
msg := "Could not find runs to compare"
if err != nil {
msg = fmt.Sprintf("%s: %s", msg, err.Error())
Expand All @@ -71,7 +71,7 @@ func updateCheckHandler(w http.ResponseWriter, r *http.Request) {

aeAPI := shared.NewAppEngineAPI(ctx)
diffAPI := shared.NewDiffAPI(ctx)
summaryData, err := getDiffSummary(aeAPI, diffAPI, *masterRun, *prRun)
summaryData, err := getDiffSummary(aeAPI, diffAPI, *baseRun, *headRun)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
Expand Down Expand Up @@ -157,25 +157,25 @@ func loadMasterRunBefore(ctx context.Context, filter shared.TestRunFilter, headR
return baseRun, err
}

func getDiffSummary(aeAPI shared.AppEngineAPI, diffAPI shared.DiffAPI, masterRun, prRun shared.TestRun) (summaries.Summary, error) {
func getDiffSummary(aeAPI shared.AppEngineAPI, diffAPI shared.DiffAPI, baseRun, headRun shared.TestRun) (summaries.Summary, error) {
diffFilter := shared.DiffFilterParam{Added: true, Changed: true, Unchanged: true}
diff, err := diffAPI.GetRunsDiff(masterRun, prRun, diffFilter, nil)
diff, err := diffAPI.GetRunsDiff(baseRun, headRun, diffFilter, nil)
if err != nil {
return nil, err
}

diffURL := diffAPI.GetDiffURL(masterRun, prRun, &diffFilter)
diffURL := diffAPI.GetDiffURL(baseRun, headRun, &diffFilter)
var labels mapset.Set
if prRun.IsExperimental() {
if headRun.IsExperimental() {
labels = mapset.NewSet(shared.ExperimentalLabel)
}
checkState := summaries.CheckState{
TestRun: &prRun,
TestRun: &headRun,
Product: shared.ProductSpec{
ProductAtRevision: prRun.ProductAtRevision,
ProductAtRevision: headRun.ProductAtRevision,
Labels: labels,
},
HeadSHA: prRun.FullRevisionHash,
HeadSHA: headRun.FullRevisionHash,
DetailsURL: diffURL,
Status: "completed",
}
Expand All @@ -189,8 +189,8 @@ func getDiffSummary(aeAPI shared.AppEngineAPI, diffAPI shared.DiffAPI, masterRun
host := aeAPI.GetHostname()

resultsComparison := summaries.ResultsComparison{
MasterRun: masterRun,
PRRun: prRun,
BaseRun: baseRun,
HeadRun: headRun,
HostName: host,
HostURL: fmt.Sprintf("https://%s/", host),
DiffURL: diffURL.String(),
Expand Down

0 comments on commit e4a5af7

Please sign in to comment.