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

Unified Diff: milo/appengine/swarming/build_test.go

Issue 2675493003: milo: Use service interface for swarming. (Closed)
Patch Set: Update fetch signature Created 3 years, 10 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/swarming/buildLog.go ('k') | milo/appengine/swarming/expectations/build-canceled.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/appengine/swarming/build_test.go
diff --git a/milo/appengine/swarming/build_test.go b/milo/appengine/swarming/build_test.go
index fc422c4975e890953c9b3bf5d38d5855ab275756..0d81498321e06f327551b337e9eb287b48ad8ba2 100644
--- a/milo/appengine/swarming/build_test.go
+++ b/milo/appengine/swarming/build_test.go
@@ -9,19 +9,21 @@ import (
"flag"
"fmt"
"io/ioutil"
- "path"
+ "path/filepath"
"testing"
"time"
"github.com/luci/luci-go/common/clock/testclock"
- . "github.com/smartystreets/goconvey/convey"
+
"golang.org/x/net/context"
+
+ . "github.com/smartystreets/goconvey/convey"
)
var generate = flag.Bool("test.generate", false, "Generate expectations instead of running tests.")
func load(name string) ([]byte, error) {
- filename := path.Join("expectations", name)
+ filename := filepath.Join("expectations", name)
return ioutil.ReadFile(filename)
}
@@ -39,10 +41,12 @@ func TestBuild(t *testing.T) {
c := context.Background()
c, _ = testclock.UseTime(c, time.Date(2016, time.March, 14, 11, 0, 0, 0, time.UTC))
+ var svc debugSwarmingService
if *generate {
for _, tc := range getTestCases() {
fmt.Printf("Generating expectations for %s\n", tc)
- build, err := swarmingBuildImpl(c, "foo", "debug", tc)
+
+ build, err := swarmingBuildImpl(c, svc, "foo", tc)
if err != nil {
panic(fmt.Errorf("Could not run swarmingBuildImpl for %s: %s", tc, err))
}
@@ -50,7 +54,7 @@ func TestBuild(t *testing.T) {
if err != nil {
panic(fmt.Errorf("Could not JSON marshal %s: %s", tc, err))
}
- filename := path.Join("expectations", tc+".json")
+ filename := filepath.Join("expectations", tc+".json")
err = ioutil.WriteFile(filename, []byte(buildJSON), 0644)
if err != nil {
panic(fmt.Errorf("Encountered error while trying to write to %s: %s", filename, err))
@@ -62,7 +66,7 @@ func TestBuild(t *testing.T) {
Convey(`A test Environment`, t, func() {
for _, tc := range getTestCases() {
Convey(fmt.Sprintf("Test Case: %s", tc), func() {
- build, err := swarmingBuildImpl(c, "foo", "debug", tc)
+ build, err := swarmingBuildImpl(c, svc, "foo", tc)
So(err, ShouldBeNil)
So(build, shouldMatchExpectationsFor, tc+".json")
})
« no previous file with comments | « milo/appengine/swarming/buildLog.go ('k') | milo/appengine/swarming/expectations/build-canceled.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698