Skip to content

Commit

Permalink
Log full index on error
Browse files Browse the repository at this point in the history
  • Loading branch information
sorenlouv committed Dec 24, 2019
1 parent 4c5818e commit 6b2c986
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion x-pack/test/api_integration/apis/apm/feature_controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default function featureControlsTests({ getService }: FtrProviderContext)
const security = getService('security');
const spaces = getService('spaces');
const log = getService('log');
const es = getService('legacyEs');

const start = encodeURIComponent(new Date(Date.now() - 10000).toISOString());
const end = encodeURIComponent(new Date().toISOString());
Expand All @@ -37,6 +38,7 @@ export default function featureControlsTests({ getService }: FtrProviderContext)
};
expectForbidden: (result: any) => void;
expectResponse: (result: any) => void;
onExpectationFail?: () => Promise<any>;
}
const endpoints: Endpoint[] = [
{
Expand Down Expand Up @@ -141,6 +143,13 @@ export default function featureControlsTests({ getService }: FtrProviderContext)
},
expectForbidden: expect404,
expectResponse: expect200,
onExpectationFail: async () => {
const res = await es.search({
index: '.apm-agent-configuration',
});

console.warn(JSON.stringify(res, null, 2));
},
},
];

Expand Down Expand Up @@ -218,7 +227,9 @@ export default function featureControlsTests({ getService }: FtrProviderContext)
endpoint.expectResponse(result);
}
} catch (e) {
console.warn(`Expectation for endpoint: "${endpoint.req.url}" failed`);
if (endpoint.onExpectationFail) {
await endpoint.onExpectationFail();
}

const { statusCode, body, req } = result.response;
throw new Error(
Expand Down

0 comments on commit 6b2c986

Please sign in to comment.