mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-06-15 16:31:12 +00:00
Cache fallback with rolling time based expiration
This commit is contained in:
parent
c2ac33f2c6
commit
f01118b9a5
6 changed files with 40 additions and 17 deletions
|
@ -132,13 +132,13 @@ describe('cache-restore', () => {
|
|||
}
|
||||
});
|
||||
|
||||
await restoreCache(packageManager, '');
|
||||
await restoreCache(packageManager, '', '0');
|
||||
expect(hashFilesSpy).toHaveBeenCalled();
|
||||
expect(infoSpy).toHaveBeenCalledWith(
|
||||
`Cache restored from key: node-cache-${platform}-${packageManager}-${fileHash}`
|
||||
`Cache restored from key: ${platform}-0-setup-node-${packageManager}-${fileHash}`
|
||||
);
|
||||
expect(infoSpy).not.toHaveBeenCalledWith(
|
||||
`${packageManager} cache is not found`
|
||||
`Cache not found for input keys: ${platform}-0-setup-node-${packageManager}-${fileHash}, ${platform}-0-setup-node-${packageManager}-`
|
||||
);
|
||||
expect(setOutputSpy).toHaveBeenCalledWith('cache-hit', true);
|
||||
}
|
||||
|
@ -163,10 +163,10 @@ describe('cache-restore', () => {
|
|||
});
|
||||
|
||||
restoreCacheSpy.mockImplementationOnce(() => undefined);
|
||||
await restoreCache(packageManager, '');
|
||||
await restoreCache(packageManager, '', '0');
|
||||
expect(hashFilesSpy).toHaveBeenCalled();
|
||||
expect(infoSpy).toHaveBeenCalledWith(
|
||||
`${packageManager} cache is not found`
|
||||
`Cache not found for input keys: ${platform}-0-setup-node-${packageManager}-${fileHash}, ${platform}-0-setup-node-${packageManager}-`
|
||||
);
|
||||
expect(setOutputSpy).toHaveBeenCalledWith('cache-hit', false);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue