[Ingest Manager] Fix agent tests and short polling timeout (#79442)

This commit is contained in:
Nicolas Chaulet 2020-10-05 13:10:17 -04:00 committed by GitHub
parent 5812217631
commit 28278abdda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 4 deletions

View file

@ -11,7 +11,12 @@
import { IRouter, RouteValidationResultFactory } from 'src/core/server';
import Ajv from 'ajv';
import { PLUGIN_ID, AGENT_API_ROUTES, LIMITED_CONCURRENCY_ROUTE_TAG } from '../../constants';
import {
PLUGIN_ID,
AGENT_API_ROUTES,
LIMITED_CONCURRENCY_ROUTE_TAG,
AGENT_POLLING_REQUEST_TIMEOUT_MARGIN_MS,
} from '../../constants';
import {
GetAgentsRequestSchema,
GetOneAgentRequestSchema,
@ -124,7 +129,8 @@ export const registerRoutes = (router: IRouter, config: IngestManagerConfigType)
},
options: {
tags: [],
...(pollingRequestTimeout
// If the timeout is too short, do not set socket idle timeout and rely on Kibana global socket timeout
...(pollingRequestTimeout && pollingRequestTimeout > AGENT_POLLING_REQUEST_TIMEOUT_MARGIN_MS
? {
timeout: {
idleSocket: pollingRequestTimeout,

View file

@ -167,6 +167,12 @@ export async function createAgentActionFromPolicyAction(
function getPollingTimeoutMs() {
const pollingTimeoutMs = appContextService.getConfig()?.fleet.pollingRequestTimeout ?? 0;
// If polling timeout is too short do not use margin
if (pollingTimeoutMs <= AGENT_POLLING_REQUEST_TIMEOUT_MARGIN_MS) {
return pollingTimeoutMs;
}
// Set a timeout 20s before the real timeout to have a chance to respond an empty response before socket timeout
return Math.max(
pollingTimeoutMs - AGENT_POLLING_REQUEST_TIMEOUT_MARGIN_MS,

View file

@ -19,8 +19,7 @@ export default function (providerContext: FtrProviderContext) {
const supertestWithoutAuth = getSupertestWithoutAuth(providerContext);
const esClient = getService('es');
// Failing: See https://github.com/elastic/kibana/issues/75241
describe.skip('fleet_agent_flow', () => {
describe('fleet_agent_flow', () => {
skipIfNoDockerRegistry(providerContext);
before(async () => {
await esArchiver.load('empty_kibana');