Skip to content

Commit

Permalink
add test for run before
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Derich committed Dec 24, 2017
1 parent 87c10f8 commit bb82752
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion builders/local_test.go
Expand Up @@ -41,6 +41,21 @@ func TestBuilder_LocalBuilder_SetupImage(t *testing.T) {
})
}

func TestBuilder_LocalBuilder_RunBefore(t *testing.T) {

t.Run("run before commands", func(t *testing.T) {
builder := &LocalBuilder{
Image: "golang:1.7",
Before: []string{"apt-get update"},
}
builder.Init()
_ = builder.SetupImage()
err := builder.RunBefore()
assert.NotNil(t, err)
builder.Cleanup()
})
}

func TestBuilder_LocalBuilder_SetupContainer(t *testing.T) {

t.Run("image does not exist", func(t *testing.T) {
Expand Down Expand Up @@ -85,6 +100,6 @@ func TestBuilder_LocalBuilder_Cleanup(t *testing.T) {

err := builder.Cleanup()
assert.NotNil(t, err)
assert.Equal(t, strings.Contains(err.Error(), "Container doesn't exist."), true)
assert.Equal(t, strings.Contains(err.Error(), "Container doesn't exist"), true)
})
}

0 comments on commit bb82752

Please sign in to comment.