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

test: Attempt to fix DBaaS unit test flake #11332

Merged

Conversation

bnussman-akamai
Copy link
Member

@bnussman-akamai bnussman-akamai commented Nov 26, 2024

Description 📝

How to test 🧪

  • yarn test DatabaseResize
  • yarn test DatabaseBackups
  • Verify checks pass in CI

Warning

The code coverage check that uses develop as the base branch may still fail because it does not have these changes


Author Checklists

As an Author, to speed up the review process, I considered 🤔

👀 Doing a self review
❔ Our contribution guidelines
🤏 Splitting feature into small PRs
➕ Adding a changeset
🧪 Providing/improving test coverage
🔐 Removing all sensitive information from the code and PR description
🚩 Using a feature flag to protect the release
👣 Providing comprehensive reproduction steps
📑 Providing or updating our documentation
🕛 Scheduling a pair reviewing session
📱 Providing mobile support
♿ Providing accessibility support


  • I have read and considered all applicable items listed above.

As an Author, before moving this PR from Draft to Open, I confirmed ✅

  • All unit tests are passing
  • TypeScript compilation succeeded without errors
  • Code passes all linting rules

@bnussman-akamai bnussman-akamai added the Unit tests Improves unit test coverage label Nov 26, 2024
@bnussman-akamai bnussman-akamai self-assigned this Nov 26, 2024
@bnussman-akamai bnussman-akamai marked this pull request as ready for review November 26, 2024 16:41
@bnussman-akamai bnussman-akamai requested a review from a team as a code owner November 26, 2024 16:41
@bnussman-akamai bnussman-akamai requested review from hana-akamai and cpathipa and removed request for a team November 26, 2024 16:41
@@ -128,132 +128,142 @@ export const DatabaseBackups = (props: Props) => {
setSelectedTime(null);
};

return isDefaultDatabase ? (
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing I changed here was this ternary. I change it to an early return to make this component more readable.

Comment on lines -402 to -403
expect(getByTestId(loadingTestId)).toBeInTheDocument();
await waitForElementToBeRemoved(getByTestId(loadingTestId));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than waiting for the loading state to go away and immediately asserting things, I updated this so that each assertion uses a find. This makes the test more resilient to inconsistent rendering behavior, which is what I suspect is happening in DatabaseResize

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tried to simplify this test as much as possible by removing some waitFors and finds. The updated test still does pretty much the same thing (except asset the loading state).

Copy link

Coverage Report:
Base Coverage: 86.94%
Current Coverage: 86.94%

@linode-gh-bot
Copy link
Collaborator

Cloud Manager UI test results

🔺 1 failing test on test run #2 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
1 Failing454 Passing2 Skipped110m 17s

Details

Failing Tests
SpecTest
create-stackscripts.spec.tsCreate stackscripts » creates a StackScript with Any/All target image

Troubleshooting

Use this command to re-run the failing tests:

yarn cy:run -s "cypress/e2e/core/stackscripts/create-stackscripts.spec.ts"

Copy link
Contributor

@jdamore-linode jdamore-linode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bnussman-akamai! I couldn't confirm the stability of the tests (they fail consistently for me in develop and against this branch, presumably performance issues with my machine), but reviewed the code and everything looked good to me

@bnussman-akamai bnussman-akamai added DBaaS Relates to Database as a Service Add'tl Approval Needed Waiting on another approval! labels Nov 26, 2024
Copy link
Contributor

@abailly-akamai abailly-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you - passing locally ✅

@bnussman-akamai bnussman-akamai added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! labels Nov 26, 2024
@bnussman-akamai bnussman-akamai merged commit 890e90e into linode:develop Nov 26, 2024
22 of 23 checks passed
Copy link

cypress bot commented Nov 26, 2024

Cloud Manager E2E    Run #6887

Run Properties:  status check failed Failed #6887  •  git commit 890e90e066: test: Attempt to fix DBaaS unit test flake (#11332)
Project Cloud Manager E2E
Branch Review develop
Run status status check failed Failed #6887
Run duration 30m 27s
Commit git commit 890e90e066: test: Attempt to fix DBaaS unit test flake (#11332)
Committer Banks Nussman
View all properties for this run ↗︎

Test results
Tests that failed  Failures 2
Tests that were flaky  Flaky 2
Tests that did not run due to a developer annotating a test with .skip  Pending 2
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 453
View all changes introduced in this branch ↗︎

Tests for review

Failed  rebuild-linode.spec.ts • 1 failed test

View Output Video

Test Artifacts
rebuild linode > rebuilds a linode from Account StackScript Screenshots Video
Failed  linode-config.spec.ts • 1 failed test

View Output Video

Test Artifacts
Linode Config management > End-to-End > Clones a config Screenshots Video
Flakiness  resize-linode.spec.ts • 1 flaky test

View Output Video

Test Artifacts
resize linode > resizes a linode by increasing size: cold migration Screenshots Video
Flakiness  update-linode-labels.spec.ts • 1 flaky test

View Output Video

Test Artifacts
update linode label > updates a linode label from details page Screenshots Video

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Multiple approvals and ready to merge! DBaaS Relates to Database as a Service Unit tests Improves unit test coverage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants