-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make evict-by-age parameter more general
- Loading branch information
1 parent
51af452
commit 6348297
Showing
9 changed files
with
127 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,23 @@ | ||
import {AgeUnit} from "../src/common"; | ||
import * as save from '../src/save'; | ||
import * as exec from "@actions/exec"; | ||
|
||
jest.mock("@actions/exec"); | ||
|
||
describe('ccache save', () => { | ||
test('evict old files from the cache', async () => { | ||
test('evict old files from the cache by age in seconds', async () => { | ||
const proc = jest.spyOn(exec, "exec"); | ||
|
||
const ageInSeconds = 42; | ||
await save.evictOldFiles(ageInSeconds); | ||
await save.evictOldFiles(ageInSeconds, AgeUnit.Seconds); | ||
expect(proc).toHaveBeenCalledWith(`ccache --evict-older-than ${ageInSeconds}s`); | ||
}); | ||
|
||
test('evict old files from the cache by age in days', async () => { | ||
const proc = jest.spyOn(exec, "exec"); | ||
|
||
const ageInDays = 3; | ||
await save.evictOldFiles(ageInDays, AgeUnit.Days); | ||
expect(proc).toHaveBeenCalledWith(`ccache --evict-older-than ${ageInDays}d`); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters