mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-11-13 03:35:52 +01:00
eb7a8e3528
fix #1328 and #720 Type: bug The following has been addressed in the PR: Instead of returning a 404 (Not Found) when npm, yarn, etc requests a package and the package cannot be acquired from an uplink due to a connection timeout, socket timeout, or connection reset problem, a 503 (service unavailable) is returned by Verdaccio instead. In limited testing of a few versions of npm and yarn, both of these clients correctly attempt to retry the request when a 503 is returned. Added functional tests to verify the behavior (this adds a dev dependency on nock, which provides HTTP request mocking Description: This resolves issue #1328 and #720, and ensures npm/yarn install commands don't fail immediately when there is an intermittent network timeout problem with an uplink. Instead Verdaccio will appropriately respond to the client with a 503. A 404 response (current behavior) incorrectly tells the client that the package does not exist (which may or may not be true) and to not try again.
75 lines
2.3 KiB
JavaScript
75 lines
2.3 KiB
JavaScript
// @flow
|
|
|
|
// we need this for notifications
|
|
import {setup} from '../../src/lib/logger';
|
|
setup();
|
|
|
|
import type {IServerBridge} from '../types';
|
|
|
|
import basic from './basic/basic';
|
|
import packageAccess from './package/access';
|
|
import packageGzip from './package/gzip';
|
|
import packageScoped from './package/scoped';
|
|
import tags from './tags/tags';
|
|
import distTagsMerge from './tags/dist-tags-merge';
|
|
import addtag from './tags/addtag';
|
|
import adduser from './adduser/adduser';
|
|
import logout from './adduser/logout';
|
|
import notify from './notifications/notify';
|
|
import incomplete from './sanity/incomplete';
|
|
import mirror from './sanity/mirror';
|
|
import readme from './readme/readme';
|
|
import gh29 from './scenarios/gh29';
|
|
import nullstorage from './sanity/nullstorage';
|
|
import simpleSearch from './search/simple.search';
|
|
import racycrash from './sanity/racycrash';
|
|
import security from './sanity/security';
|
|
import race from './performance/race';
|
|
import pluginsAuth from './plugins/auth';
|
|
import middleware from './plugins/middleware';
|
|
import upLinkCache from './uplinks/cache';
|
|
import uplinkTimeout from './uplinks/timeout';
|
|
|
|
describe('functional test verdaccio', function() {
|
|
jest.setTimeout(10000);
|
|
const server1: IServerBridge = global.__SERVERS__[0];
|
|
const server2: IServerBridge = global.__SERVERS__[1];
|
|
const server3: IServerBridge = global.__SERVERS__[2];
|
|
const app = global.__WEB_SERVER__.app;
|
|
|
|
// list of test
|
|
// note: order of the following calls is important
|
|
packageAccess(server1);
|
|
gh29(server1, server2);
|
|
tags(server1, app);
|
|
packageGzip(server1, app);
|
|
incomplete(server1, app);
|
|
mirror(server1, server2);
|
|
distTagsMerge(server1, server2, server3);
|
|
readme(server1, server2);
|
|
nullstorage(server1, server2);
|
|
middleware(server2);
|
|
race(server1);
|
|
racycrash(server1, app);
|
|
packageScoped(server1, server2);
|
|
security(server1);
|
|
addtag(server1);
|
|
pluginsAuth(server2);
|
|
notify(app);
|
|
uplinkTimeout(server1, server2, server3);
|
|
// requires packages published to server1/server2
|
|
upLinkCache(server1, server2, server3);
|
|
adduser(server1);
|
|
logout(server1);
|
|
basic(server1, server2);
|
|
simpleSearch(server1, server2, app)
|
|
|
|
});
|
|
|
|
process.on('unhandledRejection', function(err) {
|
|
console.error("unhandledRejection", err);
|
|
process.nextTick(function() {
|
|
throw err;
|
|
});
|
|
});
|