0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-20 22:52:46 -05:00

chore: flaky test proxy error handler

This commit is contained in:
Juan Picado 2024-02-11 16:57:04 +01:00
parent 50eb7b2ca4
commit b8618e6e97
3 changed files with 7 additions and 31 deletions

View file

@ -1590,7 +1590,7 @@ class Storage {
_attachments: {},
});
debug('no. sync uplinks errors %o for %s', upLinksErrors?.length, name);
debug('no sync uplinks errors %o for %s', upLinksErrors?.length, name);
return [normalizedPkg, upLinksErrors];
}

View file

@ -1,26 +1,10 @@
uplinks:
timeout:
url: https://registry.domain.com/
url: https://registry.domain1.com/
timeout: 2s
some:
url: https://registry.domain.com/
ver:
url: https://registry.verdaccio.org/
packages:
'@*/*':
access: $all
publish: $all
proxy: some
'timeout':
access: $all
publish: $authenticated
proxy: timeout
'foo':
access: $all
publish: $authenticated
proxy: some ver
'*':
access: $all
publish: $all
proxy: some
log: { type: stdout, format: pretty, level: warn }
log: { type: stdout, format: pretty, level: info }

View file

@ -862,23 +862,15 @@ describe('storage', () => {
describe('error handling', () => {
test('should handle double failure on uplinks with timeout', async () => {
const fooManifest = generatePackageMetadata('timeout', '8.0.0');
nock('https://registry.domain.com')
nock('https://registry.timeout.com')
.get(`/${fooManifest.name}`)
.times(10)
.delayConnection(4000)
.delayConnection(8000)
.reply(201, manifestFooRemoteNpmjs);
const config = new Config(
configExample(
{
storage: generateRandomStorage(),
uplinks: {
npmjs: {
url: 'https://registry.domain.com',
timeout: '2s',
},
},
},
'./fixtures/config/syncDoubleUplinksMetadata.yaml',
__dirname
@ -889,13 +881,13 @@ describe('storage', () => {
await storage.init(config);
await expect(
storage.syncUplinksMetadataNext(fooManifest.name, null, {
retry: { limit: 0 },
retry: { limit: 3 },
timeout: {
request: 1000,
},
})
).rejects.toThrow(API_ERROR.NO_PACKAGE);
}, 10000);
}, 18000);
test('should handle one proxy fails', async () => {
const fooManifest = generatePackageMetadata('foo', '8.0.0');