[Backport 7.x] Add ability to disable the http agent (#1258)

Co-authored-by: Tomas Della Vedova <delvedor@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2020-07-13 15:09:22 +02:00
committed by GitHub
parent 581b0f3a35
commit e864c1db99
8 changed files with 117 additions and 13 deletions

View File

@ -51,12 +51,14 @@ expectType<Client>(
)
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
node: 42
})
)
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
node: {
url: 'http://localhost:9200',
@ -76,6 +78,7 @@ expectType<Client>(
)
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
node: 'http://localhost:9200',
maxRetries: 'five'
@ -93,6 +96,7 @@ expectType<Client>(
)
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
node: 'http://localhost:9200',
requestTimeout: 'five'
@ -110,6 +114,7 @@ expectType<Client>(
)
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
node: 'http://localhost:9200',
pingTimeout: 'five'
@ -134,6 +139,7 @@ expectType<Client>(
)
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
node: 'http://localhost:9200',
sniffInterval: 'five'
@ -151,6 +157,7 @@ expectType<Client>(
)
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
node: 'http://localhost:9200',
sniffOnStart: 'no'
@ -168,6 +175,7 @@ expectType<Client>(
)
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
node: 'http://localhost:9200',
sniffEndpoint: false
@ -185,6 +193,7 @@ expectType<Client>(
)
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
node: 'http://localhost:9200',
sniffOnConnectionFault: 'yes'
@ -216,6 +225,7 @@ expectType<Client>(
)
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
node: 'http://localhost:9200',
resurrectStrategy: 'custom'
@ -233,6 +243,7 @@ expectType<Client>(
)
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
node: 'http://localhost:9200',
suggestCompression: 'no'
@ -250,6 +261,7 @@ expectType<Client>(
)
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
node: 'http://localhost:9200',
compression: 'deflate'
@ -267,6 +279,7 @@ expectType<Client>(
)
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
node: 'http://localhost:9200',
headers: 'foo=bar'
@ -284,6 +297,7 @@ expectType<Client>(
)
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
node: 'http://localhost:9200',
opaqueIdPrefix: 42
@ -308,6 +322,7 @@ expectType<Client>(
)
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
node: 'http://localhost:9200',
name: 42
@ -349,6 +364,7 @@ expectType<Client>(
)
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
node: 'http://localhost:9200',
auth: 'password'
@ -367,6 +383,7 @@ expectType<Client>(
)
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
cloud: {
id: 42
@ -389,12 +406,22 @@ expectType<Client>(
})
)
expectType<Client>(
new Client({
node: 'http://localhost:9200',
agent: false
})
)
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
node: 'http://localhost:9200',
agent: {
// @ts-expect-error
keepAlive: 'yes',
// @ts-expect-error
keepAliveMsecs: true,
// @ts-expect-error
maxSockets: 'all',
maxFreeSockets: null
}
@ -418,7 +445,9 @@ expectError<errors.ConfigurationError>(
new Client({
node: 'http://localhost:9200',
ssl: {
// @ts-expect-error
ca: 42,
// @ts-expect-error
rejectUnauthorized: 'yes'
}
})
@ -437,6 +466,7 @@ expectType<Client>(
)
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
node: 'http://localhost:9200',
generateRequestId: 'id'
@ -463,6 +493,7 @@ expectType<Client>(
)
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
node: 'http://localhost:9200',
nodeSelector (connections) {
@ -484,6 +515,7 @@ expectType<Client>(
)
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
node: 'http://localhost:9200',
nodeFilter (connection) {
@ -518,6 +550,7 @@ expectError<errors.ConfigurationError>(
}
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
node: 'http://localhost:9200',
Serializer: CustomSerializer
@ -553,6 +586,7 @@ expectError<errors.ConfigurationError>(
expectError<errors.ConfigurationError>(
new Client({
node: 'http://localhost:9200',
// @ts-expect-error
Connection: CustomConnection
})
)
@ -584,6 +618,7 @@ expectError<errors.ConfigurationError>(
}
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
node: 'http://localhost:9200',
ConnectionPool: CustomConnectionPool
@ -617,6 +652,7 @@ expectError<errors.ConfigurationError>(
}
expectError<errors.ConfigurationError>(
// @ts-expect-error
new Client({
node: 'http://localhost:9200',
Transport: CustomTransport

View File

@ -90,15 +90,10 @@ expectError(
body: 42
}).then(console.log)
)
/*
* We cannot test yet the absence of a property because tsd is still shipping
* TypeScript v3.7, as soon as it will be 3.9, we'll uncomment the following test.
// @ts-expect-error
client.async_search.get()
*/
// callback api is not supported
expectError(client.cat.count({ index: 'test' }, {}, (err: any, result: any) => {}))