-
Notifications
You must be signed in to change notification settings - Fork 61
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
Improve the test results for Integrations internals #2376
Improve the test results for Integrations internals #2376
Conversation
Signed-off-by: Simeon Widdis <[email protected]>
Signed-off-by: Simeon Widdis <[email protected]>
Signed-off-by: Simeon Widdis <[email protected]>
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.
note: Another option is to extend expect directly
This saves having to tweak the lint config, but I felt the interface was too complicated. We ultimately don't need anything too sophisticated here.
Signed-off-by: Simeon Widdis <[email protected]>
describe('Local Nginx Integration', () => { | ||
it('Should serialize without errors', async () => { | ||
const integration = await repository.getIntegration('nginx'); | ||
|
||
await expect(integration?.serialize()).resolves.toHaveProperty('ok', 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.
Does this mean all this while tests were actually working?
Also is this related? https://github.com/opensearch-project/dashboards-observability/pull/1319/files#diff-d5d5f677efd1b143b889952745e8485394751aa2d0ec93020befc186c2e621ee
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.
That file is also related by virtue of it being the same sort of result validation. We could use the same helpers there as well if we touch the file again. I didn't migrate everything since there's probably a lot of migration to do and the exact syntax for how I checked it in different places isn't consistent (which goes to show the necessity for a standard form...)
The backport to
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/dashboards-observability/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/dashboards-observability/backport-2.x
# Create a new branch
git switch --create backport/backport-2376-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 cd70e059a6d1616fe7bbe8dc2cc1157e59394deb
# Push it to GitHub
git push --set-upstream origin backport/backport-2376-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/dashboards-observability/backport-2.x Then, create a pull request where the |
…ct#2376) * Add custom expect handlers for integration results Signed-off-by: Simeon Widdis <[email protected]> * Add context to integrationReader errors Signed-off-by: Simeon Widdis <[email protected]> * Use FileParams type where applicable Signed-off-by: Simeon Widdis <[email protected]> * Assert serialized integrations works as part of usage Signed-off-by: Simeon Widdis <[email protected]> --------- Signed-off-by: Simeon Widdis <[email protected]>
…ct#2376) * Add custom expect handlers for integration results Signed-off-by: Simeon Widdis <[email protected]> * Add context to integrationReader errors Signed-off-by: Simeon Widdis <[email protected]> * Use FileParams type where applicable Signed-off-by: Simeon Widdis <[email protected]> * Assert serialized integrations works as part of usage Signed-off-by: Simeon Widdis <[email protected]> --------- Signed-off-by: Simeon Widdis <[email protected]>
* Add custom expect handlers for integration results * Add context to integrationReader errors * Use FileParams type where applicable * Assert serialized integrations works as part of usage --------- Signed-off-by: Simeon Widdis <[email protected]>
Description
I was debugging some tests locally and it stood out that the errors aren't that useful: most of them are
result.ok
assertions of the form "Expected true but got false." This is inactionable without custom debugging logic (usually well-placedconsole.log
s). I've added some result helpers that can check results with context, and show the specific errors on failure. Failures should be actionable.After implementing, I tried introducing some random errors in our integration configs and parsing logic, and verified that the failures made sense.
Issues Resolved
N/A
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.