-
Notifications
You must be signed in to change notification settings - Fork 57
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
[Enhancement/Fix] Refactor datasources cypress tests #1323
[Enhancement/Fix] Refactor datasources cypress tests #1323
Conversation
1876d6c
to
cd6ae96
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1323 +/- ##
==========================================
- Coverage 52.92% 51.31% -1.62%
==========================================
Files 302 303 +1
Lines 10587 10586 -1
Branches 2777 2778 +1
==========================================
- Hits 5603 5432 -171
- Misses 4939 5108 +169
- Partials 45 46 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Hi folks, I just left some notes for better understanding of the changes I made.
@@ -18,14 +18,12 @@ module.exports = defineConfig({ | |||
env: { | |||
opensearch: 'localhost:9200', | |||
opensearchDashboards: 'localhost:5601', | |||
security_enabled: true, | |||
security_enabled: false, |
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 security config should be disabled by default because:
- Current testing workflow is fully without security
- I was checking our commands setup, and I saw that we have overwritten the request command based on this config:
-
source code:
Cypress.Commands.overwrite('visit', (originalFn, url, options) => { // Add the basic auth header when security enabled in the OpenSearch cluster // https://github.com/cypress-io/cypress/issues/1288 if (Cypress.env('security_enabled')) { if (options) { options.auth = ADMIN_AUTH; } else { options = { auth: ADMIN_AUTH }; } // Add query parameters - select the default OpenSearch Dashboards tenant options.qs = { security_tenant: 'private' }; return originalFn(url, options); } else { return originalFn(url, options); } });
-
when this config enabled, every single call of the request will be assembled with this
security_tenant=private
option. This is kinda impact the assertion we are having for now. For example, the expected url should not contain the above tenant option.
-
}, | ||
'cypress-watch-and-reload': { | ||
watch: ['common/**', 'public/**', 'server/**'], | ||
}, | ||
e2e: { | ||
// We've imported your old cypress plugins here. |
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 is a cypress update comment, and we should remove this.
run: | | ||
rm -rf ./config/opensearch_dashboards.yml | ||
cat << 'EOT' > ./config/opensearch_dashboards.yml | ||
server.host: "0.0.0.0" |
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 added this dashboards configuration because the current cypress framework is having trouble determine among localhost
, 127.0.0.1
, and ::
.
This is a known issue for cypress + node version 18+: cypress-io/cypress#25397 (comment)
The test results are green: https://github.com/opensearch-project/dashboards-observability/actions/runs/7402757656/job/20141286353?pr=1323#step:22:50 (cc: @mengweieric , @ps48 ) |
.cypress/integration/datasources_test/datasources_basic_ui.spec.js
Outdated
Show resolved
Hide resolved
30626d6
to
1c64ef2
Compare
Here is the reproduce of linting error on my local:
Since we are just fetch the diff of files. In this PR the original name of test file got changed from |
2dfde77
to
9288754
Compare
c7aab98
to
dc8b19a
Compare
Signed-off-by: Ryan Liang <[email protected]>
Signed-off-by: Ryan Liang <[email protected]>
Signed-off-by: Ryan Liang <[email protected]>
Signed-off-by: Ryan Liang <[email protected]>
Signed-off-by: Ryan Liang <[email protected]>
Signed-off-by: Ryan Liang <[email protected]>
dc8b19a
to
7536060
Compare
Signed-off-by: Ryan Liang <[email protected]>
a8eece1
to
5aba972
Compare
Signed-off-by: Ryan Liang <[email protected]>
Signed-off-by: Ryan Liang <[email protected]>
Signed-off-by: Ryan Liang <[email protected]>
Signed-off-by: Ryan Liang <[email protected]>
Signed-off-by: Ryan Liang <[email protected]>
b9e2010
to
9a553bc
Compare
Signed-off-by: Ryan Liang <[email protected]>
Signed-off-by: Ryan Liang <[email protected]>
Signed-off-by: Ryan Liang <[email protected]>
a4435d6
to
b2ccbe6
Compare
Newly changed lint file set is like this: https://github.com/opensearch-project/dashboards-observability/actions/runs/7481679764/job/20363744276?pr=1323#step:10:23 |
* Fix the datasources cypress tests Signed-off-by: Ryan Liang <[email protected]> * Clean up test setup and setup constants Signed-off-by: Ryan Liang <[email protected]> * Refactor datasources test and disable security config Signed-off-by: Ryan Liang <[email protected]> * Fix some lint Signed-off-by: Ryan Liang <[email protected]> * Switch to capitalized naming Signed-off-by: Ryan Liang <[email protected]> * Fix lint Signed-off-by: Ryan Liang <[email protected]> * debugging Signed-off-by: Ryan Liang <[email protected]> * List out all the changed files Signed-off-by: Ryan Liang <[email protected]> * Add output for file changes Signed-off-by: Ryan Liang <[email protected]> * Switch to use env var Signed-off-by: Ryan Liang <[email protected]> * Add echo Signed-off-by: Ryan Liang <[email protected]> * Remove github env setup Signed-off-by: Ryan Liang <[email protected]> * Add msg to check which file is being linted Signed-off-by: Ryan Liang <[email protected]> * Use jq for parsing Signed-off-by: Ryan Liang <[email protected]> * Lint both modified and added Signed-off-by: Ryan Liang <[email protected]> --------- Signed-off-by: Ryan Liang <[email protected]> (cherry picked from commit d17ec69) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Fix the datasources cypress tests * Clean up test setup and setup constants * Refactor datasources test and disable security config * Fix some lint * Switch to capitalized naming * Fix lint * debugging * List out all the changed files * Add output for file changes * Switch to use env var * Add echo * Remove github env setup * Add msg to check which file is being linted * Use jq for parsing * Lint both modified and added --------- (cherry picked from commit d17ec69) Signed-off-by: Ryan Liang <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…ensearch-project#1323) (opensearch-project#1340) Signed-off-by: Craig Perkins <[email protected]> Co-authored-by: Peter Nied <[email protected]> (cherry picked from commit d5441b2af755806e175a2ed5aa136690e74ba07f) Co-authored-by: Craig Perkins <[email protected]>
…ect#1323) (opensearch-project#1351) * Fix the datasources cypress tests * Clean up test setup and setup constants * Refactor datasources test and disable security config * Fix some lint * Switch to capitalized naming * Fix lint * debugging * List out all the changed files * Add output for file changes * Switch to use env var * Add echo * Remove github env setup * Add msg to check which file is being linted * Use jq for parsing * Lint both modified and added --------- (cherry picked from commit d17ec69) Signed-off-by: Ryan Liang <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> (cherry picked from commit 3abd951)
Description
Fix the existing datasources tests, and extend the UI test cases.
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.