2021-03-14 02:42:46 -05:00
|
|
|
import { HTTP_STATUS } from '../../../src/lib/constants';
|
2019-06-13 14:42:01 -05:00
|
|
|
|
|
|
|
const PKG_SINGLE_UPLINK = 'test-uplink-timeout-single';
|
|
|
|
const PKG_MULTIPLE_UPLINKS = 'test-uplink-timeout-multiple';
|
|
|
|
|
|
|
|
export default function (server, server2, server3) {
|
|
|
|
describe('uplink connection timeouts', () => {
|
2019-12-23 03:29:27 -05:00
|
|
|
// more info: https://github.com/verdaccio/verdaccio/pull/1331
|
2019-09-07 17:46:50 -05:00
|
|
|
|
|
|
|
jest.setTimeout(20000);
|
2019-06-13 14:42:01 -05:00
|
|
|
beforeAll(async () => {
|
|
|
|
await server2.addPackage(PKG_SINGLE_UPLINK).status(HTTP_STATUS.CREATED);
|
|
|
|
await server2.addPackage(PKG_MULTIPLE_UPLINKS).status(HTTP_STATUS.CREATED);
|
|
|
|
await server3.addPackage(PKG_MULTIPLE_UPLINKS).status(HTTP_STATUS.CREATED);
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('get package', () => {
|
|
|
|
test('503 response when uplink connection ESOCKETTIMEDOUT', () => {
|
|
|
|
return server.getPackage(PKG_SINGLE_UPLINK).status(HTTP_STATUS.SERVICE_UNAVAILABLE);
|
|
|
|
});
|
|
|
|
|
2019-09-07 17:46:50 -05:00
|
|
|
test('200 response even though one uplink timeout', () => {
|
2021-03-14 02:42:46 -05:00
|
|
|
return server.getPackage(PKG_MULTIPLE_UPLINKS).status(HTTP_STATUS.OK);
|
2019-06-13 14:42:01 -05:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|