fix
This commit is contained in:
parent
ea119b7297
commit
55cc8c61b3
|
@ -80,6 +80,9 @@ func (c *RunCommand) Run(args []string) int {
|
|||
return 1
|
||||
}
|
||||
|
||||
// Initialize any fields that need to be.
|
||||
job.InitFields()
|
||||
|
||||
// Check that the job is valid
|
||||
if err := job.Validate(); err != nil {
|
||||
c.Ui.Error(fmt.Sprintf("Error validating job: %s", err))
|
||||
|
|
|
@ -77,6 +77,7 @@ func TestRunCommand_Fails(t *testing.T) {
|
|||
defer os.Remove(fh3.Name())
|
||||
_, err = fh3.WriteString(`
|
||||
job "job1" {
|
||||
type = "service"
|
||||
datacenters = [ "dc1" ]
|
||||
group "group1" {
|
||||
count = 1
|
||||
|
|
|
@ -48,6 +48,9 @@ func (c *ValidateCommand) Run(args []string) int {
|
|||
return 1
|
||||
}
|
||||
|
||||
// Initialize any fields that need to be.
|
||||
job.InitFields()
|
||||
|
||||
// Check that the job is valid
|
||||
if err := job.Validate(); err != nil {
|
||||
c.Ui.Error(fmt.Sprintf("Error validating job: %s", err))
|
||||
|
|
|
@ -24,6 +24,7 @@ func TestValidateCommand(t *testing.T) {
|
|||
defer os.Remove(fh.Name())
|
||||
_, err = fh.WriteString(`
|
||||
job "job1" {
|
||||
type = "service"
|
||||
datacenters = [ "dc1" ]
|
||||
group "group1" {
|
||||
count = 1
|
||||
|
|
|
@ -115,9 +115,11 @@ func TestJob_IsPeriodic(t *testing.T) {
|
|||
func TestTaskGroup_Validate(t *testing.T) {
|
||||
tg := &TaskGroup{
|
||||
RestartPolicy: &RestartPolicy{
|
||||
Interval: 5 * time.Minute,
|
||||
Delay: 10 * time.Second,
|
||||
Attempts: 10,
|
||||
Interval: 5 * time.Minute,
|
||||
Delay: 10 * time.Second,
|
||||
Attempts: 10,
|
||||
RestartOnSuccess: true,
|
||||
Mode: RestartPolicyModeDelay,
|
||||
},
|
||||
}
|
||||
err := tg.Validate()
|
||||
|
@ -141,9 +143,11 @@ func TestTaskGroup_Validate(t *testing.T) {
|
|||
&Task{},
|
||||
},
|
||||
RestartPolicy: &RestartPolicy{
|
||||
Interval: 5 * time.Minute,
|
||||
Delay: 10 * time.Second,
|
||||
Attempts: 10,
|
||||
Interval: 5 * time.Minute,
|
||||
Delay: 10 * time.Second,
|
||||
Attempts: 10,
|
||||
RestartOnSuccess: true,
|
||||
Mode: RestartPolicyModeDelay,
|
||||
},
|
||||
}
|
||||
err = tg.Validate()
|
||||
|
|
Loading…
Reference in New Issue