mirror of
https://github.com/actions/setup-dotnet.git
synced 2026-06-22 22:28:17 +01:00
Bump @actions/cache to 5.1.0, log cache write denied (#746)
* Bump @actions/cache to 5.1.0, log cache write denied * Add cache save failure test case * Update dist * Resolve high-severity audit issues
This commit is contained in:
@@ -3,6 +3,7 @@ import * as core from '@actions/core';
|
||||
import fs from 'node:fs';
|
||||
import {run} from '../src/cache-save';
|
||||
import {getNuGetFolderPath} from '../src/cache-utils';
|
||||
import {State} from '../src/constants';
|
||||
|
||||
jest.mock('@actions/cache');
|
||||
jest.mock('@actions/core');
|
||||
@@ -84,4 +85,22 @@ describe('cache-save tests', () => {
|
||||
expect(jest.mocked(core.getState)).toHaveBeenCalledTimes(2);
|
||||
expect(jest.mocked(cache.saveCache)).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('does not fail and traces when saveCache returns -1', async () => {
|
||||
jest.mocked(core.getBooleanInput).mockReturnValue(true);
|
||||
jest.mocked(core.getState).mockImplementation(s => s);
|
||||
jest.mocked(fs.existsSync).mockReturnValue(true);
|
||||
jest.mocked(cache.saveCache).mockResolvedValue(-1);
|
||||
|
||||
await run();
|
||||
|
||||
expect(jest.mocked(core.setFailed)).not.toHaveBeenCalled();
|
||||
expect(jest.mocked(cache.saveCache)).toHaveBeenCalled();
|
||||
expect(jest.mocked(core.debug)).toHaveBeenCalledWith(
|
||||
`Cache was not saved for the key: ${State.CachePrimaryKey}`
|
||||
);
|
||||
expect(jest.mocked(core.info)).not.toHaveBeenCalledWith(
|
||||
`Cache saved with the key: ${State.CachePrimaryKey}`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user