Skip to content

Commit

Permalink
prevent unhandled error
Browse files Browse the repository at this point in the history
  • Loading branch information
eokoneyo committed Oct 14, 2024
1 parent a481da6 commit 3c2f947
Showing 1 changed file with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function ({ getService }: FtrProviderContext) {
* The tests server config implements a network policy that is designed to disallow the following Canvas worksheet
*/
// Failing: See https://github.com/elastic/kibana/issues/193433
describe.skip('Network Policy', () => {
describe.only('Network Policy', () => {
before(async () => {
await reportingAPI.initLogs(); // includes a canvas worksheet with an offending image URL
});
Expand All @@ -27,20 +27,24 @@ export default function ({ getService }: FtrProviderContext) {
await reportingAPI.teardownLogs();
});

it('should fail job when page violates the network policy', async () => {
it('should fail job when page violates the network policy', async (done) => {
const downloadPath = await reportingAPI.postJob(
`/api/reporting/generate/printablePdfV2?jobParams=(layout:(dimensions:(height:720,width:1080),id:preserve_layout),locatorParams:!((id:CANVAS_APP_LOCATOR,params:(id:workpad-e7464259-0b75-4b8c-81c8-8422b15ff201,page:1,view:workpadPDF),version:'8.16.0')),objectType:'canvas workpad',title:'Workpad of Death',version:'8.16.0')`
);

// Retry the download URL until a "failed" response status is returned
let body: any;
await retry.tryForTime(120000, async () => {
body = (await supertest.get(downloadPath).expect(500)).body;
});
try {
// Retry the download URL until a "failed" response status is returned
let body: any;
await retry.tryForTime(120000, async () => {
body = (await supertest.get(downloadPath).expect(500)).body;
});

expect(body.message).to.match(
/Reporting generation failed: ReportingError\(code: disallowed_outgoing_url_error\)/
);
expect(body.message).to.match(
/Reporting generation failed: ReportingError\(code: disallowed_outgoing_url_error\)/
);
} catch (err) {
done(err);
}
});
});
}

0 comments on commit 3c2f947

Please sign in to comment.