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

[1.x][Test] Fix console error in search_service.test.ts  #671

Merged
merged 1 commit into from
Jul 26, 2021

Conversation

ananzh
Copy link
Member

@ananzh ananzh commented Jul 26, 2021

Description

Run unit test suite search_service.test.ts has a console error:

UnhandledPromiseRejectionWarning: TypeError: Cannot read
property 'aggs' of undefined

This is caused by a missing promise result check in the setup fun
in search_service.ts. If the promise result is empty (or null/undefined),
then any properties of the empty result is undefined. In our case,
aggs in if (value.search.aggs.shardDelay.enabled) is undefined.
In this PR, we fixed this issue by adding a value check in setup fun.

Issues resolved:
#594

Backport PR:
#595

Signed-off-by: Anan Zhuang ananzh@amazon.com

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

Run unit test suite search_service.test.ts has a console error:
```
UnhandledPromiseRejectionWarning: TypeError: Cannot read
property 'aggs' of undefined
```

This is caused by a missing promise result check in the setup fun
in search_service.ts. If the promise result is empty (or null/undefined),
then any properties of the empty result is undefined. In our case,
`aggs` in `if (value.search.aggs.shardDelay.enabled)` is undefined.
In this PR, we fixed this issue by adding a value check in setup fun.

Issues resolved:
opensearch-project#594

Backport PR:
opensearch-project#595

Signed-off-by: Anan Zhuang <ananzh@amazon.com>
@opensearch-ci-bot
Copy link
Collaborator

✅   DCO Check Passed 83ba64a

@ananzh ananzh merged commit a2cf438 into opensearch-project:1.x Jul 26, 2021
@ananzh ananzh deleted the 1.x_i_594 branch February 23, 2022 17:10
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.

2 participants