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

Update cypress data to have random id, missing value fields and unique field #9321

Merged
merged 2 commits into from
Feb 4, 2025

Conversation

ananzh
Copy link
Member

@ananzh ananzh commented Feb 3, 2025

Description

  • Random id generation in TestDataGenerator
function generateRandomId(length = 20) {
  return Array.from({ length }, () => ID_CHARS[Math.floor(Math.random() * ID_CHARS.length)]).join(
    ''
  );
}
  • Add a unique field to test modifyColumnsOnSwitch

There is an advanced settings for discover called modifyColumnsOnSwitch. By default (turn on), this settings will remove columns that are not available in the new index pattern when switch. Therefore we need a different field for time_1 data and time_2 data.

  • Update mapping and include a never present field to test hide missing values

There is another feature called hide missing values in discover. An example to verify this feature

PUT a
{
  "mappings": {
    "properties": {
      "field_always_present": {
        "type": "keyword"
      },
      "field_always_missing": {
        "type": "keyword"
      }
    }
  }
}
PUT a/_doc/1
{
  "field_always_present": "hello",
}
PUT a/_doc/2
{
  "field_always_present": "hello"
} 

then create an index pattern a*. For field_always_missing field, it only has a mapping but no value. When hide missing values in discover is on, you won't see this field in the side panel in discover. When hide missing values is off this field should show in side panel. So we need to update the script to include such field but don't need to create values for them.

Issues Resolved

NA

Screenshot

NA

Testing the changes

Changelog

  • test: Update cypress data to have random id, missing value fields and unique field

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

Copy link
Contributor

github-actions bot commented Feb 3, 2025

❌ Empty Changelog Section

The Changelog section in your PR description is empty. Please add a valid changelog entry or entries. If you did add a changelog entry, check to make sure that it was not accidentally included inside the comment block in the Changelog section.

opensearch-changeset-bot bot added a commit to ananzh/OpenSearch-Dashboards that referenced this pull request Feb 3, 2025
Copy link

codecov bot commented Feb 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.71%. Comparing base (0da7752) to head (722eae0).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9321   +/-   ##
=======================================
  Coverage   61.70%   61.71%           
=======================================
  Files        3816     3816           
  Lines       91829    91829           
  Branches    14543    14543           
=======================================
+ Hits        56666    56668    +2     
+ Misses      31507    31506    -1     
+ Partials     3656     3655    -1     
Flag Coverage Δ
Linux_1 28.99% <ø> (ø)
Linux_2 56.46% <ø> (ø)
Linux_3 39.18% <ø> (+<0.01%) ⬆️
Linux_4 28.90% <ø> (ø)
Windows_1 29.00% <ø> (ø)
Windows_2 56.41% <ø> (ø)
Windows_3 39.18% <ø> (ø)
Windows_4 28.90% <ø> (ø)

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.

…e field

* Random id generation in TestDataGenerator
* Add a unique field to test modifyColumnsOnSwitch
* Update mapping and include a never present field to test hide
missing values

Signed-off-by: Anan <[email protected]>
@ananzh ananzh force-pushed the update-cypress-data branch from e3d20a6 to 9de6f9e Compare February 3, 2025 20:19
@ananzh ananzh merged commit 13408e1 into opensearch-project:main Feb 4, 2025
74 checks passed
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch-Dashboards/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-2.x
# Create a new branch
git switch --create backport/backport-9321-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 13408e1d47d9decd9c85f30db4169d3c0b1db1a2
# Push it to GitHub
git push --set-upstream origin backport/backport-9321-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-9321-to-2.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x discover_2.0-test Issues that are specific to the Discover 2.0 testing initiative failed backport v2.20.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants