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

Side by Side Diff: common/api/dm/service/v1/execution_state_evolve_test.go

Issue 1537883002: Initial distributor implementation (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: fix imports and make dummy.go a real file Created 4 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
OLDNEW
1 // Copyright 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 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 dm 5 package dm
6 6
7 import ( 7 import (
8 "testing" 8 "testing"
9 9
10 . "github.com/luci/luci-go/common/testing/assertions" 10 . "github.com/luci/luci-go/common/testing/assertions"
11 . "github.com/smartystreets/goconvey/convey" 11 . "github.com/smartystreets/goconvey/convey"
12 ) 12 )
13 13
14 func TestExecutionState(t *testing.T) { 14 func TestExecutionState(t *testing.T) {
15 t.Parallel() 15 t.Parallel()
16 16
17 Convey("Evolve", t, func() { 17 Convey("Evolve", t, func() {
18 Convey("Identity", func() { 18 Convey("Identity", func() {
19 » » » s := Execution_SCHEDULED 19 » » » s := Execution_SCHEDULING
20 » » » So(s.Evolve(Execution_SCHEDULED), ShouldBeNil) 20 » » » So(s.Evolve(Execution_SCHEDULING), ShouldBeNil)
21 » » » So(s, ShouldEqual, Execution_SCHEDULED) 21 » » » So(s, ShouldEqual, Execution_SCHEDULING)
22 }) 22 })
23 23
24 Convey("Transition", func() { 24 Convey("Transition", func() {
25 s := Execution_RUNNING 25 s := Execution_RUNNING
26 » » » So(s.Evolve(Execution_FINISHED), ShouldBeNil) 26 » » » So(s.Evolve(Execution_STOPPING), ShouldBeNil)
27 » » » So(s, ShouldEqual, Execution_FINISHED) 27 » » » So(s, ShouldEqual, Execution_STOPPING)
28 }) 28 })
29 29
30 Convey("Invalid starting transistion", func() { 30 Convey("Invalid starting transistion", func() {
31 s := Execution_FINISHED 31 s := Execution_FINISHED
32 » » » So(s.Evolve(Execution_SCHEDULED), ShouldErrLike, "invali d state transition FINISHED -> SCHEDULE") 32 » » » So(s.Evolve(Execution_SCHEDULING), ShouldErrLike, "inval id state transition FINISHED -> SCHEDULING")
33 So(s, ShouldEqual, Execution_FINISHED) 33 So(s, ShouldEqual, Execution_FINISHED)
34 }) 34 })
35 35
36 Convey("Invalid ending transistion", func() { 36 Convey("Invalid ending transistion", func() {
37 s := Execution_RUNNING 37 s := Execution_RUNNING
38 » » » So(s.Evolve(Execution_SCHEDULED), ShouldErrLike, "invali d state transition RUNNING -> SCHEDULED") 38 » » » So(s.Evolve(Execution_SCHEDULING), ShouldErrLike, "inval id state transition RUNNING -> SCHEDULING")
39 So(s, ShouldEqual, Execution_RUNNING) 39 So(s, ShouldEqual, Execution_RUNNING)
40 }) 40 })
41 41
42 Convey("MustEvolve", func() { 42 Convey("MustEvolve", func() {
43 s := Execution_FINISHED 43 s := Execution_FINISHED
44 » » » So(func() { s.MustEvolve(Execution_SCHEDULED) }, ShouldP anic) 44 » » » So(func() { s.MustEvolve(Execution_SCHEDULING) }, Should Panic)
45 }) 45 })
46 }) 46 })
47 } 47 }
OLDNEW
« no previous file with comments | « common/api/dm/service/v1/execution_state_evolve.go ('k') | common/api/dm/service/v1/finish_attempt.pb.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698