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: [M3-7183] - Handle Managed test acccounts in Linode Backup tests #9809

Conversation

jdamore-linode
Copy link
Contributor

Description 📝

This allows the Cypress backup tests to more gracefully handle cases where the test account has Managed.

  • By default, tests that are impacted by Managed will be skipped if the test account has Managed enabled
    • At the moment only the Linode Backup tests are affected
  • If the CY_TEST_FAIL_ON_MANAGED environment variable is defined, the tests will fail instead. This is intended for CI environments where Managed should never be enabled on test accounts.

See this discussion for more context: #9699 (review)

Changes 🔄

  • Fetch and cache test account settings when Cypress launches to detect whether or not Managed is enabled
  • Adds utilities to skip Cypress tests
  • Adds CY_TEST_FAIL_ON_MANAGED environment variable to control test behavior on Managed accounts
  • Skip/fail Linode Backup tests when test account has Managed enabled
  • Fixes one of the backup integration tests by mocking account settings

How to test 🧪

  • We can rely on the automated tests to ensure that tests work as expected when test accounts do not have Managed enabled

Prerequisites

  • Enable Managed on your test account through Cloud Manager
    • (Feel free to reach out on Slack if you have any questions about enabling or disabling Managed)
  • Run yarn && yarn build && yarn start:manager:ci

Verification steps

  • Run yarn cy:run -s "cypress/e2e/core/linodes/backup-linode.spec.ts" and confirm that the "can enable backups" test is skipped and the rest of the tests pass
  • Run CY_TEST_FAIL_ON_MANAGED=1 yarn cy:run -s "cypress/e2e/core/linodes/backup-linode.spec.ts" and confirm that the "can enable backups" test fails and the rest of the tests pass

As an Author I have considered 🤔

Check all that apply

  • 👀 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

@jdamore-linode jdamore-linode self-assigned this Oct 17, 2023
@jdamore-linode jdamore-linode requested a review from a team as a code owner October 17, 2023 19:48
@jdamore-linode jdamore-linode requested review from carrillo-erik and cpathipa and removed request for a team October 17, 2023 19:48
@jdamore-linode jdamore-linode changed the title test: [M3-7183] - Account for Managed test acccounts in Linode Backup tests test: [M3-7183] - Handle Managed test acccounts in Linode Backup tests Oct 17, 2023
*
* @param state - Cypress internal state to retrieve.
*/
state(state: string): any;
Copy link
Member

@bnussman-akamai bnussman-akamai Oct 18, 2023

Choose a reason for hiding this comment

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

Kind of crazy that Cypress does not expose a type for this. I tried looking for one but didn't find anything notable

Copy link
Contributor

@coliu-akamai coliu-akamai left a comment

Choose a reason for hiding this comment

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

Thanks Joe! Confirmed the following:

✅ Can enable backups test is skipped
✅ when running with CY_TEST_FAIL_ON_MANAGED=1, 'can enable backups' test fails

@coliu-akamai coliu-akamai added Approved Multiple approvals and ready to merge! and removed Ready for Review labels Oct 18, 2023
@jdamore-linode jdamore-linode merged commit 8a610d3 into linode:develop Oct 20, 2023
11 checks passed
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!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants