migrated to FakeTimers (#1221)
This commit is contained in:
committed by
delvedor
parent
847637d784
commit
375b322571
@ -51,7 +51,6 @@
|
|||||||
"into-stream": "^5.1.1",
|
"into-stream": "^5.1.1",
|
||||||
"js-yaml": "^3.13.1",
|
"js-yaml": "^3.13.1",
|
||||||
"license-checker": "^25.0.1",
|
"license-checker": "^25.0.1",
|
||||||
"lolex": "^4.0.1",
|
|
||||||
"minimist": "^1.2.0",
|
"minimist": "^1.2.0",
|
||||||
"ora": "^3.4.0",
|
"ora": "^3.4.0",
|
||||||
"pretty-hrtime": "^1.0.3",
|
"pretty-hrtime": "^1.0.3",
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const { test } = require('tap')
|
const { test } = require('tap')
|
||||||
const lolex = require('lolex')
|
const FakeTimers = require('@sinonjs/fake-timers')
|
||||||
const { Client, Transport } = require('../../index')
|
const { Client, Transport } = require('../../index')
|
||||||
const {
|
const {
|
||||||
connection: { MockConnection, MockConnectionSniff }
|
connection: { MockConnection, MockConnectionSniff }
|
||||||
@ -125,7 +125,7 @@ test('Request id', t => {
|
|||||||
t.test('Resurrect should use the same request id of the request that starts it', t => {
|
t.test('Resurrect should use the same request id of the request that starts it', t => {
|
||||||
t.plan(2)
|
t.plan(2)
|
||||||
|
|
||||||
const clock = lolex.install({ toFake: ['Date'] })
|
const clock = FakeTimers.install({ toFake: ['Date'] })
|
||||||
const client = new Client({
|
const client = new Client({
|
||||||
node: 'http://localhost:9200',
|
node: 'http://localhost:9200',
|
||||||
Connection: MockConnection,
|
Connection: MockConnection,
|
||||||
@ -281,7 +281,7 @@ test('Client name', t => {
|
|||||||
t.test('Resurrect should have the client name configured', t => {
|
t.test('Resurrect should have the client name configured', t => {
|
||||||
t.plan(2)
|
t.plan(2)
|
||||||
|
|
||||||
const clock = lolex.install({ toFake: ['Date'] })
|
const clock = FakeTimers.install({ toFake: ['Date'] })
|
||||||
const client = new Client({
|
const client = new Client({
|
||||||
node: 'http://localhost:9200',
|
node: 'http://localhost:9200',
|
||||||
Connection: MockConnection,
|
Connection: MockConnection,
|
||||||
@ -305,7 +305,7 @@ test('Client name', t => {
|
|||||||
t.test('Resurrect should have the client name configured (child client)', t => {
|
t.test('Resurrect should have the client name configured (child client)', t => {
|
||||||
t.plan(2)
|
t.plan(2)
|
||||||
|
|
||||||
const clock = lolex.install({ toFake: ['Date'] })
|
const clock = FakeTimers.install({ toFake: ['Date'] })
|
||||||
const client = new Client({
|
const client = new Client({
|
||||||
node: 'http://localhost:9200',
|
node: 'http://localhost:9200',
|
||||||
Connection: MockConnection,
|
Connection: MockConnection,
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
const { test } = require('tap')
|
const { test } = require('tap')
|
||||||
const { URL } = require('url')
|
const { URL } = require('url')
|
||||||
const lolex = require('lolex')
|
const FakeTimers = require('@sinonjs/fake-timers')
|
||||||
const workq = require('workq')
|
const workq = require('workq')
|
||||||
const { buildCluster } = require('../utils')
|
const { buildCluster } = require('../utils')
|
||||||
const { Client, events } = require('../../index')
|
const { Client, events } = require('../../index')
|
||||||
@ -24,7 +24,7 @@ const { Client, events } = require('../../index')
|
|||||||
test('Should execute the recurrect API with the ping strategy', t => {
|
test('Should execute the recurrect API with the ping strategy', t => {
|
||||||
t.plan(8)
|
t.plan(8)
|
||||||
|
|
||||||
const clock = lolex.install({ toFake: ['Date'] })
|
const clock = FakeTimers.install({ toFake: ['Date'] })
|
||||||
const q = workq()
|
const q = workq()
|
||||||
|
|
||||||
buildCluster({ numberOfNodes: 2 }, cluster => {
|
buildCluster({ numberOfNodes: 2 }, cluster => {
|
||||||
@ -77,7 +77,7 @@ test('Should execute the recurrect API with the ping strategy', t => {
|
|||||||
test('Resurrect a node and handle 502/3/4 status code', t => {
|
test('Resurrect a node and handle 502/3/4 status code', t => {
|
||||||
t.plan(15)
|
t.plan(15)
|
||||||
|
|
||||||
const clock = lolex.install({ toFake: ['Date'] })
|
const clock = FakeTimers.install({ toFake: ['Date'] })
|
||||||
const q = workq()
|
const q = workq()
|
||||||
|
|
||||||
var count = 0
|
var count = 0
|
||||||
@ -146,7 +146,7 @@ test('Resurrect a node and handle 502/3/4 status code', t => {
|
|||||||
test('Should execute the recurrect API with the optimistic strategy', t => {
|
test('Should execute the recurrect API with the optimistic strategy', t => {
|
||||||
t.plan(8)
|
t.plan(8)
|
||||||
|
|
||||||
const clock = lolex.install({ toFake: ['Date'] })
|
const clock = FakeTimers.install({ toFake: ['Date'] })
|
||||||
const q = workq()
|
const q = workq()
|
||||||
|
|
||||||
buildCluster({ numberOfNodes: 2 }, cluster => {
|
buildCluster({ numberOfNodes: 2 }, cluster => {
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
const { test } = require('tap')
|
const { test } = require('tap')
|
||||||
const { URL } = require('url')
|
const { URL } = require('url')
|
||||||
const lolex = require('lolex')
|
const FakeTimers = require('@sinonjs/fake-timers')
|
||||||
const workq = require('workq')
|
const workq = require('workq')
|
||||||
const { buildCluster } = require('../utils')
|
const { buildCluster } = require('../utils')
|
||||||
const { Client, Connection, Transport, events, errors } = require('../../index')
|
const { Client, Connection, Transport, events, errors } = require('../../index')
|
||||||
@ -115,7 +115,7 @@ test('Should handle hostnames in publish_address', t => {
|
|||||||
|
|
||||||
test('Sniff interval', t => {
|
test('Sniff interval', t => {
|
||||||
t.plan(11)
|
t.plan(11)
|
||||||
const clock = lolex.install({ toFake: ['Date'] })
|
const clock = FakeTimers.install({ toFake: ['Date'] })
|
||||||
const q = workq()
|
const q = workq()
|
||||||
|
|
||||||
buildCluster(({ nodes, shutdown, kill }) => {
|
buildCluster(({ nodes, shutdown, kill }) => {
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
const { test } = require('tap')
|
const { test } = require('tap')
|
||||||
const { URL } = require('url')
|
const { URL } = require('url')
|
||||||
const lolex = require('lolex')
|
const FakeTimers = require('@sinonjs/fake-timers')
|
||||||
const { createGunzip } = require('zlib')
|
const { createGunzip } = require('zlib')
|
||||||
const os = require('os')
|
const os = require('os')
|
||||||
const intoStream = require('into-stream')
|
const intoStream = require('into-stream')
|
||||||
@ -1072,7 +1072,7 @@ test('sniff', t => {
|
|||||||
t.test('sniffInterval', t => {
|
t.test('sniffInterval', t => {
|
||||||
t.plan(6)
|
t.plan(6)
|
||||||
|
|
||||||
const clock = lolex.install({ toFake: ['Date'] })
|
const clock = FakeTimers.install({ toFake: ['Date'] })
|
||||||
t.teardown(() => clock.uninstall())
|
t.teardown(() => clock.uninstall())
|
||||||
|
|
||||||
class MyTransport extends Transport {
|
class MyTransport extends Transport {
|
||||||
|
|||||||
Reference in New Issue
Block a user