Co-authored-by: Josh Mock <joshua.mock@elastic.co>
This commit is contained in:
committed by
GitHub
parent
846c50b8bf
commit
a31920b785
@ -77,6 +77,31 @@ test('Missing node(s)', t => {
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('multi nodes with roles, using default node filter', async t => {
|
||||
const client = new Client({
|
||||
nodes: [
|
||||
{
|
||||
url: new URL('http://node1:9200'),
|
||||
roles: { master: true, data: false, ingest: false, ml: false }
|
||||
},
|
||||
{
|
||||
url: new URL('http://node2:9200'),
|
||||
roles: { master: true, data: true, ingest: false, ml: false }
|
||||
},
|
||||
]
|
||||
})
|
||||
const conn = client.connectionPool.getConnection({
|
||||
now: Date.now() + 1000 * 60 * 3,
|
||||
requestId: 1,
|
||||
name: 'elasticsearch-js',
|
||||
context: null
|
||||
})
|
||||
|
||||
t.equal(conn?.url.hostname, 'node2')
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('Custom headers', t => {
|
||||
const client = new Client({
|
||||
node: 'http://localhost:9200',
|
||||
|
||||
Reference in New Issue
Block a user