-
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/Tests] Improvements for task stability in serverless tests #195841
Changes from 24 commits
11351b7
2c3ae7b
d7a2995
4402169
a3ae988
a2a8e1b
46ba5d8
dce635b
11a32e1
a5fb38a
4a4f9c2
0bea1a5
2d2c790
db3fa48
f530496
b3f9765
5305cdd
631e9f1
c795446
03c5617
dd877b2
ab5a79e
97d4836
8e4ee0f
ba8a7a0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,20 +9,20 @@ import expect from '@kbn/expect'; | |
import request from 'supertest'; | ||
|
||
import { DISCOVER_APP_LOCATOR } from '@kbn/discover-plugin/common'; | ||
import { InternalRequestHeader, RoleCredentials } from '@kbn/ftr-common-functional-services'; | ||
import { CookieCredentials, InternalRequestHeader } from '@kbn/ftr-common-functional-services'; | ||
import type { ReportApiJSON } from '@kbn/reporting-common/types'; | ||
import type { JobParamsCsvFromSavedObject } from '@kbn/reporting-export-types-csv-common'; | ||
import { FtrProviderContext } from '../../../ftr_provider_context'; | ||
|
||
export default ({ getService }: FtrProviderContext) => { | ||
const es = getService('es'); | ||
const supertest = getService('supertest'); | ||
const supertestWithoutAuth = getService('supertestWithoutAuth'); | ||
const esArchiver = getService('esArchiver'); | ||
const log = getService('log'); | ||
const reportingAPI = getService('svlReportingApi'); | ||
const svlCommonApi = getService('svlCommonApi'); | ||
const svlUserManager = getService('svlUserManager'); | ||
let roleAuthc: RoleCredentials; | ||
const samlAuth = getService('samlAuth'); | ||
let cookieCredentials: CookieCredentials; | ||
let internalReqHeader: InternalRequestHeader; | ||
|
||
// Helper function | ||
|
@@ -38,7 +38,12 @@ export default ({ getService }: FtrProviderContext) => { | |
}; | ||
log.info(`sending request for query: ${JSON.stringify(job.locatorParams[0].params.query)}`); | ||
|
||
return await reportingAPI.createReportJobInternal('csv_v2', job, roleAuthc, internalReqHeader); | ||
return await reportingAPI.createReportJobInternal( | ||
'csv_v2', | ||
job, | ||
cookieCredentials, | ||
internalReqHeader | ||
); | ||
}; | ||
|
||
describe('CSV Generation from ES|QL', () => { | ||
|
@@ -84,7 +89,7 @@ export default ({ getService }: FtrProviderContext) => { | |
}; | ||
before(async () => { | ||
await loadTimelessData(); | ||
roleAuthc = await svlUserManager.createM2mApiKeyWithRoleScope('admin'); | ||
cookieCredentials = await samlAuth.getM2MApiCookieCredentialsWithRoleScope('admin'); | ||
internalReqHeader = svlCommonApi.getInternalRequestHeader(); | ||
}); | ||
|
||
|
@@ -112,8 +117,8 @@ export default ({ getService }: FtrProviderContext) => { | |
}, | ||
], | ||
})); | ||
await reportingAPI.waitForJobToFinish(path, roleAuthc, internalReqHeader); | ||
response = await supertest.get(path); | ||
await reportingAPI.waitForJobToFinish(path, cookieCredentials, internalReqHeader); | ||
response = await supertestWithoutAuth.get(path).set(cookieCredentials); | ||
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. This test was BROKEN since the original PR. The snapshot showed a 404 error. This is now fixed. 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. oh no :( typical for snapshot tests in a hidden file |
||
csvFile = response.text; | ||
}); | ||
|
||
|
@@ -184,8 +189,8 @@ export default ({ getService }: FtrProviderContext) => { | |
], | ||
title: 'Untitled discover search', | ||
})); | ||
await reportingAPI.waitForJobToFinish(path, roleAuthc, internalReqHeader); | ||
response = await supertest.get(path); | ||
await reportingAPI.waitForJobToFinish(path, cookieCredentials, internalReqHeader); | ||
response = await supertestWithoutAuth.get(path).set(cookieCredentials); | ||
csvFile = response.text; | ||
}); | ||
|
||
|
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.
NOTE: cookie credentials do not need to be invalidated after the test