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

Unified Diff: milo/appengine/job_source/swarming/html_data.go

Issue 2944983003: [milo] {buildbucket,buildbot,swarming,logdog} -> backends/*. (Closed)
Patch Set: fix the tests 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « milo/appengine/job_source/swarming/html.go ('k') | milo/appengine/job_source/swarming/html_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/appengine/job_source/swarming/html_data.go
diff --git a/milo/appengine/swarming/html_data.go b/milo/appengine/job_source/swarming/html_data.go
similarity index 94%
rename from milo/appengine/swarming/html_data.go
rename to milo/appengine/job_source/swarming/html_data.go
index 2cd02e49c0d100adfd437ef3f930c4e7f1462e01..74de34ac6f7cb7884b569ed9b38e9a9592709e84 100644
--- a/milo/appengine/swarming/html_data.go
+++ b/milo/appengine/job_source/swarming/html_data.go
@@ -38,16 +38,18 @@ import (
type testCase struct {
name string
+ swarmingRelDir string
+
swarmResult string
swarmOutput string
annotations string
}
-func getTestCases() []*testCase {
+func getTestCases(swarmingRelDir string) []*testCase {
testCases := make(map[string]*testCase)
- // References "milo/appengine/swarming/testdata".
- testdata := filepath.Join("..", "swarming", "testdata")
+ // References "milo/appengine/job_source/swarming/testdata".
+ testdata := filepath.Join(swarmingRelDir, "testdata")
f, err := ioutil.ReadDir(testdata)
if err != nil {
panic(err)
@@ -62,6 +64,7 @@ func getTestCases() []*testCase {
tc = &testCase{name: name}
testCases[name] = tc
}
+ tc.swarmingRelDir = swarmingRelDir
switch {
case len(parts) == 1:
@@ -96,7 +99,7 @@ func (tc *testCase) getContent(name string) []byte {
// ../swarming below assumes that
// - this code is not executed by tests outside of this dir
// - this dir is a sibling of frontend dir
- path := filepath.Join("..", "swarming", "testdata", name)
+ path := filepath.Join(tc.swarmingRelDir, "testdata", name)
data, err := ioutil.ReadFile(path)
if err != nil {
panic(fmt.Errorf("failed to read [%s]: %s", path, err))
@@ -233,7 +236,7 @@ func datagramGetResponse(project, prefix string, msg proto.Message) *logdog.GetR
}
// BuildTestData returns sample test data for swarming build pages.
-func BuildTestData() []common.TestBundle {
+func BuildTestData(swarmingRelDir string) []common.TestBundle {
basic := resp.MiloBuild{
Summary: resp.BuildComponent{
Label: "Test swarming build",
@@ -258,7 +261,7 @@ func BuildTestData() []common.TestBundle {
})
c, _ = testclock.UseTime(c, time.Date(2016, time.March, 14, 11, 0, 0, 0, time.UTC))
- for _, tc := range getTestCases() {
+ for _, tc := range getTestCases(swarmingRelDir) {
svc := debugSwarmingService{tc}
bl := buildLoader{
logDogClientFunc: logDogClientFunc(tc),
« no previous file with comments | « milo/appengine/job_source/swarming/html.go ('k') | milo/appengine/job_source/swarming/html_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698