-
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][Serverless E2E Tests] #163354
Merged
Merged
Changes from 71 commits
Commits
Show all changes
181 commits
Select commit
Hold shift + click to select a range
e62ad19
initial commit
rshen91 1470889
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine c41e5ad
wip
rshen91 f41317f
Merge remote-tracking branch 'origin/e2e-svl-reporting' into e2e-svl-…
rshen91 360b635
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine 5a95fca
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine 58b58f0
wip
rshen91 6038c09
Reporting Test Serverless structure: api_integration
tsullivan 6d49f1e
Merge pull request #7 from tsullivan/e2e-svl-reporting
rshen91 b4883c9
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine aa7e3c4
Merge branch 'main' into e2e-svl-reporting
rshen91 c0809d9
add initial functional test for reporting mgmt app
tsullivan 11228fc
update test-subj in reporting mgmt
tsullivan c9c8e88
Check for enabled of each export_type
tsullivan 5d7f02a
Provide Reporting API services for functional
tsullivan eb5e323
Functional test: user can see their report
tsullivan d0f5df5
un-adjust code for later
tsullivan 40e2af9
Merge pull request #8 from tsullivan/e2e-svl-reporting
rshen91 9e38fd1
Merge branch 'main' into e2e-svl-reporting
rshen91 4685cb7
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine f5e78b2
initial generate_csv_discover tests no auth yet
rshen91 42cf233
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine e3bce42
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine a24be94
wip
rshen91 3125f76
Merge remote-tracking branch 'origin/e2e-svl-reporting' into e2e-svl-…
rshen91 45616a2
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine c9ca4b2
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine abdc9a3
add dashboard csv ftr
rshen91 6a10b4f
Merge remote-tracking branch 'origin/e2e-svl-reporting' into e2e-svl-…
rshen91 a336e16
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine 7e21a8c
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine 1c1b9ce
Merge branch 'main' into e2e-svl-reporting
rshen91 6accc19
remove unnecessary comment
rshen91 cc370d4
Merge branch 'main' into e2e-svl-reporting
rshen91 98800b3
wip
rshen91 be2e5eb
Merge branch 'main' into e2e-svl-reporting
rshen91 496ce6e
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine b58240c
update
rshen91 820182f
Merge remote-tracking branch 'origin/e2e-svl-reporting' into e2e-svl-…
rshen91 85ac7cc
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine 1fed8b6
fix delete report by id and remove deleteAllreports that was returnin…
rshen91 04854ea
Merge remote-tracking branch 'origin/e2e-svl-reporting' into e2e-svl-…
rshen91 00e87f8
Merge branch 'main' into e2e-svl-reporting
rshen91 5431f6e
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine 4cf3655
update snapshot
rshen91 a742964
Merge branch 'main' into e2e-svl-reporting
rshen91 4654cce
Merge branch 'main' into e2e-svl-reporting
rshen91 583a595
Merge branch 'main' into e2e-svl-reporting
rshen91 80d2dbd
Merge branch 'main' into e2e-svl-reporting
rshen91 0b90af4
Merge branch 'main' into e2e-svl-reporting
rshen91 d7d6832
Merge branch 'main' into e2e-svl-reporting
rshen91 46e04f1
create logs file with canvas
rshen91 3489465
Merge remote-tracking branch 'origin/main' into e2e-svl-reporting
rshen91 a18f49c
Merge branch 'main' into e2e-svl-reporting
rshen91 68b221c
Merge branch 'main' into e2e-svl-reporting
rshen91 bbaac3f
Merge branch 'main' into e2e-svl-reporting
rshen91 ffbe8ca
Merge branch 'main' into e2e-svl-reporting
rshen91 7c45858
Merge branch 'main' into e2e-svl-reporting
rshen91 9a79b93
Merge remote-tracking branch 'upstream/main' into e2e-svl-reporting
rshen91 5061259
update SOPath in test for canvas logs json
rshen91 5cac5bc
fix
rshen91 2149c54
Merge branch 'main' into e2e-svl-reporting
rshen91 cf76141
Merge branch 'main' into e2e-svl-reporting
rshen91 081ebf1
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine 36d26e4
Merge branch 'main' into e2e-svl-reporting
rshen91 38a5893
Reset non-serverless changes
tsullivan b4965fe
Remove some extra methods from the reporting test API
tsullivan 2dc0add
new reporting test archives for serverless
tsullivan 3338291
Merge pull request #9 from tsullivan/e2e-svl-reporting
rshen91 ee45d16
Merge branch 'main' into e2e-svl-reporting
rshen91 48cca35
Merge branch 'main' into e2e-svl-reporting
rshen91 b73b950
skip for schema validation
rshen91 2b78633
Merge branch 'main' into e2e-svl-reporting
rshen91 923f5f9
undo skip
rshen91 cc6249d
Merge remote-tracking branch 'upstream/main' into e2e-svl-reporting
rshen91 63553b0
Merge remote-tracking branch 'origin/e2e-svl-reporting' into e2e-svl-…
rshen91 2057a5b
Merge branch 'main' into e2e-svl-reporting
rshen91 504040c
skip test for telemetry update
rshen91 43dfa55
Merge branch 'main' into e2e-svl-reporting
rshen91 d313586
Merge branch 'main' into e2e-svl-reporting
rshen91 6a028c7
Merge remote-tracking branch 'upstream/main' into e2e-svl-reporting
rshen91 80b835b
Merge remote-tracking branch 'origin/e2e-svl-reporting' into e2e-svl-…
rshen91 1c6ffaf
add comments
rshen91 0ea1500
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine ed22197
Merge branch 'main' into e2e-svl-reporting
rshen91 d573f4b
Merge branch 'main' into e2e-svl-reporting
rshen91 a2698d1
Merge branch 'main' into e2e-svl-reporting
rshen91 693ba5a
Merge branch 'main' into e2e-svl-reporting
rshen91 4584770
Merge branch 'main' into e2e-svl-reporting
rshen91 2390734
Merge remote-tracking branch 'upstream/main' into e2e-svl-reporting
rshen91 37f39fe
Merge branch 'main' into e2e-svl-reporting
rshen91 aadf1be
change order of loading test suites
rshen91 386a2da
Merge remote-tracking branch 'origin/e2e-svl-reporting' into e2e-svl-…
rshen91 d65e3c1
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine 9f00597
Merge remote-tracking branch 'upstream/main' into e2e-svl-reporting
rshen91 64b32d8
Merge remote-tracking branch 'origin/e2e-svl-reporting' into e2e-svl-…
rshen91 6e03402
revert
rshen91 95bf706
Merge branch 'main' into e2e-svl-reporting
rshen91 32e7d72
Merge branch 'main' into e2e-svl-reporting
rshen91 6fea5bf
Merge branch 'main' into e2e-svl-reporting
rshen91 034df9a
Merge branch 'main' into e2e-svl-reporting
rshen91 56e7d4c
Merge remote-tracking branch 'upstream/main' into e2e-svl-reporting
rshen91 26e9f53
update
rshen91 78c5054
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine 07c684b
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine 791e9ab
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine 9000230
update
rshen91 df3de6b
Merge remote-tracking branch 'origin/e2e-svl-reporting' into e2e-svl-…
rshen91 338c9d8
Merge remote-tracking branch 'upstream/main' into e2e-svl-reporting
rshen91 7391703
Merge branch 'main' into e2e-svl-reporting
rshen91 d26fdaa
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine d530fc4
fix
rshen91 0ad8e31
Merge remote-tracking branch 'origin/e2e-svl-reporting' into e2e-svl-…
rshen91 7c2cd24
Merge remote-tracking branch 'upstream/main' into e2e-svl-reporting
rshen91 b72e3e9
Merge branch 'main' into e2e-svl-reporting
rshen91 29f1d9e
Merge branch 'main' into e2e-svl-reporting
rshen91 7e52eb2
Merge remote-tracking branch 'upstream/main' into e2e-svl-reporting
rshen91 b273942
Merge remote-tracking branch 'origin/e2e-svl-reporting' into e2e-svl-…
rshen91 da2bbe0
fix
rshen91 a976b8b
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine 83c7137
update
rshen91 b3c5f50
Merge remote-tracking branch 'upstream/main' into e2e-svl-reporting
rshen91 0ecd611
Merge branch 'main' into e2e-svl-reporting
rshen91 6cfa759
Merge branch 'main' into e2e-svl-reporting
rshen91 cf5e1c3
Merge branch 'main' into e2e-svl-reporting
rshen91 670a66f
Merge branch 'main' into e2e-svl-reporting
rshen91 be9b531
Merge branch 'main' into e2e-svl-reporting
rshen91 bd176c8
Merge branch 'main' into e2e-svl-reporting
rshen91 4a160a8
Merge remote-tracking branch 'upstream/main' into e2e-svl-reporting
rshen91 fb7a306
code review
rshen91 6b86479
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine f1795da
fix management tests
rshen91 f2ce7f4
Merge remote-tracking branch 'origin/e2e-svl-reporting' into e2e-svl-…
rshen91 9d4ab7d
Merge branch 'main' into e2e-svl-reporting
rshen91 7e0209b
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine d85dc9b
fix
rshen91 2dd26cc
Merge remote-tracking branch 'origin/e2e-svl-reporting' into e2e-svl-…
rshen91 be571bb
Merge remote-tracking branch 'upstream/main' into e2e-svl-reporting
rshen91 46442f6
update
rshen91 026fc1f
Merge remote-tracking branch 'upstream/main' into e2e-svl-reporting
rshen91 6362de6
Update x-pack/test_serverless/functional/test_suites/common/reporting…
rshen91 f3e43cd
update
rshen91 72fb493
Merge remote-tracking branch 'origin/e2e-svl-reporting' into e2e-svl-…
rshen91 7ac6a1c
Merge branch 'main' into e2e-svl-reporting
rshen91 e24f06d
add reporting to common configs in search and obs
rshen91 aa59405
unskip
rshen91 477268d
move reporting svl tests to group1 instead of group2d
rshen91 a9822cb
Merge branch 'main' into e2e-svl-reporting
rshen91 de6512c
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine ab999be
cant log in
rshen91 7dac314
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine fcb6488
update management to have login
rshen91 ed4d382
Merge remote-tracking branch 'origin/e2e-svl-reporting' into e2e-svl-…
rshen91 fa9b187
Merge branch 'main' into e2e-svl-reporting
rshen91 896ef2d
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine 862b2c0
Merge branch 'main' into e2e-svl-reporting
rshen91 919d5b2
code review
rshen91 63cfcb9
Merge remote-tracking branch 'upstream/main' into e2e-svl-reporting
rshen91 2de1275
Merge remote-tracking branch 'origin/e2e-svl-reporting' into e2e-svl-…
rshen91 89a9592
update
rshen91 df66ce1
Merge remote-tracking branch 'upstream/main' into e2e-svl-reporting
rshen91 f975c62
Merge branch 'main' into e2e-svl-reporting
rshen91 409cdea
update snapshots
rshen91 5722e8a
Merge remote-tracking branch 'upstream/main' into e2e-svl-reporting
rshen91 b31fa63
Merge branch 'main' into e2e-svl-reporting
rshen91 d2283a0
Merge branch 'main' into e2e-svl-reporting
rshen91 7c96b84
Merge remote-tracking branch 'upstream/main' into e2e-svl-reporting
rshen91 3294686
update in config groups
rshen91 1fb31ee
Merge remote-tracking branch 'upstream/main' into e2e-svl-reporting
rshen91 fb1737d
Merge branch 'main' into e2e-svl-reporting
rshen91 dcdcce4
Merge branch 'main' into e2e-svl-reporting
rshen91 7eb0a18
update
rshen91 863b518
Merge branch 'main' into e2e-svl-reporting
rshen91 4a929fc
skipping tests that are failing on MKI testing env
rshen91 b43a935
Merge remote-tracking branch 'origin/e2e-svl-reporting' into e2e-svl-…
rshen91 6e44802
Merge branch 'main' into e2e-svl-reporting
rshen91 b207dfc
Merge branch 'main' into e2e-svl-reporting
rshen91 217acc0
fix bad merge
rshen91 bdb5a20
fix
rshen91 192b5be
Merge branch 'main' into e2e-svl-reporting
rshen91 8d9050f
Merge branch 'main' into e2e-svl-reporting
rshen91 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
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
182 changes: 182 additions & 0 deletions
182
x-pack/test_serverless/api_integration/services/svl_reporting.ts
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 |
---|---|---|
@@ -0,0 +1,182 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { X_ELASTIC_INTERNAL_ORIGIN_REQUEST } from '@kbn/core-http-common'; | ||
import { INTERNAL_ROUTES } from '@kbn/reporting-plugin/common/constants'; | ||
import expect from '@kbn/expect'; | ||
import type { ReportingJobResponse } from '@kbn/reporting-plugin/server/types'; | ||
import rison from '@kbn/rison'; | ||
import { FtrProviderContext } from '../ftr_provider_context'; | ||
|
||
const API_HEADER: [string, string] = ['kbn-xsrf', 'reporting']; | ||
const INTERNAL_HEADER: [string, string] = [X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'Kibana']; | ||
|
||
const DATA_ANALYST_PASSWORD = 'data_analyst-password'; | ||
const DATA_ANALYST_ROLE = 'data_analyst_role'; | ||
const DATA_ANALYST_USERNAME = 'data_analyst'; | ||
const REPORTING_ROLE = 'reporting_user_role'; | ||
const REPORTING_USER_PASSWORD = 'reporting_user-password'; | ||
const REPORTING_USER_USERNAME = 'reporting_user'; | ||
|
||
/** | ||
* Services to create roles and users for security testing | ||
*/ | ||
export function SvlReportingServiceProvider({ getService }: FtrProviderContext) { | ||
const security = getService('security'); | ||
const log = getService('log'); | ||
const supertest = getService('supertestWithoutAuth'); | ||
const retry = getService('retry'); | ||
const config = getService('config'); | ||
|
||
return { | ||
DATA_ANALYST_PASSWORD, | ||
DATA_ANALYST_USERNAME, | ||
REPORTING_USER_PASSWORD, | ||
REPORTING_USER_USERNAME, | ||
|
||
/** | ||
* Define a role that DOES NOT grant privileges to create any type of report. | ||
*/ | ||
async createDataAnalystRole() { | ||
await security.role.create(DATA_ANALYST_ROLE, { | ||
metadata: {}, | ||
elasticsearch: { | ||
cluster: [], | ||
indices: [ | ||
{ | ||
names: ['ecommerce'], | ||
privileges: ['read', 'view_index_metadata'], | ||
allow_restricted_indices: false, | ||
}, | ||
], | ||
run_as: [], | ||
}, | ||
kibana: [ | ||
{ | ||
base: ['read'], | ||
feature: {}, | ||
spaces: ['*'], | ||
}, | ||
], | ||
}); | ||
}, | ||
|
||
async createDataAnalystUser() { | ||
await security.user.create(DATA_ANALYST_USERNAME, { | ||
password: DATA_ANALYST_PASSWORD, | ||
roles: [DATA_ANALYST_ROLE], | ||
full_name: 'Data Analyst User', | ||
}); | ||
}, | ||
|
||
/** | ||
* Define a role that DOES grant privileges to create certain types of reports. | ||
*/ | ||
async createReportingRole() { | ||
await security.role.create(REPORTING_ROLE, { | ||
metadata: {}, | ||
elasticsearch: { | ||
cluster: [], | ||
indices: [ | ||
{ | ||
names: ['ecommerce'], | ||
privileges: ['read', 'view_index_metadata'], | ||
allow_restricted_indices: false, | ||
}, | ||
], | ||
run_as: [], | ||
}, | ||
kibana: [ | ||
{ | ||
base: [], | ||
feature: { discover: ['minimal_read', 'generate_report'] }, | ||
spaces: ['*'], | ||
}, | ||
], | ||
}); | ||
}, | ||
|
||
async createReportingUser( | ||
username = REPORTING_USER_USERNAME, | ||
password = REPORTING_USER_PASSWORD | ||
) { | ||
await security.user.create(username, { | ||
password, | ||
roles: [REPORTING_ROLE], | ||
full_name: 'Reporting User', | ||
}); | ||
}, | ||
|
||
/** | ||
* Use the internal API to create any kind of report job | ||
*/ | ||
async createReportJobInternal( | ||
jobType: string, | ||
job: object, | ||
username: string, | ||
password: string | ||
) { | ||
const requestPath = `${INTERNAL_ROUTES.GENERATE_PREFIX}/${jobType}`; | ||
log.debug(`POST request to ${requestPath}`); | ||
|
||
const { status, body } = await supertest | ||
.post(requestPath) | ||
.auth(username, password) | ||
.set(...API_HEADER) | ||
.set(...INTERNAL_HEADER) | ||
.send({ jobParams: rison.encode(job) }); | ||
|
||
expect(status).to.be(200); | ||
|
||
return { | ||
job: (body as ReportingJobResponse).job, | ||
path: (body as ReportingJobResponse).path, | ||
}; | ||
}, | ||
|
||
async waitForJobToFinish( | ||
tsullivan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
downloadReportPath: string, | ||
username: string, | ||
password: string, | ||
options?: { timeout?: number } | ||
) { | ||
await retry.waitForWithTimeout( | ||
`job ${downloadReportPath} finished`, | ||
options?.timeout ?? config.get('timeouts.kibanaReportCompletion'), | ||
async () => { | ||
const response = await supertest | ||
.get(`${downloadReportPath}?elasticInternalOrigin=true`) | ||
.auth(username, password) | ||
.responseType('blob') | ||
.set(...API_HEADER) | ||
.set(...INTERNAL_HEADER); | ||
|
||
if (response.status === 503) { | ||
log.debug(`Report at path ${downloadReportPath} is pending`); | ||
return false; | ||
} | ||
|
||
log.debug(`Report at path ${downloadReportPath} returned code ${response.status}`); | ||
|
||
if (response.status === 200) { | ||
log.debug(`Report at path ${downloadReportPath} is complete`); | ||
return true; | ||
} | ||
|
||
throw new Error(`unexpected status code ${response.status}`); | ||
} | ||
); | ||
}, | ||
|
||
async getCompletedJobOutput(downloadReportPath: string, username: string, password: string) { | ||
tsullivan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const response = await supertest | ||
.get(`${downloadReportPath}?elasticInternalOrigin=true`) | ||
.auth(username, password); | ||
return response.text as unknown; | ||
}, | ||
}; | ||
} |
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.
@rshen91 in serverless tests, for the foreseeable future, it looks like we won't be able to run tests that use custom roles or users. It looks like we need to rely on just the
elastic_serverless
user: that's the user that it automatically logged in the beginning of every functional test.I'm not sure how we can test that users can only see their own reports, but that ability might come later to the serverless tests configuration.
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.
Ah ok I removed the parts of the tests that might not be needed for now in 26e9f53