-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Reporting] Rewrite addForceNowQuerystring to getFullUrls #44851
Merged
tsullivan
merged 14 commits into
elastic:master
from
tsullivan:reporting/screenshots-with-absolute-urls-consistency
Sep 9, 2019
Merged
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
aaaf651
this is the one
tsullivan 1737905
this could break a job nbd
tsullivan 9a86dc3
get_full_url to observe PNG and PDF job payload types
tsullivan 5c46d7d
fix typescripts
tsullivan f010372
fix ts in tests
tsullivan f162de7
fix more types
tsullivan ed93c41
cosmetic
tsullivan d1186b8
remove PDF execute compatibility shim test -- that stuff is handled i…
tsullivan 14c199f
fix unit test
tsullivan c23af64
remove old strings
tsullivan 0aae22f
Remove pdf execute compatibility shim entirely
tsullivan 26b9431
combine the 2 maps
tsullivan 96a2e3c
More reject matchers in the test
tsullivan c4e19dd
Merge branch 'master' into reporting/screenshots-with-absolute-urls-c…
tsullivan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
93 changes: 0 additions & 93 deletions
93
...gacy/plugins/reporting/export_types/common/execute_job/add_force_now_query_string.test.ts
This file was deleted.
Oops, something went wrong.
60 changes: 0 additions & 60 deletions
60
...ck/legacy/plugins/reporting/export_types/common/execute_job/add_force_now_query_string.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ | |
|
||
import { createMockServer } from '../../../test_helpers/create_mock_server'; | ||
import { getConditionalHeaders, getCustomLogo } from './index'; | ||
import { JobDocPayload } from '../../../types'; | ||
import { JobDocPayloadPDF } from '../../printable_pdf/types'; | ||
|
||
let mockServer: any; | ||
beforeEach(() => { | ||
|
@@ -26,15 +28,7 @@ describe('conditions', () => { | |
}; | ||
|
||
const { conditionalHeaders } = await getConditionalHeaders({ | ||
job: { | ||
title: 'cool-job-bro', | ||
type: 'csv', | ||
jobParams: { | ||
savedObjectId: 'abc-123', | ||
isImmediate: false, | ||
savedObjectType: 'search', | ||
}, | ||
}, | ||
job: {} as JobDocPayload, | ||
filteredHeaders: permittedHeaders, | ||
server: mockServer, | ||
}); | ||
|
@@ -51,15 +45,7 @@ describe('conditions', () => { | |
}; | ||
|
||
const { conditionalHeaders } = await getConditionalHeaders({ | ||
job: { | ||
title: 'cool-job-bro', | ||
type: 'csv', | ||
jobParams: { | ||
savedObjectId: 'abc-123', | ||
isImmediate: false, | ||
savedObjectType: 'search', | ||
}, | ||
}, | ||
job: {} as JobDocPayload, | ||
filteredHeaders: permittedHeaders, | ||
server: mockServer, | ||
}); | ||
|
@@ -80,15 +66,7 @@ describe('conditions', () => { | |
}; | ||
|
||
const { conditionalHeaders } = await getConditionalHeaders({ | ||
job: { | ||
title: 'cool-job-bro', | ||
type: 'csv', | ||
jobParams: { | ||
savedObjectId: 'abc-123', | ||
isImmediate: false, | ||
savedObjectType: 'search', | ||
}, | ||
}, | ||
job: {} as JobDocPayload, | ||
filteredHeaders: permittedHeaders, | ||
server: mockServer, | ||
}); | ||
|
@@ -105,15 +83,7 @@ describe('conditions', () => { | |
}; | ||
|
||
const { conditionalHeaders } = await getConditionalHeaders({ | ||
job: { | ||
title: 'cool-job-bro', | ||
type: 'csv', | ||
jobParams: { | ||
savedObjectId: 'abc-123', | ||
isImmediate: false, | ||
savedObjectType: 'search', | ||
}, | ||
}, | ||
job: {} as JobDocPayload, | ||
filteredHeaders: permittedHeaders, | ||
server: mockServer, | ||
}); | ||
|
@@ -128,15 +98,7 @@ describe('conditions', () => { | |
}; | ||
|
||
const { conditionalHeaders } = await getConditionalHeaders({ | ||
job: { | ||
title: 'cool-job-bro', | ||
type: 'csv', | ||
jobParams: { | ||
savedObjectId: 'abc-123', | ||
isImmediate: false, | ||
savedObjectType: 'search', | ||
}, | ||
}, | ||
job: {} as JobDocPayload, | ||
filteredHeaders: permittedHeaders, | ||
server: mockServer, | ||
}); | ||
|
@@ -159,15 +121,7 @@ describe('conditions', () => { | |
}; | ||
|
||
const { conditionalHeaders } = await getConditionalHeaders({ | ||
job: { | ||
title: 'cool-job-bro', | ||
type: 'csv', | ||
jobParams: { | ||
savedObjectId: 'abc-123', | ||
isImmediate: false, | ||
savedObjectType: 'search', | ||
}, | ||
}, | ||
job: {} as JobDocPayload, | ||
filteredHeaders: permittedHeaders, | ||
server: mockServer, | ||
}); | ||
|
@@ -184,15 +138,7 @@ describe('conditions', () => { | |
}; | ||
|
||
const { conditionalHeaders } = await getConditionalHeaders({ | ||
job: { | ||
title: 'cool-job-bro', | ||
type: 'csv', | ||
jobParams: { | ||
savedObjectId: 'abc-123', | ||
isImmediate: false, | ||
savedObjectType: 'search', | ||
}, | ||
}, | ||
job: {} as JobDocPayload, | ||
filteredHeaders: permittedHeaders, | ||
server: mockServer, | ||
}); | ||
|
@@ -208,15 +154,7 @@ test('uses basePath from job when creating saved object service', async () => { | |
}; | ||
|
||
const { conditionalHeaders } = await getConditionalHeaders({ | ||
job: { | ||
title: 'cool-job-bro', | ||
type: 'csv', | ||
jobParams: { | ||
savedObjectId: 'abc-123', | ||
isImmediate: false, | ||
savedObjectType: 'search', | ||
}, | ||
}, | ||
job: {} as JobDocPayload, | ||
filteredHeaders: permittedHeaders, | ||
server: mockServer, | ||
}); | ||
|
@@ -226,16 +164,7 @@ test('uses basePath from job when creating saved object service', async () => { | |
|
||
const jobBasePath = '/sbp/s/marketing'; | ||
await getCustomLogo({ | ||
job: { | ||
title: 'cool-job-bro', | ||
type: 'csv', | ||
jobParams: { | ||
savedObjectId: 'abc-123', | ||
isImmediate: false, | ||
savedObjectType: 'search', | ||
}, | ||
basePath: jobBasePath, | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. putting a custom logo on a CSV export would make no sense |
||
job: { basePath: jobBasePath } as JobDocPayloadPDF, | ||
conditionalHeaders, | ||
server: mockServer, | ||
}); | ||
|
@@ -252,15 +181,7 @@ test(`uses basePath from server if job doesn't have a basePath when creating sav | |
}; | ||
|
||
const { conditionalHeaders } = await getConditionalHeaders({ | ||
job: { | ||
title: 'cool-job-bro', | ||
type: 'csv', | ||
jobParams: { | ||
savedObjectId: 'abc-123', | ||
isImmediate: false, | ||
savedObjectType: 'search', | ||
}, | ||
}, | ||
job: {} as JobDocPayload, | ||
filteredHeaders: permittedHeaders, | ||
server: mockServer, | ||
}); | ||
|
@@ -269,15 +190,7 @@ test(`uses basePath from server if job doesn't have a basePath when creating sav | |
mockServer.uiSettingsServiceFactory().get.mockReturnValue(logo); | ||
|
||
await getCustomLogo({ | ||
job: { | ||
title: 'cool-job-bro', | ||
type: 'csv', | ||
jobParams: { | ||
savedObjectId: 'abc-123', | ||
isImmediate: false, | ||
savedObjectType: 'search', | ||
}, | ||
}, | ||
job: {} as JobDocPayloadPDF, | ||
conditionalHeaders, | ||
server: mockServer, | ||
}); | ||
|
@@ -291,15 +204,7 @@ describe('config formatting', () => { | |
test(`lowercases server.host`, async () => { | ||
mockServer = createMockServer({ settings: { 'server.host': 'COOL-HOSTNAME' } }); | ||
const { conditionalHeaders } = await getConditionalHeaders({ | ||
job: { | ||
title: 'cool-job-bro', | ||
type: 'csv', | ||
jobParams: { | ||
savedObjectId: 'abc-123', | ||
isImmediate: false, | ||
savedObjectType: 'search', | ||
}, | ||
}, | ||
job: {} as JobDocPayload, | ||
filteredHeaders: {}, | ||
server: mockServer, | ||
}); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of the tests had mock data like this: job params that don't line up to existing features. The
csv
export type doesn't use savedObjectId and savedObjectType as jobParams. SeeJobParamsDiscoverCsv
is the actual definition. Invalid mocks were part of the reason Typescripting is taking awhile.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies on that -- I believe I wrote these a while ago. You're dead-on about TS taking so long: I believe I originally wrote these mocks with little TS input, so they were likely incorrect. In any case, sorry!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha, it's not problem. Mostly I write these things down because I learn as I go