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

Side by Side Diff: scheduler/appengine/presentation/state_test.go

Issue 2945843002: scheduler WIP: add GetAllJobs api. (Closed)
Patch Set: update test 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file.
4
5 package presentation
6
7 import (
8 "testing"
9
10 "github.com/luci/luci-go/scheduler/appengine/engine"
11 "github.com/luci/luci-go/scheduler/appengine/task"
12 . "github.com/smartystreets/goconvey/convey"
13 )
14
15 func TestGetPublicStateKind(t *testing.T) {
16 t.Parallel()
17
18 Convey("works", t, func() {
19 So(GetPublicStateKind(&engine.Job{
20 State: engine.JobState{State: engine.JobStateOverrun},
21 }, task.Traits{}), ShouldEqual, PublicStateOverrun)
22
23 So(GetPublicStateKind(&engine.Job{
24 State: engine.JobState{State: engine.JobStateSlowQueue},
25 }, task.Traits{}), ShouldEqual, PublicStateStarting)
26
27 So(GetPublicStateKind(&engine.Job{
28 State: engine.JobState{State: engine.JobStateSlowQueue, InvocationRetryCount: 1},
29 }, task.Traits{}), ShouldEqual, PublicStateRetrying)
30
31 So(GetPublicStateKind(&engine.Job{
32 Paused: true,
33 State: engine.JobState{State: engine.JobStateSuspended} ,
34 }, task.Traits{}), ShouldEqual, PublicStatePaused)
35
36 So(GetPublicStateKind(&engine.Job{
37 State: engine.JobState{State: engine.JobStateQueued, Inv ocationID: 1},
38 }, task.Traits{Multistage: true}), ShouldEqual, PublicStateStart ing)
39 So(GetPublicStateKind(&engine.Job{
Vadim Sh. 2017/06/20 17:48:54 nit: \n :)
tandrii(chromium) 2017/06/20 19:48:36 Done.
40 State: engine.JobState{State: engine.JobStateQueued, Inv ocationID: 1},
41 }, task.Traits{Multistage: false}), ShouldEqual, PublicStateRunn ing)
42 })
43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698