Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f629cb3

Browse files
committed
Add some comments to explain test case
1 parent 9983853 commit f629cb3

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

lib/trap-caching.test.js

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/trap-caching.test.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/trap-caching.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,47 +197,56 @@ test("download cache looks for the right key and creates dir", async (t) => {
197197

198198
test("cleanup removes only old CodeQL TRAP caches", async (t) => {
199199
await util.withTmpDir(async (tmpDir) => {
200+
// This config specifies that we are analyzing JavaScript and Ruby, but not Swift.
200201
const config = getTestConfigWithTempDir(tmpDir);
201202

202203
sinon.stub(actionsUtil, "getRef").resolves("refs/heads/main");
203204
sinon.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true);
204205
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.
205208
{
206209
id: 1,
207210
key: "some-other-key",
208211
created_at: "2024-05-23T14:25:00Z",
209212
size_in_bytes: 100 * 1024 * 1024,
210213
},
214+
// Should be kept, since it's the newest TRAP cache for JavaScript
211215
{
212216
id: 2,
213217
key: "codeql-trap-1-2.0.0-javascript-newest",
214218
created_at: "2024-04-23T14:25:00Z",
215219
size_in_bytes: 50 * 1024 * 1024,
216220
},
221+
// Should be cleaned up
217222
{
218223
id: 3,
219224
key: "codeql-trap-1-2.0.0-javascript-older",
220225
created_at: "2024-03-22T14:25:00Z",
221226
size_in_bytes: 200 * 1024 * 1024,
222227
},
228+
// Should be cleaned up
223229
{
224230
id: 4,
225231
key: "codeql-trap-1-2.0.0-javascript-oldest",
226232
created_at: "2024-02-21T14:25:00Z",
227233
size_in_bytes: 300 * 1024 * 1024,
228234
},
235+
// Should be kept, since it's the newest TRAP cache for Ruby
229236
{
230237
id: 5,
231238
key: "codeql-trap-1-2.0.0-ruby-newest",
232239
created_at: "2024-02-20T14:25:00Z",
233240
size_in_bytes: 300 * 1024 * 1024,
234241
},
242+
// Should be kept, since we aren't analyzing Swift
235243
{
236244
id: 6,
237245
key: "codeql-trap-1-2.0.0-swift-newest",
238246
created_at: "2024-02-22T14:25:00Z",
239247
size_in_bytes: 300 * 1024 * 1024,
240248
},
249+
// Should be kept, since we aren't analyzing Swift
241250
{
242251
id: 7,
243252
key: "codeql-trap-1-2.0.0-swift-older",

0 commit comments

Comments
 (0)