Updated test
This commit is contained in:
@ -520,28 +520,52 @@ test('Extend client APIs', t => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('Elastic cloud config', t => {
|
test('Elastic cloud config', t => {
|
||||||
t.plan(1)
|
t.test('Basic', t => {
|
||||||
const client = new Client({
|
t.plan(3)
|
||||||
cloud: {
|
const client = new Client({
|
||||||
// 'localhost$abcd$efgh'
|
cloud: {
|
||||||
id: 'name:bG9jYWxob3N0JGFiY2QkZWZnaA==',
|
// 'localhost$abcd$efgh'
|
||||||
username: 'elastic',
|
id: 'name:bG9jYWxob3N0JGFiY2QkZWZnaA==',
|
||||||
password: 'changeme'
|
username: 'elastic',
|
||||||
}
|
password: 'changeme'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const pool = client.connectionPool
|
||||||
|
t.match(pool.connections.get('https://abcd.localhost/'), {
|
||||||
|
url: new URL('https://elastic:changeme@abcd.localhost'),
|
||||||
|
id: 'https://abcd.localhost/',
|
||||||
|
ssl: null,
|
||||||
|
deadCount: 0,
|
||||||
|
resurrectTimeout: 0,
|
||||||
|
roles: {
|
||||||
|
master: true,
|
||||||
|
data: true,
|
||||||
|
ingest: true,
|
||||||
|
ml: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
t.strictEqual(client.transport.compression, 'gzip')
|
||||||
|
t.strictEqual(client.transport.suggestCompression, true)
|
||||||
})
|
})
|
||||||
|
|
||||||
const pool = client.connectionPool
|
t.test('Override compression options', t => {
|
||||||
t.match(pool.connections.get('https://abcd.localhost/'), {
|
t.plan(2)
|
||||||
url: new URL('https://elastic:changeme@abcd.localhost'),
|
const client = new Client({
|
||||||
id: 'https://abcd.localhost/',
|
cloud: {
|
||||||
ssl: null,
|
// 'localhost$abcd$efgh'
|
||||||
deadCount: 0,
|
id: 'name:bG9jYWxob3N0JGFiY2QkZWZnaA==',
|
||||||
resurrectTimeout: 0,
|
username: 'elastic',
|
||||||
roles: {
|
password: 'changeme'
|
||||||
master: true,
|
},
|
||||||
data: true,
|
compression: false,
|
||||||
ingest: true,
|
suggestCompression: false
|
||||||
ml: false
|
})
|
||||||
}
|
|
||||||
|
t.strictEqual(client.transport.compression, false)
|
||||||
|
t.strictEqual(client.transport.suggestCompression, false)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
t.end()
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user