Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: go/src/infra/monitoring/analyzer/analyzer_test.go

Issue 1125263004: dispatcher: fix test result parsing, build ranges for failure alerts, other fixes (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: fixed comments Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: go/src/infra/monitoring/analyzer/analyzer_test.go
diff --git a/go/src/infra/monitoring/analyzer/analyzer_test.go b/go/src/infra/monitoring/analyzer/analyzer_test.go
index bea8fa2f640ac4224b7e578cd07146415c5ac030..1c716ebb9314514600cd52a1f5c960708649bc24 100644
--- a/go/src/infra/monitoring/analyzer/analyzer_test.go
+++ b/go/src/infra/monitoring/analyzer/analyzer_test.go
@@ -101,7 +101,7 @@ func TestMasterAlerts(t *testing.T) {
},
}
- a := New(&mockClient{}, 10)
+ a := New(&mockClient{}, 0, 10)
for _, test := range tests {
a.now = fakeNow(test.t)
@@ -124,12 +124,13 @@ func TestBuilderAlerts(t *testing.T) {
}{
{
name: "Empty",
+ url: "https://build.chromium.org/p/fake.master/json",
wantBuilders: []messages.Alert{},
wantMasters: []messages.Alert{},
},
{
name: "No Alerts",
- url: "http://fake.master",
+ url: "https://build.chromium.org/p/fake.master/json",
be: messages.BuildExtract{
CreatedTimestamp: messages.EpochTime(100),
},
@@ -139,7 +140,7 @@ func TestBuilderAlerts(t *testing.T) {
},
}
- a := New(&mockClient{}, 10)
+ a := New(&mockClient{}, 0, 10)
for _, test := range tests {
a.now = fakeNow(test.t)
@@ -213,10 +214,11 @@ func TestLittleBBuilderAlerts(t *testing.T) {
time: time.Unix(0, 0).Add(4 * time.Hour),
wantAlerts: []messages.Alert{
{
- Key: "fake.master.fake.builder.hung",
- Title: "fake.master.fake.builder is hung in step fake_step.",
- Time: messages.TimeToEpochTime(time.Unix(0, 0).Add(4 * time.Hour)),
- Body: "fake.master.fake.builder has been building for 3h59m50s (last step update 1970-01-01 00:00:10 +0000 UTC), past the alerting threshold of 3h0m0s",
+ Key: "fake.master.fake.builder.hung",
+ Title: "fake.master.fake.builder is hung in step fake_step.",
+ Time: messages.TimeToEpochTime(time.Unix(0, 0).Add(4 * time.Hour)),
+ Body: "fake.master.fake.builder has been building for 3h59m50s (last step update 1970-01-01 00:00:10 +0000 UTC), past the alerting threshold of 3h0m0s",
+ Severity: 1,
Links: []messages.Link{
{Title: "Builder", Href: "https://build.chromium.org/p/fake.master/builders/fake.builder"},
{Title: "Last build", Href: "https://build.chromium.org/p/fake.master/builders/fake.builder/builds/3"},
@@ -228,7 +230,7 @@ func TestLittleBBuilderAlerts(t *testing.T) {
},
}
- a := New(nil, 10)
+ a := New(nil, 0, 10)
for _, test := range tests {
a.now = fakeNow(test.time)
@@ -302,10 +304,10 @@ func TestReasonsForFailure(t *testing.T) {
},
},
testResults: &messages.TestResults{
- Tests: map[string]messages.TestResult{
- "test a": messages.TestResult{
- Expected: "PASS",
- Actual: "FAIL",
+ Tests: map[string]interface{}{
+ "test a": map[string]interface{}{
+ "expected": "PASS",
+ "actual": "FAIL",
},
},
},
@@ -314,7 +316,7 @@ func TestReasonsForFailure(t *testing.T) {
}
mc := &mockClient{}
- a := New(mc, 10)
+ a := New(mc, 0, 10)
for _, test := range tests {
mc.testResults = test.testResults
@@ -390,7 +392,7 @@ func TestStepFailures(t *testing.T) {
}
mc := &mockClient{}
- a := New(mc, 10)
+ a := New(mc, 0, 10)
for _, test := range tests {
mc.build = test.b
@@ -524,7 +526,7 @@ func TestLatestBuildStep(t *testing.T) {
},
}
- a := New(&mockClient{}, 10)
+ a := New(&mockClient{}, 0, 10)
a.now = fakeNow(time.Unix(0, 0))
for _, test := range tests {
gotStep, gotUpdate, gotErr := a.latestBuildStep(&test.b)

Powered by Google App Engine
This is Rietveld 408576698