Skip to content

Commit

Permalink
fail with error if no processes are parsed from Procfile
Browse files Browse the repository at this point in the history
  • Loading branch information
cezarsa committed Feb 6, 2017
1 parent 09ccd78 commit a71ef6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ func loadProcesses(t *TsuruYaml) error {
processes[p[1]] = strings.Trim(p[2], " ")
}
}
if len(processes) == 0 {
return fmt.Errorf("invalid Procfile, no processes found in %q", procfile)
}
t.Processes = processes
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions tasks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ func (s *S) TestDontLoadWrongProcfile(c *check.C) {
c.Assert(s.fs.HasAction(fmt.Sprintf("create %s", procfilePath)), check.Equals, true)
t := TsuruYaml{}
err = loadProcesses(&t)
c.Assert(err, check.IsNil)
c.Assert(t.Processes, check.DeepEquals, map[string]string{})
c.Assert(err, check.NotNil)
c.Assert(err.Error(), check.Equals, `invalid Procfile, no processes found in "web:\n\t@python test.py"`)
}

func (s *S) TestSaveAppEnvsFile(c *check.C) {
Expand Down

0 comments on commit a71ef6e

Please sign in to comment.