From 2c3ede562db743c9a9029465effeaad04016c61e Mon Sep 17 00:00:00 2001 From: Jonathan Boulle Date: Mon, 9 Jun 2014 15:39:35 -0700 Subject: [PATCH] chore(*): rename Batch to Oneshot --- job/job.go | 4 ++-- job/job_test.go | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/job/job.go b/job/job.go index e39e7b8a5..1dc658db9 100644 --- a/job/job.go +++ b/job/job.go @@ -70,10 +70,10 @@ func NewJob(name string, unit unit.Unit) *Job { } } -// IsBatch identifies whether the Job is intended to execute once, and, on +// IsOneshot identifies whether the Job is intended to execute once, and, on // completion, not be migrated around the cluster. This is determined by // whether the unit file associated with the Job is a Service of type "oneshot". -func (j *Job) IsBatch() bool { +func (j *Job) IsOneshot() bool { s, ok := j.Unit.Contents["Service"] if !ok { return false diff --git a/job/job_test.go b/job/job_test.go index 2109805fa..1a64a0074 100644 --- a/job/job_test.go +++ b/job/job_test.go @@ -262,31 +262,31 @@ X-ConditionMachineID=456 } } -func TestBatchJob(t *testing.T) { +func TestOneshotJob(t *testing.T) { ej := NewJob("foo.service", *unit.NewUnit("")) - if ej.IsBatch() { - t.Error("IsBatch() on job without Service section returned true unexpectedly") + if ej.IsOneshot() { + t.Error("IsOneshot() on job without Service section returned true unexpectedly") } j := NewJob("bar.service", *unit.NewUnit(` [Service] ExecStart=/bin/false`)) - if j.IsBatch() { - t.Error("IsBatch() on Service job with no Type returned true unexpectedly") + if j.IsOneshot() { + t.Error("IsOneshot() on Service job with no Type returned true unexpectedly") } sj := NewJob("bar.service", *unit.NewUnit(` [Service] Type=simple`)) - if sj.IsBatch() { - t.Error("IsBatch() on simple job returned true unexpectedly") + if sj.IsOneshot() { + t.Error("IsOneshot() on simple job returned true unexpectedly") } bj := NewJob("bar.service", *unit.NewUnit(` [Service] Type=oneshot`)) - if !bj.IsBatch() { - t.Error("IsBatch() on oneshot job returned false unexpectedly") + if !bj.IsOneshot() { + t.Error("IsOneshot() on oneshot job returned false unexpectedly") } }