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

change, test: [M3-7073, M3-7176] - Remove dcSpecificPricing and objDcSpecificPricing feature flags #9881

Merged

Conversation

mjac0bs
Copy link
Contributor

@mjac0bs mjac0bs commented Nov 7, 2023

Description 📝

Both phases of feature have been released. We want to make our changes permanent by removing the feature flag logic from our code.

Changes 🔄

List any change relevant to the reviewer.

  • Removes the dcSpecificPricing and objDcSpecificPricing feature flags from /src code, updating component logic and utils as necessary
  • Updates a handful of unit tests to remove feature flag logic
  • Updates the following e2e tests to remove feature flag logic:
    • volumes/create-volume.spec.ts
    • linodes/migrate-linode.spec.ts
    • linodes/create-linode.spec.ts
    • linodes/backup-linode.spec.ts
    • linodes/clone-linode.spec.ts
    • kubernetes/lke-update.spec.ts
    • kubernetes/lke-create.spec.ts
    • objectStorage/enable-object-storage.spec.ts
    • nodebalancers/smoke-create-nodebal.spec.ts
    • billing/billing-invoices.spec.ts

Preview 📷

Before After
Screenshot 2023-11-09 at 8 41 34 AM Screenshot 2023-11-09 at 8 18 31 AM

How to test 🧪

Prerequisites

(How to setup test environment)

  • Check out this PR.
  • As part of testing these flows, you'll want to create resources in Jakarta, ID or Sao Paulo, BR and compare that to a region without DC-specific prices (e.g. Newark, NJ).

Verification steps

(How to verify changes)

  • Verify that the feature flags are not listed in the dev tools and are now returning false via Launch Darkly in the development environment (check the network requests)
  • Verify that the following features are all still visible:
    • In the Kube Create flow and Linode create/clone flows region selection: DC Specific Pricing Notices and Docs Links (#9572)
    • For invoices from October onwards, a region column displays. Otherwise, the region column is hidden. (#9597)
    • In the Linode Create flows, prices are not displayed until a region selection is made (#9598)
    • In the Linode migration flow, a price display is shown if there is a difference in migration-from and migration-to region pricing (#9570)
    • In the Kube Create flow, prices are not displayed until a region selection is made and on the Kube details page, dynamically calculated prices are displaying correctly (#9606)
    • With a linode on your account in Jakarta or Sao Paulo, Monthly Network Transfer Pool dialog and linode usage displays include a DC-specific transfer pool (#9620), (#9692)
    • In the NodeBalancer create flow, prices are calculated dynamically and displaying correctly (#9566)
    • Add DC-specific pricing to Kubernetes HA (#9568)
    • For Linode Backups (Create flow, Linode Details page, Enable Backups drawer), prices are calculated dynamically and displaying correctly (#9588)
    • In the Volumes Create flows (from Volumes Landing and Linode Details), prices are calculated dynamically and displaying correctly (#9569), (#9683)
    • In the OBJ Create flows (access key and buckets), the Create Bucket drawer displays correct overages and the Enable Object Storage modal contains correct, non-beta copy (#9813)
  • Verify that all unit tests pass
  • Verify that all e2es listed above pass

Confirm the following e2es pass:

yarn cy:run -s "cypress/e2e/core/volumes/create-volume.spec.ts,cypress/e2e/core/linodes/migrate-linode.spec.ts,cypress/e2e/core/linodes/create-linode.spec.ts,cypress/e2e/core/linodes/backup-linode.spec.ts,cypress/e2e/core/linodes/clone-linode.spec.ts,cypress/e2e/core/kubernetes/lke-update.spec.ts,cypress/e2e/core/kubernetes/lke-create.spec.ts,cypress/e2e/core/objectStorage/enable-object-storage.spec.ts,cypress/e2e/core/nodebalancers/smoke-create-nodebal.spec.ts,cypress/e2e/core/billing/billing-invoices.spec.ts"

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

Comment on lines -114 to +51
{renderRegionPricingText(regionLabel ?? 'this region')}
<StyledTypography>
To create your first {regionId ? 'bucket' : 'access key'}, you need to
enable Object Storage.{' '}
</StyledTypography>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now that we're not trying to render so many different versions of copy in the modal, I cleaned up the function and replaced it with the Typography directly.

Comment on lines +59 to +82
it('renders the table row with unknown prices if a region is not selected', () => {
const { container } = renderWithTheme(
wrapWithTableBody(
<PlanSelection
idx={0}
isCreate={true}
onSelect={() => jest.fn()}
type={mockPlan}
/>
)
);

expect(container.querySelector('[data-qa-plan-row]')).toBeInTheDocument();
expect(container.querySelector('[data-qa-plan-name]')).toHaveTextContent(
mockPlan.heading
);
expect(container.querySelector('[data-qa-monthly]')).toHaveTextContent(
'$--.--'
);
expect(container.querySelector('[data-qa-hourly]')).toHaveTextContent(
'$--.--'
);
});

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test is added twice because it tests in both desktop and mobile view.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looking back at my comment, it was a little misleading. The tests are similar, but test slightly different things, since the desktop view tests that the unknown prices appear within a table and the mobile view tests that the unknown prices appear within cards.

The tests do already use the resizeScreenSize util to test the desktop and mobile display of plan items. I could break the unknown price test cases out into a separate test, but I don't see how that would make much difference, since we'd still want to test that the UI displays unknown prices in both views.

Comment on lines +89 to +93
// DC Dynamic price logic - DB creation flow is out of scope
const isDatabaseCreateFlow = location.pathname.includes('/databases/create');
const price: PriceObject | undefined = !isDatabaseCreateFlow
? getLinodeRegionPrice(type, selectedRegionId)
: type.price;
Copy link
Contributor Author

@mjac0bs mjac0bs Nov 9, 2023

Choose a reason for hiding this comment

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

This logic is necessary because the PlanSelection is used in the Database Create flow. Since it is out of scope for DC-specific pricing, we do not depend on a region selection to show prices; they are shown when the page loads.

@@ -15,8 +15,8 @@ import type { ExtendedType } from 'src/utilities/extendType';
* @returns pricing information for this specific linode type in a region
*/
export const getLinodeRegionPrice = (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Consolidated these two tests into one since getPrice was a wrapper for getLinodeRegionPrice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The changes in this file are due to consolidating tests.

@mjac0bs mjac0bs marked this pull request as ready for review November 9, 2023 16:40
@mjac0bs mjac0bs requested a review from a team as a code owner November 9, 2023 16:40
@mjac0bs mjac0bs requested review from bnussman-akamai and abailly-akamai and removed request for a team November 9, 2023 16:40
Copy link
Member

@bnussman-akamai bnussman-akamai left a comment

Choose a reason for hiding this comment

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

Awesome clean up! The diff is crazy!

All pricing I've check looks good! While this sits in develop, I'll remain vigilat

@mjac0bs mjac0bs added the Add'tl Approval Needed Waiting on another approval! label Nov 9, 2023
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.

Huge cleanup! nice work

  • code looks good and no UI regression noticed where I tested ✅
  • unit tests all passed ✅
  • clone-linode e2e failure seems legit ❌ (failed locally consistently)

Comment on lines +59 to +82
it('renders the table row with unknown prices if a region is not selected', () => {
const { container } = renderWithTheme(
wrapWithTableBody(
<PlanSelection
idx={0}
isCreate={true}
onSelect={() => jest.fn()}
type={mockPlan}
/>
)
);

expect(container.querySelector('[data-qa-plan-row]')).toBeInTheDocument();
expect(container.querySelector('[data-qa-plan-name]')).toHaveTextContent(
mockPlan.heading
);
expect(container.querySelector('[data-qa-monthly]')).toHaveTextContent(
'$--.--'
);
expect(container.querySelector('[data-qa-hourly]')).toHaveTextContent(
'$--.--'
);
});

Copy link
Contributor

Choose a reason for hiding this comment

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

@mjac0bs
Copy link
Contributor Author

mjac0bs commented Nov 13, 2023

@abailly-akamai - Should be ready for another look!

clone-linode e2e failure seems legit ❌ (failed locally consistently)

This was a legit failure but was not due to this PR. It was fixed in #9890, which was recently merged, so I merged in the latest develop accordingly.

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.

Thanks for addressing the feedback! All looks good per my previous review and test suites all passing - Ship it 🚢 !

@mjac0bs mjac0bs added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! Ready for Review labels Nov 14, 2023
@mjac0bs mjac0bs merged commit 52f0f71 into linode:develop Nov 14, 2023
13 checks passed
coliu-akamai pushed a commit to coliu-akamai/manager that referenced this pull request Nov 14, 2023
…jDcSpecificPricing` feature flags (linode#9881)

* Remove flag from Migrate dialog and Region selection

* Remove flag from MNTP dialog and Linode Details Network tab

* Remove flag from backups

* Remove flag from invoices

* Remove flag from Volumes and NodeBalancers

* Remove OBJ flag from OBJ

* Remove flag from linodes and kubernetes

* Remove flags from dev tools and feature flags list

* Remove flag on lke tests; fix HA in Create Cluster flow

* Remove flags in Migrate test, OBJ test, and Volumes test

* Remove flags in backup, clone, and create linode tests

* Remove flags in nodebalancer test

* Remove flag from billing test and consolidate... with failure WIP

* Add changesets

* Fix initial unknown prices for Database Create flow

* Remove duplicate instances of "$5.00" by updating mock, move header and summary assertions out of table context

* Make changelogs consistent

* Address feedback: simplify dialog copy

* Address feedback: make variable name more clear

---------

Co-authored-by: Joe D'Amore <jdamore@linode.com>
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! DC-Specific Pricing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants