Skip to content

test: [DBAAS1-1403] Cypress tests for Postgresql Synchronous Replication Advanced Configuration#13440

Open
stayal712 wants to merge 6 commits intolinode:developfrom
stayal712:DBAAS1-1403-adv-config-synchronous-replication
Open

test: [DBAAS1-1403] Cypress tests for Postgresql Synchronous Replication Advanced Configuration#13440
stayal712 wants to merge 6 commits intolinode:developfrom
stayal712:DBAAS1-1403-adv-config-synchronous-replication

Conversation

@stayal712
Copy link
Contributor

Description 📝

  • Test coverage for "quorum" synchronous replication configuration for a 2 node and a 3 node database cluster

Changes 🔄

List any change(s) relevant to the reviewer.

  • Add constant for a 2 node postgresql database clusters
  • Add mockUpdateError intercept
  • Refactor to add top level and engine level advanced config
  • Add negative tests with "quorum" synchronous replication configuration for a database cluster with less than 3 nodes

Target release date 🗓️

N/A

How to test 🧪

pnpm cy:run -s "cypress/e2e/core/databases/advanced-configuration.spec.ts"

Run the test or some subset of test and confirm all actions can be performed.

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 tests and CI checks are passing
  • TypeScript compilation succeeded without errors
  • Code passes all linting rules

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 Sakshi! I took a look at the failures and I think I have a rough understanding of what's going on. Feel free to follow up in Slack if you have any questions!

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: any chance we can remove this debug() call? I know it's not added by this PR but it looks like it slipped in here by mistake

Comment on lines 189 to 202
if ($form.find(`[name="${flatKey}"]`).length) {
cy.get(`[name="${flatKey}"]`).scrollIntoView();
cy.get(`[name="${flatKey}"]`).should('be.visible').clear();
cy.get(`[name="${flatKey}"]`).type(additionalConfigs[flatKey]);
} else {
// Fallback
ui.autocomplete.find().first().scrollIntoView();
ui.autocomplete
.find()
.first()
.should('be.visible')
.clear()
.type(`${additionalConfigs[flatKey]}`);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this if/else block is responsible for the failures.

When I view the recording, I see that Cypress is typing '6000' into the "Add a Configuration Option" field rather than the "wal_sender_timeout" field. Then in the next iteration when it tries to add the "innodb_ft_min_token_size" config, it can't find the option in the autocomplete drop-down because '6000' was already present in the field:

Image

I have a few thoughts:

  • The root of the issue is that we're using jQuery-style functions like $form.find(...) to query the state of the DOM. This is fragile because it only checks the state of the DOM at that moment in time and doesn't have any waiting/timeout logic like we have with cy. commands; in this case, the test is failing because this if statement is executing faster than Cloud Manager can re-render the drawer DOM in CI, causing the check to return false
  • I don't understand what the fallback is accomplishing: I believe the intention is to type the configuration value into the right field, but as far as I can tell the first autocomplete field in the drawer will always be the "Add a Configuration Option" drop-down, so I don't think this fallback is doing what we want it to do anyway

I would suggest refactoring this in a way that uses Cypress's commands to assert the state of the drawer rather than using jQuery to attempt to check and respond to its state, e.g.:

cy.contains(flatKey)
  .scrollIntoView()
  .should('be.visible')
  .parent()
  .within(() => {
    // This limits your selection to the div containing the configuration setting.
    // Type into the text field, or click the toggle button, or perform whatever interaction is necessary here.
  });

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks Joe, I have tried to address the above pointers.

@linode-gh-bot
Copy link
Collaborator

Cloud Manager UI test results

🔺 5 failing tests on test run #3 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
5 Failing868 Passing11 Skipped40m 37s

Details

Failing Tests
SpecTest
smoke-linode-landing-table.spec.tsCloud Manager Cypress Tests→linode landing checks » checks the landing page side menu items
smoke-linode-landing-table.spec.tsCloud Manager Cypress Tests→linode landing checks » checks the create menu dropdown items
account-switching.spec.tsCloud Manager Cypress Tests→Parent/Child account switching→From Child to Child » can switch to another Child account as a Proxy user
alerting-notification-channel-permission-tests.spec.tsCloud Manager Cypress Tests→Notification Channel Listing Page — Access Control » allows access when notificationChannels is enabled
alerting-notification-channel-permission-tests.spec.tsCloud Manager Cypress Tests→Notification Channel Listing Page — Access Control » hides the Notification Channels tab when notificationChannels is disabled

Troubleshooting

Use this command to re-run the failing tests:

pnpm cy:run -s "cypress/e2e/core/linodes/smoke-linode-landing-table.spec.ts,cypress/e2e/core/parentChild/account-switching.spec.ts,cypress/e2e/core/cloudpulse/alerting-notification-channel-permission-tests.spec.ts"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Review

Development

Successfully merging this pull request may close these issues.

3 participants