Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e29a7c8

Browse filesBrowse files
author
IvanZosimov
committed
Merge branch 'main' into ResolveVersionFix
2 parents 6733fc4 + 5407bf6 commit e29a7c8
Copy full SHA for e29a7c8

File tree

Expand file treeCollapse file tree

9 files changed

+1781
-68
lines changed
Filter options
Expand file treeCollapse file tree

9 files changed

+1781
-68
lines changed

‎.licenses/npm/@actions/cache.dep.yml

Copy file name to clipboardExpand all lines: .licenses/npm/@actions/cache.dep.yml
+1-1Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.licenses/npm/@actions/http-client-1.0.11.dep.yml

Copy file name to clipboardExpand all lines: .licenses/npm/@actions/http-client-1.0.11.dep.yml
+32Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.licenses/npm/@actions/http-client-2.0.1.dep.yml

Copy file name to clipboardExpand all lines: .licenses/npm/@actions/http-client-2.0.1.dep.yml
+32Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎__tests__/cache-save.test.ts

Copy file name to clipboardExpand all lines: __tests__/cache-save.test.ts
+53Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,59 @@ describe('run', () => {
212212
);
213213
expect(setFailedSpy).not.toHaveBeenCalled();
214214
});
215+
216+
it('saves with -1 cacheId , should not fail workflow', async () => {
217+
inputs['cache'] = 'poetry';
218+
getStateSpy.mockImplementation((name: string) => {
219+
if (name === State.STATE_CACHE_PRIMARY_KEY) {
220+
return poetryLockHash;
221+
} else if (name === State.CACHE_PATHS) {
222+
return JSON.stringify([__dirname]);
223+
} else {
224+
return requirementsHash;
225+
}
226+
});
227+
228+
saveCacheSpy.mockImplementation(() => {
229+
return -1;
230+
});
231+
232+
await run();
233+
234+
expect(getInputSpy).toHaveBeenCalled();
235+
expect(getStateSpy).toHaveBeenCalledTimes(3);
236+
expect(infoSpy).not.toHaveBeenCalled();
237+
expect(saveCacheSpy).toHaveBeenCalled();
238+
expect(infoSpy).not.toHaveBeenLastCalledWith(
239+
`Cache saved with the key: ${poetryLockHash}`
240+
);
241+
expect(setFailedSpy).not.toHaveBeenCalled();
242+
});
243+
244+
it('saves with error from toolkit, should fail workflow', async () => {
245+
inputs['cache'] = 'npm';
246+
getStateSpy.mockImplementation((name: string) => {
247+
if (name === State.STATE_CACHE_PRIMARY_KEY) {
248+
return poetryLockHash;
249+
} else if (name === State.CACHE_PATHS) {
250+
return JSON.stringify([__dirname]);
251+
} else {
252+
return requirementsHash;
253+
}
254+
});
255+
256+
saveCacheSpy.mockImplementation(() => {
257+
throw new cache.ValidationError('Validation failed');
258+
});
259+
260+
await run();
261+
262+
expect(getInputSpy).toHaveBeenCalled();
263+
expect(getStateSpy).toHaveBeenCalledTimes(3);
264+
expect(infoSpy).not.toHaveBeenCalledWith();
265+
expect(saveCacheSpy).toHaveBeenCalled();
266+
expect(setFailedSpy).toHaveBeenCalled();
267+
});
215268
});
216269

217270
afterEach(() => {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.