Chromium Code Reviews| Index: scheduler/appengine/presentation/state_test.go |
| diff --git a/scheduler/appengine/presentation/state_test.go b/scheduler/appengine/presentation/state_test.go |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f170b21e6345d1b79d42e039ebad97ebdf11708d |
| --- /dev/null |
| +++ b/scheduler/appengine/presentation/state_test.go |
| @@ -0,0 +1,43 @@ |
| +// Copyright 2017 The LUCI Authors. All rights reserved. |
| +// Use of this source code is governed under the Apache License, Version 2.0 |
| +// that can be found in the LICENSE file. |
| + |
| +package presentation |
| + |
| +import ( |
| + "testing" |
| + |
| + "github.com/luci/luci-go/scheduler/appengine/engine" |
| + "github.com/luci/luci-go/scheduler/appengine/task" |
| + . "github.com/smartystreets/goconvey/convey" |
| +) |
| + |
| +func TestGetPublicStateKind(t *testing.T) { |
| + t.Parallel() |
| + |
| + Convey("works", t, func() { |
| + So(GetPublicStateKind(&engine.Job{ |
| + State: engine.JobState{State: engine.JobStateOverrun}, |
| + }, task.Traits{}), ShouldEqual, PublicStateOverrun) |
| + |
| + So(GetPublicStateKind(&engine.Job{ |
| + State: engine.JobState{State: engine.JobStateSlowQueue}, |
| + }, task.Traits{}), ShouldEqual, PublicStateStarting) |
| + |
| + So(GetPublicStateKind(&engine.Job{ |
| + State: engine.JobState{State: engine.JobStateSlowQueue, InvocationRetryCount: 1}, |
| + }, task.Traits{}), ShouldEqual, PublicStateRetrying) |
| + |
| + So(GetPublicStateKind(&engine.Job{ |
| + Paused: true, |
| + State: engine.JobState{State: engine.JobStateSuspended}, |
| + }, task.Traits{}), ShouldEqual, PublicStatePaused) |
| + |
| + So(GetPublicStateKind(&engine.Job{ |
| + State: engine.JobState{State: engine.JobStateQueued, InvocationID: 1}, |
| + }, task.Traits{Multistage: true}), ShouldEqual, PublicStateStarting) |
| + So(GetPublicStateKind(&engine.Job{ |
|
Vadim Sh.
2017/06/20 17:48:54
nit: \n :)
tandrii(chromium)
2017/06/20 19:48:36
Done.
|
| + State: engine.JobState{State: engine.JobStateQueued, InvocationID: 1}, |
| + }, task.Traits{Multistage: false}), ShouldEqual, PublicStateRunning) |
| + }) |
| +} |