packer: Default cache is just to os temporary dir

This commit is contained in:
Mitchell Hashimoto 2013-06-09 21:18:06 -07:00
parent edaf19199f
commit f2c8b994a0
2 changed files with 13 additions and 0 deletions

View File

@ -104,6 +104,11 @@ func NewEnvironment(config *EnvironmentConfig) (resultEnv Environment, err error
env.components.Provisioner = func(string) (Provisioner, error) { return nil, nil } env.components.Provisioner = func(string) (Provisioner, error) { return nil, nil }
} }
// The default cache is just the system temporary directory
if env.cache == nil {
env.cache = &FileCache{CacheDir: os.TempDir()}
}
resultEnv = env resultEnv = env
return return
} }

View File

@ -111,6 +111,14 @@ func TestEnvironment_Builder_Error(t *testing.T) {
assert.Nil(returnedBuilder, "should be no builder") assert.Nil(returnedBuilder, "should be no builder")
} }
func TestEnvironment_Cache(t *testing.T) {
config := DefaultEnvironmentConfig()
env, _ := NewEnvironment(config)
if env.Cache() == nil {
t.Fatal("cache should not be nil")
}
}
func TestEnvironment_Cli_Error(t *testing.T) { func TestEnvironment_Cli_Error(t *testing.T) {
assert := asserts.NewTestingAsserts(t, true) assert := asserts.NewTestingAsserts(t, true)