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

Side by Side Diff: go/src/infra/monitoring/analyzer/test_failures_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 typo in 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package analyzer 5 package analyzer
6 6
7 import ( 7 import (
8 "infra/monitoring/messages" 8 "infra/monitoring/messages"
9 "reflect" 9 "reflect"
10 "testing" 10 "testing"
(...skipping 25 matching lines...) Expand all
36 { 36 {
37 name: "test step failure", 37 name: "test step failure",
38 failure: stepFailure{ 38 failure: stepFailure{
39 masterName: "fake.master", 39 masterName: "fake.master",
40 builderName: "fake_builder", 40 builderName: "fake_builder",
41 step: messages.Steps{ 41 step: messages.Steps{
42 Name: "something_tests", 42 Name: "something_tests",
43 }, 43 },
44 }, 44 },
45 testResults: &messages.TestResults{ 45 testResults: &messages.TestResults{
46 » » » » Tests: map[string]messages.TestResult{ 46 » » » » Tests: map[string]interface{}{
47 » » » » » "test_a": messages.TestResult{ 47 » » » » » "test_a": map[string]interface{}{
48 » » » » » » Expected: "PASS", 48 » » » » » » "expected": "PASS",
49 » » » » » » Actual: "FAIL", 49 » » » » » » "actual": "FAIL",
50 }, 50 },
51 }, 51 },
52 }, 52 },
53 wantResult: &StepAnalyzerResult{ 53 wantResult: &StepAnalyzerResult{
54 Reasons: []string{"test_a"}, 54 Reasons: []string{"test_a"},
55 Recognized: true, 55 Recognized: true,
56 }, 56 },
57 }, 57 },
58 } 58 }
59 59
60 mc := &mockClient{} 60 mc := &mockClient{}
61 a := &TestFailureAnalyzer{mc} 61 a := &TestFailureAnalyzer{mc}
62 62
63 for _, test := range tests { 63 for _, test := range tests {
64 mc.testResults = test.testResults 64 mc.testResults = test.testResults
65 gotResult, gotErr := a.Analyze(test.failure) 65 gotResult, gotErr := a.Analyze(test.failure)
66 if !reflect.DeepEqual(gotResult, test.wantResult) { 66 if !reflect.DeepEqual(gotResult, test.wantResult) {
67 t.Errorf("%s failed.\n\tGot:\n\t%+v\n\twant:\n\t%+v.", t est.name, gotResult, test.wantResult) 67 t.Errorf("%s failed.\n\tGot:\n\t%+v\n\twant:\n\t%+v.", t est.name, gotResult, test.wantResult)
68 } 68 }
69 if !reflect.DeepEqual(gotErr, test.wantErr) { 69 if !reflect.DeepEqual(gotErr, test.wantErr) {
70 t.Errorf("%s failed. Got: %+v want: %+v.", test.name, go tErr, test.wantErr) 70 t.Errorf("%s failed. Got: %+v want: %+v.", test.name, go tErr, test.wantErr)
71 } 71 }
72 } 72 }
73 } 73 }
OLDNEW
« no previous file with comments | « go/src/infra/monitoring/analyzer/test_failures.go ('k') | go/src/infra/monitoring/dispatcher/dispatcher.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698