@@ -197,47 +197,56 @@ test("download cache looks for the right key and creates dir", async (t) => {
197
197
198
198
test ( "cleanup removes only old CodeQL TRAP caches" , async ( t ) => {
199
199
await util . withTmpDir ( async ( tmpDir ) => {
200
+ // This config specifies that we are analyzing JavaScript and Ruby, but not Swift.
200
201
const config = getTestConfigWithTempDir ( tmpDir ) ;
201
202
202
203
sinon . stub ( actionsUtil , "getRef" ) . resolves ( "refs/heads/main" ) ;
203
204
sinon . stub ( actionsUtil , "isAnalyzingDefaultBranch" ) . resolves ( true ) ;
204
205
const listStub = sinon . stub ( apiClient , "listActionsCaches" ) . resolves ( [
206
+ // Should be kept, since it's not relevant to CodeQL. In reality, the API shouldn't return
207
+ // this in the first place, but this is a defensive check.
205
208
{
206
209
id : 1 ,
207
210
key : "some-other-key" ,
208
211
created_at : "2024-05-23T14:25:00Z" ,
209
212
size_in_bytes : 100 * 1024 * 1024 ,
210
213
} ,
214
+ // Should be kept, since it's the newest TRAP cache for JavaScript
211
215
{
212
216
id : 2 ,
213
217
key : "codeql-trap-1-2.0.0-javascript-newest" ,
214
218
created_at : "2024-04-23T14:25:00Z" ,
215
219
size_in_bytes : 50 * 1024 * 1024 ,
216
220
} ,
221
+ // Should be cleaned up
217
222
{
218
223
id : 3 ,
219
224
key : "codeql-trap-1-2.0.0-javascript-older" ,
220
225
created_at : "2024-03-22T14:25:00Z" ,
221
226
size_in_bytes : 200 * 1024 * 1024 ,
222
227
} ,
228
+ // Should be cleaned up
223
229
{
224
230
id : 4 ,
225
231
key : "codeql-trap-1-2.0.0-javascript-oldest" ,
226
232
created_at : "2024-02-21T14:25:00Z" ,
227
233
size_in_bytes : 300 * 1024 * 1024 ,
228
234
} ,
235
+ // Should be kept, since it's the newest TRAP cache for Ruby
229
236
{
230
237
id : 5 ,
231
238
key : "codeql-trap-1-2.0.0-ruby-newest" ,
232
239
created_at : "2024-02-20T14:25:00Z" ,
233
240
size_in_bytes : 300 * 1024 * 1024 ,
234
241
} ,
242
+ // Should be kept, since we aren't analyzing Swift
235
243
{
236
244
id : 6 ,
237
245
key : "codeql-trap-1-2.0.0-swift-newest" ,
238
246
created_at : "2024-02-22T14:25:00Z" ,
239
247
size_in_bytes : 300 * 1024 * 1024 ,
240
248
} ,
249
+ // Should be kept, since we aren't analyzing Swift
241
250
{
242
251
id : 7 ,
243
252
key : "codeql-trap-1-2.0.0-swift-older" ,
0 commit comments