-
Notifications
You must be signed in to change notification settings - Fork 917
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
Follow up on #9048 by updating data and utilities #9060
Conversation
Feature branch PRs: opensearch-project#9038 opensearch-project#9006 Signed-off-by: Anan <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9060 +/- ##
=======================================
Coverage 60.86% 60.86%
=======================================
Files 3808 3808
Lines 91209 91209
Branches 14410 14410
=======================================
Hits 55516 55516
+ Misses 32156 32153 -3
- Partials 3537 3540 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
||
export const BASE_PATH = Cypress.config().baseUrl; | ||
export const DATASOURCE_NAME = 'test_cluster'; | ||
export const DATASOURCE_URL = 'http://localhost:9200'; |
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.
We can update the DataSource_URL to use the openSearchUrl: 'http://localhost:9200'
defined within this file
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.
will clean out all the base path and url in another follow-up
1ce8fe6
to
b7f4609
Compare
@@ -90,7 +90,7 @@ jobs: | |||
options: --user 1001 | |||
env: | |||
START_CMD: ${{ matrix.config == 'query_enhanced' && | |||
'node scripts/opensearch_dashboards --dev --no-base-path --no-watch --savedObjects.maxImportPayloadBytes=10485760 --server.maxPayloadBytes=1759977 --logging.json=false --data.search.aggs.shardDelay.enabled=true --csp.warnLegacyBrowsers=false --uiSettings.overrides["query:enhancements:enabled"]=true --uiSettings.overrides[''home:useNewHomePage'']=true --data_source.enabled=true --opensearch.ignoreVersionMismatch=true' || | |||
'node scripts/opensearch_dashboards --dev --no-base-path --no-watch --savedObjects.maxImportPayloadBytes=10485760 --server.maxPayloadBytes=1759977 --logging.json=false --data.search.aggs.shardDelay.enabled=true --csp.warnLegacyBrowsers=false --uiSettings.overrides["query:enhancements:enabled"]=true --uiSettings.overrides[''home:useNewHomePage'']=true --data_source.enabled=true --workspace.enable=true --opensearch.ignoreVersionMismatch=true' || |
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.
Typo --workspace.enable=true
should be --workspace.enabled=true
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.
nice. thanks a lot.
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.
We need to have tests run with and without workspaces being enabled.
// Load test data | ||
cy.setupTestData( | ||
[ | ||
'cypress/fixtures/query_enhancements/data-logs-1/data_logs_small_time_1.mapping.json', |
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.
if we refactor the structure of the fixtures to not care about the plugin for example cypress/fixtures/{file name}
we could make setupTestData
just automatically set the path so that all we have to do is pass the file name for example
setupTestData('small_time_range_1.mapping.json')
then in the setupTestData we automatically just preprend cypress/fixtures/
to it. this would make it easier and less prone to error if the file path is too long
* @param {string} [options.credentials.username] Username for basic auth | ||
* @param {string} [options.credentials.password] Password for basic auth | ||
*/ | ||
Cypress.Commands.add('addDataSource', (options) => { |
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.
whats specific about query enhancements ? this seems like it should be globally used
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.
why workspace-plugin
? query_enhancements
is a plugin as well so we should just remove the plugin
@@ -5,3 +5,28 @@ | |||
|
|||
import '../utils/commands'; | |||
import '../utils/apps/commands'; | |||
import '../utils/dashboards/workspace-plugin/commands'; |
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.
imo the commands should be exported in dashboards/commands
and then we just import it instead of nesting a plugin
const { TestDataGenerator } = require('./test_data_generator'); | ||
|
||
// Need to update different path for multiple clusters | ||
const DEFAULT_PATH = |
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.
nested default path that points to a plugin fixture. we shouldn't do this we should use cypress configuration to set these values in the env this will likely get lost
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.
what javascript?
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.
why we moving to integration/core-opensearch-dashboards/opensearch-dashboards
this is too long and what other tests would exist in this repo besides the core opensearch dashboards tests?
cypress/lib/test-fixture-handler.js
Outdated
*/ | ||
|
||
export class TestFixtureHandler { | ||
constructor(inputTestRunner, openSearchUrl = 'localhost:9200') { |
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.
we aren't we pulling from the cypyress environment variable ?
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.
updated
cypress/lib/test-fixture-handler.js
Outdated
} | ||
|
||
_extractIndexNameFromPath(filepath) { | ||
const filename = filepath.split('/').pop(); |
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.
i dont think this is worth it and requires knowing the system. to the point where it might just be easier to require the index name as apart of the file fixture
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.
we don't use this one. it is for easy migration.
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
Cypress.Commands.add('selectFromDataSourceSelector', (dataSourceTitle, dataSourceId) => { |
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.
seeing this as a datasource command as well im not positive what goes into utils/commands
and what goes into query_enhancements/commands
which all have a data source command
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.
we don't use this one. it is for easy migration.
|
||
Cypress.Commands.add('selectFromDataSourceSelector', (dataSourceTitle, dataSourceId) => { | ||
// clean up the input field | ||
cy.wait(1000); |
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.
:( cy.wait make tests flaky
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.
we don't use this one. it is for easy migration.
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export function removeSampleDataAndWorkspace(url, workspaceName) { |
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.
this seems like util functions but they are tests. if this helper functions fail does the entire test fail?
if so this seems wrong. we shouldn't use E2E testing if we are doing test setup. it's too slow and flaky. we should use the saved objects api which workspaces supports and just execute queries.
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.
we don't use this one. it is for easy migration.
@@ -86,7 +86,7 @@ | |||
"release_note:generate": "scripts/use_node scripts/generate_release_note", | |||
"cypress:run-without-security": "env TZ=America/Los_Angeles NO_COLOR=1 cypress run --env SECURITY_ENABLED=false", | |||
"cypress:run-with-security": "env TZ=America/Los_Angeles NO_COLOR=1 cypress run --env SECURITY_ENABLED=true,openSearchUrl=https://localhost:9200,WAIT_FOR_LOADER_BUFFER_MS=500", | |||
"osd:ciGroup10": "echo \"cypress/integration/apps/query_enhancements/queries.spec.js,cypress/integration/apps/query_enhancements/dataset_selector.spec.js\"", | |||
"osd:ciGroup10": "echo \"cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/query_enhancements/a_check.spec.js\"", |
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.
so we are not gunna execute the queries.spec
and dataset_selector.spec
?
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.
explained below
cypress/support/e2e.js
Outdated
|
||
import { TestFixtureHandler } from '../lib/test-fixture-handler'; | ||
|
||
Cypress.Commands.add('setupTestData', (mappingFiles, dataFiles) => { |
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.
shouldn't this be in the utils/commands
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.
updated
cypress/lib/test-fixture-handler.js
Outdated
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.
did the linter not catch this file name? i think we are suppose to use _
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.
changed
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.
290c3cb
to
454b7e3
Compare
Signed-off-by: Anan <[email protected]>
454b7e3
to
6fa6cb6
Compare
Signed-off-by: Anan <[email protected]>
0636882
to
474c2e5
Compare
Description
Merge feature branch PRs:
Add workspace utility #9038 Add test data for query enhancement functional tests #9006
Add sample test a_check.spec.js
Update utilities and data
To Run
Issues Resolved
NA
Changelog
Check List
yarn test:jest
yarn test:jest_integration