(t *testing.T)
| 149 | } |
| 150 | |
| 151 | func TestCacheDirInjectionEnabled(t *testing.T) { |
| 152 | type testCase struct { |
| 153 | name string |
| 154 | annotations map[string]string |
| 155 | expect bool |
| 156 | } |
| 157 | |
| 158 | testcases := []testCase{ |
| 159 | { |
| 160 | name: "enable_Injection_done", |
| 161 | annotations: map[string]string{ |
| 162 | common.InjectCacheDir: "true", |
| 163 | }, |
| 164 | expect: true, |
| 165 | }, { |
| 166 | name: "disable_Injection_done", |
| 167 | annotations: map[string]string{ |
| 168 | common.InjectCacheDir: "false", |
| 169 | }, |
| 170 | expect: false, |
| 171 | }, { |
| 172 | name: "no_Injection", |
| 173 | annotations: map[string]string{ |
| 174 | "test": "false", |
| 175 | }, |
| 176 | expect: false, |
| 177 | }, |
| 178 | } |
| 179 | |
| 180 | for _, testcase := range testcases { |
| 181 | got := InjectCacheDirEnabled(testcase.annotations) |
| 182 | if got != testcase.expect { |
| 183 | t.Errorf("The testcase %s's failed due to expect %v but got %v", testcase.name, testcase.expect, got) |
| 184 | } |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | func TestServerlessPlatformMatched(t *testing.T) { |
| 189 | type envPlatform struct { |
nothing calls this directly
no test coverage detected