-
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
Merged
tsullivan
merged 25 commits into
elastic:main
from
tsullivan:reporting/tests-serverless-improvements-ii
Oct 24, 2024
Merged
Changes from 13 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
11351b7
fix "management: deletion" test by loading necessary archives
tsullivan 2c3ae7b
Merge branch 'main' into reporting/tests-serverless-improvements-ii
tsullivan d7a2995
Merge branch 'main' into reporting/tests-serverless-improvements-ii
tsullivan 4402169
Merge branch 'main' into reporting/tests-serverless-improvements-ii
tsullivan a3ae988
use samlAuth service and cookieHeader for internal API
dmlemeshko a2a8e1b
Merge branch 'main' into reporting/tests-serverless-improvements-ii
dmlemeshko 46ba5d8
Merge branch 'main' into reporting/tests-serverless-improvements-ii
tsullivan dce635b
unload es archive and delete saved objects after the test run
tsullivan 11a32e1
Use cookie credentials for internal requests
tsullivan a5fb38a
Use cookie credentials instead of role credentials
tsullivan 4a4f9c2
Merge branch 'main' into reporting/tests-serverless-improvements-ii
tsullivan 0bea1a5
use api key credentials for datastream management api
tsullivan 2d2c790
Merge branch 'main' into reporting/tests-serverless-improvements-ii
tsullivan db3fa48
invalidate the api key in the after() block of test
tsullivan f530496
Merge branch 'main' into reporting/tests-serverless-improvements-ii
tsullivan b3f9765
Getting the internalReqHeader is not async
tsullivan 5305cdd
Ensure the functional test job is allowed to finish
tsullivan 631e9f1
Fix internalReqHeader
tsullivan c795446
Fix an instance of waiting for the job to finish
tsullivan 03c5617
Merge branch 'main' into reporting/tests-serverless-improvements-ii
tsullivan dd877b2
fix a broken test
tsullivan ab5a79e
Merge branch 'reporting/tests-serverless-improvements-ii' of github.c…
tsullivan 97d4836
Merge branch 'main' into reporting/tests-serverless-improvements-ii
tsullivan 8e4ee0f
remove inessential differences
tsullivan ba8a7a0
Merge branch 'main' into reporting/tests-serverless-improvements-ii
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
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,8 +6,12 @@ | |
*/ | ||
|
||
import { expect } from 'expect'; | ||
import { | ||
CookieCredentials, | ||
InternalRequestHeader, | ||
RoleCredentials, | ||
} from '@kbn/ftr-common-functional-services'; | ||
import { FtrProviderContext } from '../../../ftr_provider_context'; | ||
import { InternalRequestHeader, RoleCredentials } from '../../../../shared/services'; | ||
|
||
export default function ({ getService }: FtrProviderContext) { | ||
const esArchiver = getService('esArchiver'); | ||
|
@@ -17,6 +21,8 @@ export default function ({ getService }: FtrProviderContext) { | |
const supertestWithoutAuth = getService('supertestWithoutAuth'); | ||
const svlUserManager = getService('svlUserManager'); | ||
let roleAuthc: RoleCredentials; | ||
const samlAuth = getService('samlAuth'); | ||
let cookieCredentials: CookieCredentials; | ||
let internalReqHeader: InternalRequestHeader; | ||
|
||
const archives: Record<string, { data: string; savedObjects: string }> = { | ||
|
@@ -30,6 +36,7 @@ export default function ({ getService }: FtrProviderContext) { | |
const generatedReports = new Set<string>(); | ||
before(async () => { | ||
roleAuthc = await svlUserManager.createM2mApiKeyWithRoleScope('admin'); | ||
cookieCredentials = await samlAuth.getM2MApiCookieCredentialsWithRoleScope('admin'); | ||
internalReqHeader = svlCommonApi.getInternalRequestHeader(); | ||
|
||
await esArchiver.load(archives.ecommerce.data); | ||
|
@@ -48,7 +55,7 @@ export default function ({ getService }: FtrProviderContext) { | |
title: 'Ecommerce Data', | ||
version: '8.15.0', | ||
}, | ||
roleAuthc, | ||
cookieCredentials, | ||
internalReqHeader | ||
); | ||
|
||
|
@@ -57,19 +64,18 @@ export default function ({ getService }: FtrProviderContext) { | |
|
||
after(async () => { | ||
for (const reportId of generatedReports) { | ||
await reportingAPI.deleteReport(reportId, roleAuthc, internalReqHeader); | ||
await reportingAPI.deleteReport(reportId, cookieCredentials, internalReqHeader); | ||
} | ||
|
||
await esArchiver.unload(archives.ecommerce.data); | ||
await kibanaServer.importExport.unload(archives.ecommerce.savedObjects); | ||
await svlUserManager.invalidateM2mApiKeyWithRoleScope(roleAuthc); | ||
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. Tim, you need to keep it and invalidate API key you created in line #38 |
||
}); | ||
|
||
it('uses the datastream configuration', async () => { | ||
const { status, body } = await supertestWithoutAuth | ||
.get(`/api/index_management/data_streams/.kibana-reporting`) | ||
.set(internalReqHeader) | ||
.set(roleAuthc.apiKeyHeader); | ||
.set(roleAuthc.apiKeyHeader); // use API key since the datastream management API is a public endpoint | ||
|
||
svlCommonApi.assertResponseStatusCode(200, status, body); | ||
|
||
|
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
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.
NOTE: cookie credentials do not need to be invalidated after the test