Commit f2c8b994 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

packer: Default cache is just to os temporary dir

parent edaf1919
......@@ -104,6 +104,11 @@ func NewEnvironment(config *EnvironmentConfig) (resultEnv Environment, err error
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
return
}
......
......@@ -111,6 +111,14 @@ func TestEnvironment_Builder_Error(t *testing.T) {
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) {
assert := asserts.NewTestingAsserts(t, true)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment