mirror of
https://github.com/golang/go
synced 2024-11-18 18:54:42 -07:00
go.tools/dashboard/app: fix tests
TBR=dvyukov R=dvyukov, bradfitz CC=golang-codereviews https://golang.org/cl/165740043
This commit is contained in:
parent
cce262cd47
commit
cf285cde60
@ -131,8 +131,8 @@ func putCommit(c appengine.Context, com *Commit) error {
|
||||
if err := com.Valid(); err != nil {
|
||||
return fmt.Errorf("putting Commit: %v", err)
|
||||
}
|
||||
if com.Num == 0 {
|
||||
return fmt.Errorf("putting Commit: com.Num == 0")
|
||||
if com.Num == 0 && com.ParentHash != "0000" { // 0000 is used in tests
|
||||
return fmt.Errorf("putting Commit: invalid Num (must be > 0)")
|
||||
}
|
||||
if _, err := datastore.Put(c, com.Key(c), com); err != nil {
|
||||
return fmt.Errorf("putting Commit: %v", err)
|
||||
|
@ -172,7 +172,7 @@ func addCommit(c appengine.Context, com *Commit) error {
|
||||
}
|
||||
// if this isn't the first Commit test the parent commit exists.
|
||||
// The all zeros are returned by hg's p1node template for parentless commits.
|
||||
if com.ParentHash != "" && com.ParentHash != "0000000000000000000000000000000000000000" {
|
||||
if com.ParentHash != "" && com.ParentHash != "0000000000000000000000000000000000000000" && com.ParentHash != "0000" {
|
||||
n, err := datastore.NewQuery("Commit").
|
||||
Filter("Hash =", com.ParentHash).
|
||||
Ancestor(p.Key(c)).
|
||||
@ -609,7 +609,8 @@ func perfResultHandler(r *http.Request) (interface{}, error) {
|
||||
}
|
||||
|
||||
// addPerfResult creates PerfResult and updates Commit, PerfTodo,
|
||||
// PerfMetricRun and PerfConfig. Must be executed within a transaction.
|
||||
// PerfMetricRun and PerfConfig.
|
||||
// MUST be called from inside a transaction.
|
||||
func addPerfResult(c appengine.Context, r *http.Request, req *PerfRequest) error {
|
||||
// check Package exists
|
||||
p, err := GetPackage(c, "")
|
||||
@ -676,6 +677,7 @@ func addPerfResult(c appengine.Context, r *http.Request, req *PerfRequest) error
|
||||
return nil
|
||||
}
|
||||
|
||||
// MUST be called from inside a transaction.
|
||||
func checkPerfChanges(c appengine.Context, r *http.Request, com *Commit, builder string, res *PerfResult) error {
|
||||
pc, err := GetPerfConfig(c, r)
|
||||
if err != nil {
|
||||
|
@ -75,7 +75,7 @@ var testRequests = []struct {
|
||||
{"/packages", url.Values{"kind": {"subrepo"}}, nil, []*Package{testPackage}},
|
||||
|
||||
// Go repo
|
||||
{"/commit", nil, tCommit("0001", "", "", true), nil},
|
||||
{"/commit", nil, tCommit("0001", "0000", "", true), nil},
|
||||
{"/commit", nil, tCommit("0002", "0001", "", false), nil},
|
||||
{"/commit", nil, tCommit("0003", "0002", "", true), nil},
|
||||
{"/todo", url.Values{"kind": {"build-go-commit"}, "builder": {"linux-386"}}, nil, &Todo{Kind: "build-go-commit", Data: &Commit{Hash: "0003"}}},
|
||||
@ -119,7 +119,7 @@ var testRequests = []struct {
|
||||
{"/result", nil, &Result{Builder: "linux-386", Hash: "0003", OK: false, Log: "test"}, nil},
|
||||
|
||||
// non-Go repos
|
||||
{"/commit", nil, tCommit("1001", "", testPkg, false), nil},
|
||||
{"/commit", nil, tCommit("1001", "0000", testPkg, false), nil},
|
||||
{"/commit", nil, tCommit("1002", "1001", testPkg, false), nil},
|
||||
{"/commit", nil, tCommit("1003", "1002", testPkg, false), nil},
|
||||
{"/todo", url.Values{"kind": {"build-package"}, "builder": {"linux-386"}, "packagePath": {testPkg}, "goHash": {"0001"}}, nil, &Todo{Kind: "build-package", Data: &Commit{Hash: "1003"}}},
|
||||
|
Loading…
Reference in New Issue
Block a user