| 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")
|
| })
|
|
|