Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andyone committed Mar 26, 2021
1 parent 6aa5ba4 commit 79c3620
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions recipe/recipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ func (r *Recipe) AddCommand(cmd *Command, tag string) {
if isVariable(cmd.User) {
cmd.User = renderVars(r, cmd.User)
}
}

if isVariable(cmd.Description) {
cmd.Description = renderVars(r, cmd.Description)
}
if isVariable(cmd.Description) {
cmd.Description = renderVars(r, cmd.Description)
}

r.Commands = append(r.Commands, cmd)
Expand Down
3 changes: 2 additions & 1 deletion recipe/recipe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,15 @@ func (s *RecipeSuite) TestBasicRecipe(c *C) {
r.AddVariable("user", "nginx")

c1 := NewCommand([]string{"{user}:echo {service}"}, 0)
c2 := NewCommand([]string{"echo ABCD 1.53 4000", "Echo command"}, 0)
c2 := NewCommand([]string{"echo ABCD 1.53 4000", "Echo command for service {service}"}, 0)

r.AddCommand(c1, "")
r.AddCommand(c2, "special")

c.Assert(r.RequireRoot, Equals, true)
c.Assert(c1.User, Equals, "nginx")
c.Assert(c2.Tag, Equals, "special")
c.Assert(c2.Description, Equals, "Echo command for service nginx")

a1 := &Action{"copy", []string{"file1", "file2"}, true, 0, nil}
a2 := &Action{"touch", []string{"{service}"}, false, 0, nil}
Expand Down

0 comments on commit 79c3620

Please sign in to comment.