mirror of
https://github.com/docker/login-action.git
synced 2025-04-19 01:26:45 +00:00
Added input parameters which retry docker.login() in case of error
Signed-off-by: eegiazarov <52110484+eegiazarov@users.noreply.github.com>
This commit is contained in:
parent
dd4fa0671b
commit
c43cbe2c6a
6 changed files with 75 additions and 11 deletions
|
@ -70,3 +70,23 @@ test('calls docker login', async () => {
|
|||
expect(setLogoutSpy).toHaveBeenCalledWith(logout);
|
||||
expect(dockerSpy).toHaveBeenCalledWith(registry, username, password, ecr);
|
||||
});
|
||||
|
||||
test('retried error without username and password', async () => {
|
||||
const platSpy = jest.spyOn(osm, 'platform').mockImplementation(() => 'linux');
|
||||
|
||||
const setFailedSpy = jest.spyOn(core, 'setFailed');
|
||||
const warningSpy = jest.spyOn(core, 'warning');
|
||||
const dockerSpy = jest.spyOn(docker, 'login');
|
||||
dockerSpy.mockImplementation(() => {
|
||||
throw Error('Username and password required');
|
||||
});
|
||||
|
||||
process.env['INPUT_LOGOUT'] = 'true'; // default value
|
||||
process.env['INPUT_RETRYERRORPATTERN'] = '.*and password.*';
|
||||
process.env['INPUT_RETRIES'] = '5';
|
||||
|
||||
await run();
|
||||
expect(warningSpy).toHaveBeenCalledWith('Error <<<Username and password required>>> is recoverable, retrying...');
|
||||
expect(warningSpy).toBeCalledTimes(4);
|
||||
expect(setFailedSpy).toHaveBeenCalledWith('Username and password required');
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue