Skip to content

Commit

Permalink
[milo] fix tests on windows.
Browse files Browse the repository at this point in the history
The symlink to the 'templates' folder doesn't work when running the tests
on windows. Instead change the tests to load them from their true location
directly.

R=hinoka@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2955783002
  • Loading branch information
riannucci authored and Commit Bot committed Jun 26, 2017
1 parent 04bd8be commit 6e61686
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion milo/build_source/buildbot/html_test.go
Expand Up @@ -44,7 +44,7 @@ func request(c context.Context, params map[string]string) *router.Context {
func TestHtml(t *testing.T) {
c := memory.UseWithAppID(context.Background(), "dev~luci-milo")
c, _ = testclock.UseTime(c, testclock.TestTimeUTC)
c = templates.Use(c, common.GetTemplateBundle("../../frontend/templates"))
c = templates.Use(c, common.GetTemplateBundle("../../frontend/appengine/templates"))
c = auth.WithState(c, &authtest.FakeState{Identity: identity.AnonymousIdentity})
putDSMasterJSON(c, &buildbotMaster{
Name: "fake",
Expand Down
2 changes: 0 additions & 2 deletions milo/build_source/swarming/README.md
Expand Up @@ -4,8 +4,6 @@
* build_test.go - Tests for build.go
* buildLog.go - Displays build logs
* memoryClient.go - In memory butler client for annotee
* templates - Symlink to ../frontend/templates. Needed for tests.
* testdata - Symlink to ../frontend/testdata. Needed for tests.

* html.go - Plain ol' html endpoints

2 changes: 1 addition & 1 deletion milo/build_source/swarming/html_test.go
Expand Up @@ -41,7 +41,7 @@ func requestCtx(c context.Context, params ...httprouter.Param) *router.Context {
func TestHtml(t *testing.T) {
c := memory.UseWithAppID(context.Background(), "dev~luci-milo")
c, _ = testclock.UseTime(c, testclock.TestTimeUTC)
c = templates.Use(c, common.GetTemplateBundle("../../frontend/templates"))
c = templates.Use(c, common.GetTemplateBundle("../../frontend/appengine/templates"))
c = auth.WithState(c, &authtest.FakeState{Identity: identity.AnonymousIdentity})

Convey(`HTML handler tests`, t, func() {
Expand Down
6 changes: 4 additions & 2 deletions milo/frontend/appengine/main.go
Expand Up @@ -4,8 +4,10 @@

package appengine

import "github.com/luci/luci-go/milo/frontend"
import (
"github.com/luci/luci-go/milo/frontend"
)

func init() {
frontend.Run()
frontend.Run("templates")
}
4 changes: 2 additions & 2 deletions milo/frontend/main.go
Expand Up @@ -30,12 +30,12 @@ func emptyPrelude(c context.Context, methodName string, req proto.Message) (cont
}

// Where it all begins!!!
func Run() {
func Run(templatePath string) {
// Register plain ol' http handlers.
r := router.New()
gaemiddleware.InstallHandlers(r)

basemw := common.Base("templates")
basemw := common.Base(templatePath)
r.GET("/", basemw, frontpageHandler)

// Admin and cron endpoints.
Expand Down
2 changes: 1 addition & 1 deletion milo/frontend/main_test.go
Expand Up @@ -94,7 +94,7 @@ func TestPages(t *testing.T) {
c = settings.Use(c, settings.New(&settings.MemoryStorage{Expiration: time.Second}))
err := settings.Set(c, "analytics", &analyticsSettings{"UA-12345-01"}, "", "")
So(err, ShouldBeNil)
c = templates.Use(c, common.GetTemplateBundle("templates"))
c = templates.Use(c, common.GetTemplateBundle("appengine/templates"))
for _, p := range allPackages {
Convey(fmt.Sprintf("Testing handler %q", p.DisplayName), func() {
for _, b := range p.Data() {
Expand Down
1 change: 0 additions & 1 deletion milo/frontend/templates

This file was deleted.

0 comments on commit 6e61686

Please sign in to comment.