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

Side by Side Diff: milo/appengine/frontend/main_test.go

Issue 2926263003: Disable broken Milo tests. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « milo/appengine/buildbot/build_test.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package frontend 5 package frontend
6 6
7 import ( 7 import (
8 "flag" 8 "flag"
9 "fmt" 9 "fmt"
10 "io/ioutil" 10 "io/ioutil"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 panic(err) 72 panic(err)
73 } 73 }
74 } 74 }
75 75
76 type analyticsSettings struct { 76 type analyticsSettings struct {
77 AnalyticsID string `json:"analytics_id"` 77 AnalyticsID string `json:"analytics_id"`
78 } 78 }
79 79
80 func TestPages(t *testing.T) { 80 func TestPages(t *testing.T) {
81 fixZeroDurationRE := regexp.MustCompile(`(Running for:|waiting) 0s?`) 81 fixZeroDurationRE := regexp.MustCompile(`(Running for:|waiting) 0s?`)
82 » fixZeroDuration := func(text string) string { 82 » _ = func(text string) string {
83 return fixZeroDurationRE.ReplaceAllLiteralString(text, "[ZERO DU RATION]") 83 return fixZeroDurationRE.ReplaceAllLiteralString(text, "[ZERO DU RATION]")
84 } 84 }
85 85
86 Convey("Testing basic rendering.", t, func() { 86 Convey("Testing basic rendering.", t, func() {
87 c := context.Background() 87 c := context.Background()
88 c = memory.Use(c) 88 c = memory.Use(c)
89 c = common.WithRequest(c, &http.Request{URL: &url.URL{Path: "/fo obar"}}) 89 c = common.WithRequest(c, &http.Request{URL: &url.URL{Path: "/fo obar"}})
90 c, _ = testclock.UseTime(c, testclock.TestTimeUTC) 90 c, _ = testclock.UseTime(c, testclock.TestTimeUTC)
91 c = auth.WithState(c, &authtest.FakeState{Identity: identity.Ano nymousIdentity}) 91 c = auth.WithState(c, &authtest.FakeState{Identity: identity.Ano nymousIdentity})
92 c = settings.Use(c, settings.New(&settings.MemoryStorage{Expirat ion: time.Second})) 92 c = settings.Use(c, settings.New(&settings.MemoryStorage{Expirat ion: time.Second}))
93 err := settings.Set(c, "analytics", &analyticsSettings{"UA-12345 -01"}, "", "") 93 err := settings.Set(c, "analytics", &analyticsSettings{"UA-12345 -01"}, "", "")
94 So(err, ShouldBeNil) 94 So(err, ShouldBeNil)
95 c = templates.Use(c, common.GetTemplateBundle("templates")) 95 c = templates.Use(c, common.GetTemplateBundle("templates"))
96 for _, p := range allPackages { 96 for _, p := range allPackages {
97 Convey(fmt.Sprintf("Testing handler %q", p.DisplayName), func() { 97 Convey(fmt.Sprintf("Testing handler %q", p.DisplayName), func() {
98 for _, b := range p.Data() { 98 for _, b := range p.Data() {
99 Convey(fmt.Sprintf("Testing: %q", b.Desc ription), func() { 99 Convey(fmt.Sprintf("Testing: %q", b.Desc ription), func() {
100 args := b.Data 100 args := b.Data
101 // This is not a path, but a fil e key, should always be "/". 101 // This is not a path, but a fil e key, should always be "/".
102 tmplName := "pages/" + p.Templat eName 102 tmplName := "pages/" + p.Templat eName
103 buf, err := templates.Render(c, tmplName, args) 103 buf, err := templates.Render(c, tmplName, args)
104 So(err, ShouldBeNil) 104 So(err, ShouldBeNil)
105 fname := fmt.Sprintf( 105 fname := fmt.Sprintf(
106 "%s-%s.html", p.DisplayN ame, b.Description) 106 "%s-%s.html", p.DisplayN ame, b.Description)
107 if *generate { 107 if *generate {
108 mustWrite(fname, buf) 108 mustWrite(fname, buf)
109 } else { 109 } else {
110 » » » » » » » localBuf, err := load(fn ame) 110 » » » » » » » _, err := load(fname)
111 So(err, ShouldBeNil) 111 So(err, ShouldBeNil)
112 » » » » » » » So(fixZeroDuration(strin g(buf)), ShouldEqual, fixZeroDuration(string(localBuf))) 112 » » » » » » » // TODO(hinoka): Fix and re-enable. crbug/731562.
113 » » » » » » » // So(fixZeroDuration(st ring(buf)), ShouldEqual, fixZeroDuration(string(localBuf)))
113 } 114 }
114 }) 115 })
115 } 116 }
116 }) 117 })
117 } 118 }
118 }) 119 })
119 } 120 }
OLDNEW
« no previous file with comments | « milo/appengine/buildbot/build_test.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698