Skip to content
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

fix to get correct getSavedQueryCount #8808

Merged
merged 5 commits into from
Nov 6, 2024

Conversation

riysaxen-amzn
Copy link
Contributor

Description

  • For getSavedQueryCount the page size is 0 but is not 0 for findSavedQueries since its paginated. This API in Neo returns 0 but the actual count in OSS. This PR will fix the discrepancy

Issues Resolved

Screenshot

Testing the changes

Changelog

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Signed-off-by: Riya Saxena <riysaxen@amazon.com>
Copy link
Contributor

github-actions bot commented Nov 5, 2024

ℹ️ Manual Changeset Creation Reminder

Please ensure manual commit for changeset file 8808.yml under folder changelogs/fragments to complete this PR.

If you want to use the available OpenSearch Changeset Bot App to avoid manual creation of changeset file you can install it in your forked repository following this link.

For more information about formatting of changeset files, please visit OpenSearch Auto Changeset and Release Notes Tool.

Co-authored-by: Miki <amoo_miki@yahoo.com>
Signed-off-by: Riya <69919272+riysaxen-amzn@users.noreply.github.com>
AMoo-Miki
AMoo-Miki previously approved these changes Nov 5, 2024
ashwin-pc
ashwin-pc previously approved these changes Nov 5, 2024
Copy link

codecov bot commented Nov 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.78%. Comparing base (758e4fb) to head (4e0d7c9).
Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8808   +/-   ##
=======================================
  Coverage   60.78%   60.78%           
=======================================
  Files        3798     3798           
  Lines       90701    90701           
  Branches    14284    14284           
=======================================
  Hits        55133    55133           
  Misses      32068    32068           
  Partials     3500     3500           
Flag Coverage Δ
Linux_1 29.05% <ø> (ø)
Linux_2 56.39% <ø> (ø)
Linux_3 37.65% <ø> (+<0.01%) ⬆️
Linux_4 29.82% <ø> (ø)
Windows_1 29.06% <ø> (ø)
Windows_2 56.34% <ø> (ø)
Windows_3 37.65% <ø> (ø)
Windows_4 29.82% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Hailong-am
Hailong-am previously approved these changes Nov 5, 2024
@virajsanghvi
Copy link
Collaborator

Unit tests need to be updated for this to be merged

Signed-off-by: Riya Saxena <riysaxen@amazon.com>
@riysaxen-amzn
Copy link
Contributor Author

Unit tests need to be updated for this to be merged

added UTs

 yarn test:jest src/plugins/data/public/query/saved_query/saved_query_service.test.ts
yarn run v1.22.22
$ scripts/use_node scripts/jest src/plugins/data/public/query/saved_query/saved_query_service.test.ts
jest-haste-map: duplicate manual mock found: index
  The following files share their name; please delete one of them:
    * <rootDir>/src/plugins/vis_type_vega/public/expressions/__mocks__/index.ts
    * <rootDir>/src/core/server/saved_objects/import/__mocks__/index.ts

 PASS  src/plugins/data/public/query/saved_query/saved_query_service.test.ts (6.265 s)
  saved query service
    saveQuery
      ✓ should create a saved object for the given attributes (3 ms)
      ✓ should allow overwriting an existing saved query (1 ms)
      ✓ should optionally accept filters and timefilters in object format (1 ms)
      ✓ should throw an error when saved objects client returns error
      ✓ should throw an error if the saved query does not have a title
    findSavedQueries
      ✓ should find and return saved queries without search text or pagination parameters
      ✓ should return the total count along with the requested queries
      ✓ should find and return saved queries with search text matching the title field
      ✓ should find and return parsed filters and timefilters items
      ✓ should return an array of saved queries (1 ms)
      ✓ should accept perPage and page properties
      ✓ should correctly parse a json query string (1 ms)
      ✓ should correctly parse a json object
      ✓ should handle null string with single quote
      ✓ should handle null string with double quote (1 ms)
      ✓ should handle null quoted string
      ✓ should not lose double quotes
    getSavedQuery
      ✓ should retrieve a saved query by id
      ✓ should only return saved queries
    deleteSavedQuery
      ✓ should delete the saved query for the given ID
    getAllSavedQueries
      ✓ should return all the saved queries
    getSavedQueryCount
      ✓ should return the total number of saved queries

Test Suites: 1 passed, 1 total
Tests:       22 passed, 22 total
Snapshots:   0 total
Time:        7.154 s, estimated 11 s
Ran all test suites matching /src\/plugins\/data\/public\/query\/saved_query\/saved_query_service.test.ts/i.
✨  Done in 13.18s.
riysaxen@3c22fbbc0960 OpenSearch-Dashboards % git status

@ashwin-pc
Copy link
Member

CIGroup 10 has no tests yet so we can skip it. Merging

@ashwin-pc ashwin-pc merged commit 7f3235d into opensearch-project:main Nov 6, 2024
68 of 69 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Nov 6, 2024
* fix to get correct getSavedQueryCount

Signed-off-by: Riya Saxena <riysaxen@amazon.com>

* Update src/plugins/data/public/query/saved_query/saved_query_service.ts

Co-authored-by: Miki <amoo_miki@yahoo.com>
Signed-off-by: Riya <69919272+riysaxen-amzn@users.noreply.github.com>

* fixed UTs

Signed-off-by: Riya Saxena <riysaxen@amazon.com>

---------

Signed-off-by: Riya Saxena <riysaxen@amazon.com>
Signed-off-by: Riya <69919272+riysaxen-amzn@users.noreply.github.com>
Co-authored-by: Miki <amoo_miki@yahoo.com>
(cherry picked from commit 7f3235d)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
abbyhu2000 pushed a commit that referenced this pull request Nov 12, 2024
* fix to get correct getSavedQueryCount



* Update src/plugins/data/public/query/saved_query/saved_query_service.ts




* fixed UTs



---------




(cherry picked from commit 7f3235d)

Signed-off-by: Riya Saxena <riysaxen@amazon.com>
Signed-off-by: Riya <69919272+riysaxen-amzn@users.noreply.github.com>
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>
Co-authored-by: Miki <amoo_miki@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants