@@ -56,11 +56,15 @@ func TestBuildPod(t *testing.T) {
5656 env := make (map [string ]interface {})
5757 env ["KEY" ] = "VALUE"
5858
59+ cacheDisabledEnv := make (map [string ]interface {})
60+ cacheDisabledEnv ["DEIS_DISABLE_CACHE" ] = "1"
61+
5962 var pod * api.Pod
6063
6164 slugBuilds := []slugBuildCase {
6265 {true , "test" , "default" , emptyEnv , "tar" , "put-url" , "cache-url" , "deadbeef" , "" , "" , api .PullAlways , "" },
6366 {true , "test" , "default" , env , "tar" , "put-url" , "cache-url" , "deadbeef" , "" , "" , api .PullAlways , "" },
67+ {true , "test" , "default" , cacheDisabledEnv , "tar" , "put-url" , "cache-url" , "deadbeef" , "" , "" , api .PullAlways , "" },
6468 {true , "test" , "default" , emptyEnv , "tar" , "put-url" , "cache-url" , "deadbeef" , "buildpack" , "" , api .PullAlways , "" },
6569 {true , "test" , "default" , env , "tar" , "put-url" , "cache-url" , "deadbeef" , "buildpack" , "" , api .PullAlways , "" },
6670 {true , "test" , "default" , env , "tar" , "put-url" , "cache-url" , "deadbeef" , "buildpack" , "customimage" , api .PullAlways , "" },
@@ -95,7 +99,14 @@ func TestBuildPod(t *testing.T) {
9599 checkForEnv (t , pod , "SOURCE_VERSION" , build .gitShortHash )
96100 checkForEnv (t , pod , "TAR_PATH" , build .tarKey )
97101 checkForEnv (t , pod , "PUT_PATH" , build .putKey )
98- checkForEnv (t , pod , "CACHE_PATH" , build .cacheKey )
102+
103+ if _ , ok := build .env ["DEIS_DISABLE_CACHE" ]; ! ok {
104+ checkForEnv (t , pod , "CACHE_PATH" , build .cacheKey )
105+ } else {
106+ if cachePath , err := envValueFromKey (pod , "CACHE_PATH" ); err == nil {
107+ t .Errorf ("expected CACHE_PATH not to be defined but it was defined with %v" , cachePath )
108+ }
109+ }
99110
100111 if build .buildPack != "" {
101112 checkForEnv (t , pod , "BUILDPACK_URL" , build .buildPack )
0 commit comments