Skip to content

Commit

Permalink
Fix APM setup_request tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerry350 committed Dec 4, 2019
1 parent 79051b0 commit 85fae62
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/apm/server/lib/helpers/es_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ async function getParamsForSearchRequest(
) {
const { uiSettings } = context.core;
const [indices, includeFrozen] = await Promise.all([
getApmIndices(context.core, context.config),
getApmIndices(context.core.savedObjects.client, context.config),
uiSettings.client.get('search:includeFrozen')
]);

Expand Down
10 changes: 10 additions & 0 deletions x-pack/legacy/plugins/apm/server/lib/helpers/setup_request.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ function getMockRequest() {
client: {
get: jest.fn().mockResolvedValue(false)
}
},
savedObjects: {
client: {
get: jest.fn()
}
}
}
} as unknown) as APMRequestHandlerContext & {
Expand All @@ -65,6 +70,11 @@ function getMockRequest() {
get: jest.Mock<any, any>;
};
};
savedObjects: {
client: {
get: jest.Mock<any, any>;
};
};
};
};

Expand Down
4 changes: 2 additions & 2 deletions x-pack/legacy/plugins/apm/server/lib/helpers/setup_request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ export async function setupRequest<TParams extends SetupRequestParams>(
context: APMRequestHandlerContext<TParams>,
request: KibanaRequest
): Promise<InferSetup<TParams>> {
const { config, core } = context;
const { config } = context;
const { query } = context.params;

const indices = await getApmIndices(core.savedObjects.client, config);
const indices = await getApmIndices(context.core.savedObjects.client, config);

const dynamicIndexPattern = await getDynamicIndexPattern({
context,
Expand Down

0 comments on commit 85fae62

Please sign in to comment.