aboutsummaryrefslogtreecommitdiffstats
path: root/dashboard/app/tree_test.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-05-25 13:14:16 +0200
committerAleksandr Nogikh <wp32pw@gmail.com>2023-05-25 14:59:38 +0200
commitd608a2afc4289e56fe35af894ff9eb3f56f4fcb4 (patch)
tree8092dba0ac1da1d0082c88bc2758254bce7d2aaf /dashboard/app/tree_test.go
parent6b7e906bb1dbb3bd49f58b79b00ea928ade236ba (diff)
dashboard: include label message into bug reports
Diffstat (limited to 'dashboard/app/tree_test.go')
-rw-r--r--dashboard/app/tree_test.go46
1 files changed, 43 insertions, 3 deletions
diff --git a/dashboard/app/tree_test.go b/dashboard/app/tree_test.go
index 03aeb1aae..d3524dec6 100644
--- a/dashboard/app/tree_test.go
+++ b/dashboard/app/tree_test.go
@@ -13,6 +13,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/syzkaller/dashboard/dashapi"
+ "github.com/stretchr/testify/assert"
db "google.golang.org/appengine/v2/datastore"
aemail "google.golang.org/appengine/v2/mail"
)
@@ -38,6 +39,7 @@ func TestTreeOriginDownstream(t *testing.T) {
results: []treeTestEntryPeriod{{fromDay: 0, result: treeTestOK}},
},
}
+ ctx.reportToEmail()
ctx.jobTestDays = []int{10}
ctx.moveToDay(10)
ctx.ensureLabels(`origin:downstream`)
@@ -49,7 +51,6 @@ func TestTreeOriginDownstream(t *testing.T) {
_, err := c.GET(ctx.bugLink())
c.expectEQ(err, nil)
// Test that we receive a notification.
- ctx.reportToEmail()
msg := ctx.emailWithoutURLs()
c.expectEQ(msg.Body, `Bug presence analysis results: the bug reproduces only on the downstream tree.
@@ -71,6 +72,45 @@ More details can be found at:
`)
}
+func TestTreeOriginDownstreamEmail(t *testing.T) {
+ c := NewCtx(t)
+ defer c.Close()
+
+ ctx := setUpTreeTest(c, downstreamUpstreamRepos)
+ ctx.uploadBug(`https://downstream.repo/repo`, `master`, dashapi.ReproLevelC)
+ ctx.entries = []treeTestEntry{
+ {
+ alias: `downstream`,
+ results: []treeTestEntryPeriod{{fromDay: 0, result: treeTestCrash}},
+ },
+ {
+ alias: `lts`,
+ mergeAlias: `downstream`,
+ results: []treeTestEntryPeriod{{fromDay: 0, result: treeTestOK}},
+ },
+ {
+ alias: `upstream`,
+ results: []treeTestEntryPeriod{{fromDay: 0, result: treeTestOK}},
+ },
+ }
+ ctx.jobTestDays = []int{10}
+ ctx.moveToDay(10)
+
+ // The report must contain the string.
+ msg := ctx.reportToEmail()
+ assert.Contains(t, msg.Body, `@testapp.appspotmail.com
+
+Bug presence analysis results: the bug reproduces only on the downstream tree.
+
+
+report1
+
+---
+This report is generated by a bot. It may contain errors.`)
+ // No notification must be sent.
+ c.client.pollNotifs(0)
+}
+
func TestTreeOriginLts(t *testing.T) {
c := NewCtx(t)
defer c.Close()
@@ -764,9 +804,9 @@ func (ctx *treeTestCtx) bugLink() string {
return fmt.Sprintf("/bug?id=%v", ctx.bug.key(ctx.ctx.ctx).StringID())
}
-func (ctx *treeTestCtx) reportToEmail() {
+func (ctx *treeTestCtx) reportToEmail() *aemail.Message {
ctx.client.updateBug(ctx.bugReport.ID, dashapi.BugStatusUpstream, "")
- ctx.ctx.pollEmailBug() // skip the report
+ return ctx.ctx.pollEmailBug()
}
var urlRe = regexp.MustCompile(`(https?://[\w\./\?\=&]+)`)