Support for Elasticsearch 7.3 (#928)
This commit is contained in:
committed by
GitHub
parent
823c209c32
commit
8c78f47ac3
@ -1,21 +1,6 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
// Licensed to Elasticsearch B.V under one or more agreements.
|
||||
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
||||
// See the LICENSE file in the project root for more information
|
||||
|
||||
'use strict'
|
||||
|
||||
|
||||
@ -1,21 +1,6 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
// Licensed to Elasticsearch B.V under one or more agreements.
|
||||
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
||||
// See the LICENSE file in the project root for more information
|
||||
|
||||
'use strict'
|
||||
|
||||
@ -41,7 +26,7 @@ test('Should update the connection pool', t => {
|
||||
const client = new Client({
|
||||
node: nodes[Object.keys(nodes)[0]].url
|
||||
})
|
||||
t.strictEqual(client.connectionPool.connections.size, 1)
|
||||
t.strictEqual(client.connectionPool.size, 1)
|
||||
|
||||
client.on(events.SNIFF, (err, request) => {
|
||||
t.error(err)
|
||||
@ -87,7 +72,7 @@ test('Should update the connection pool', t => {
|
||||
}
|
||||
}
|
||||
|
||||
t.strictEqual(client.connectionPool.connections.size, 4)
|
||||
t.strictEqual(client.connectionPool.size, 4)
|
||||
})
|
||||
t.teardown(shutdown)
|
||||
})
|
||||
@ -100,7 +85,7 @@ test('Should handle hostnames in publish_address', t => {
|
||||
const client = new Client({
|
||||
node: nodes[Object.keys(nodes)[0]].url
|
||||
})
|
||||
t.strictEqual(client.connectionPool.connections.size, 1)
|
||||
t.strictEqual(client.connectionPool.size, 1)
|
||||
|
||||
client.on(events.SNIFF, (err, request) => {
|
||||
t.error(err)
|
||||
@ -120,7 +105,7 @@ test('Should handle hostnames in publish_address', t => {
|
||||
t.strictEqual(hosts[i].url.hostname, 'localhost')
|
||||
}
|
||||
|
||||
t.strictEqual(client.connectionPool.connections.size, 4)
|
||||
t.strictEqual(client.connectionPool.size, 4)
|
||||
})
|
||||
t.teardown(shutdown)
|
||||
})
|
||||
@ -140,13 +125,13 @@ test('Sniff interval', t => {
|
||||
t.error(err)
|
||||
const { hosts, reason } = request.meta.sniff
|
||||
t.strictEqual(
|
||||
client.connectionPool.connections.size,
|
||||
client.connectionPool.size,
|
||||
hosts.length
|
||||
)
|
||||
t.strictEqual(reason, Transport.sniffReasons.SNIFF_INTERVAL)
|
||||
})
|
||||
|
||||
t.strictEqual(client.connectionPool.connections.size, 1)
|
||||
t.strictEqual(client.connectionPool.size, 1)
|
||||
setTimeout(() => client.info(t.error), 60)
|
||||
|
||||
setTimeout(() => {
|
||||
@ -156,7 +141,7 @@ test('Sniff interval', t => {
|
||||
}, 150)
|
||||
|
||||
setTimeout(() => {
|
||||
t.strictEqual(client.connectionPool.connections.size, 3)
|
||||
t.strictEqual(client.connectionPool.size, 3)
|
||||
}, 200)
|
||||
|
||||
t.teardown(shutdown)
|
||||
@ -176,13 +161,13 @@ test('Sniff on start', t => {
|
||||
t.error(err)
|
||||
const { hosts, reason } = request.meta.sniff
|
||||
t.strictEqual(
|
||||
client.connectionPool.connections.size,
|
||||
client.connectionPool.size,
|
||||
hosts.length
|
||||
)
|
||||
t.strictEqual(reason, Transport.sniffReasons.SNIFF_ON_START)
|
||||
})
|
||||
|
||||
t.strictEqual(client.connectionPool.connections.size, 1)
|
||||
t.strictEqual(client.connectionPool.size, 1)
|
||||
t.teardown(shutdown)
|
||||
})
|
||||
})
|
||||
@ -205,11 +190,11 @@ test('Should not close living connections', t => {
|
||||
Connection: MyConnection
|
||||
})
|
||||
|
||||
t.strictEqual(client.connectionPool.connections.size, 1)
|
||||
t.strictEqual(client.connectionPool.size, 1)
|
||||
client.transport.sniff((err, hosts) => {
|
||||
t.error(err)
|
||||
t.strictEqual(
|
||||
client.connectionPool.connections.size,
|
||||
client.connectionPool.size,
|
||||
hosts.length
|
||||
)
|
||||
})
|
||||
@ -243,13 +228,13 @@ test('Sniff on connection fault', t => {
|
||||
Connection: MyConnection
|
||||
})
|
||||
|
||||
t.strictEqual(client.connectionPool.connections.size, 2)
|
||||
t.strictEqual(client.connectionPool.size, 2)
|
||||
// this event will be triggered by the connection fault
|
||||
client.on(events.SNIFF, (err, request) => {
|
||||
t.error(err)
|
||||
const { hosts, reason } = request.meta.sniff
|
||||
t.strictEqual(
|
||||
client.connectionPool.connections.size,
|
||||
client.connectionPool.size,
|
||||
hosts.length
|
||||
)
|
||||
t.strictEqual(reason, Transport.sniffReasons.SNIFF_ON_CONNECTION_FAULT)
|
||||
|
||||
Reference in New Issue
Block a user