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-8433] - Cypress integration test for Object Storage Gen2: E1 Endpoint #10907

Merged
merged 3 commits into from
Sep 10, 2024

Conversation

jaalah-akamai
Copy link
Contributor

Changes πŸ”„

  • New Integration Test for Object Storage Gen2: E1 Endpoint - Bucket Creation

Target release date πŸ—“οΈ

N/A

How to test πŸ§ͺ

  • yarn cy:run -s "cypress/e2e/core/objectStorageGen2/bucket-create-gen2.spec.ts"

Requirements:

  • Visiting /object-storage/buckets/create causes "Create Bucket" drawer to open
  • Users can select "E1" endpoint type for regions that support E1 endpoint types
    • This will require mocking the response to the API endpoint types request to ensure that "E1" is available for the selected region
  • Upon selecting "E1" endpoint type, request-per-second notice appears in the drawer:
    • This endpoint type supports up to 750 Requests Per Second (RPS). Understand bucket rate limits.
  • Upon selecting "E1" endpoint type, rate limiting table is not present
  • Upon clicking "Create Bucket" with "E1" endpoint type selected, Cloud fires an API bucket create request with the following data in its payload:
    • cors_enabled is true
    • endpoint_type is 'E1'
    • s3_endpoint is present if corresponding endpoint mock contains non-null s3_endpoint
      • At least one of these subtasks should test the case when s3_endpoint is specified, and at least one of these subtasks should test the case when s3_endpoint is omitted
  • Upon creating bucket, the "Create Bucket" drawer closes and new bucket appears in the landing page
    • The correct information is displayed alongside the new bucket:
      • Label
      • Region
      • Endpoint type
      • Endpoint URL

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

@jaalah-akamai jaalah-akamai requested a review from a team as a code owner September 9, 2024 16:13
@jaalah-akamai jaalah-akamai requested review from cliu-akamai and removed request for a team September 9, 2024 16:14
@jaalah-akamai jaalah-akamai self-assigned this Sep 9, 2024
@jaalah-akamai jaalah-akamai added e2e Indicates that a PR touches Cypress tests in some way Object Storage Gen2 labels Sep 9, 2024
@jaalah-akamai jaalah-akamai requested review from a team, cpathipa and abailly-akamai and removed request for a team September 9, 2024 16:14
@jaalah-akamai jaalah-akamai requested a review from a team as a code owner September 9, 2024 16:14
@jaalah-akamai jaalah-akamai requested review from mjac0bs and hana-akamai and removed request for a team September 9, 2024 16:15
Copy link

github-actions bot commented Sep 9, 2024

Coverage Report: βœ…
Base Coverage: 86.4%
Current Coverage: 86.4%

Copy link
Contributor

@mjac0bs mjac0bs left a comment

Choose a reason for hiding this comment

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

Test passes and does what was required of it. 🚒

I just left a couple minor comments, mostly clean up.

@@ -128,11 +128,6 @@ describe('Object Storage Gen2 create bucket tests', () => {
region: mockRegion.id,
}).as('createBucket');

mockAppendFeatureFlags({
Copy link
Contributor

Choose a reason for hiding this comment

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

We can also remove L139, @getFeatureFlags.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Howcome?

Comment on lines 311 to 315
cy.wait('@createBucket').then((xhr) => {
const requestPayload = xhr.request.body;
expect(requestPayload['endpoint_type']).to.equal('E1');
expect(requestPayload['cors_enabled']).to.equal(true);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

s3_endpoint is present if corresponding endpoint mock contains non-null s3_endpoint

Did we still want to verify the s3_endpoint?

const endpointTypeE1 = 'Standard (E1)';
const bucketLabel = randomLabel();

//wait for the newly 'created' mocked bucket to appear
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Does this comment make more sense down before Line 307-308?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved it as far down as I could given placement now

@mjac0bs mjac0bs added the Add'tl Approval Needed Waiting on another approval! label Sep 9, 2024
ui.drawer.find().should('not.exist');

// Confirm that bucket is created, initiate deletion for cleanup
cy.findByText(endpointTypeE1).should('be.visible');
Copy link
Contributor

Choose a reason for hiding this comment

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

The correct information is displayed alongside the new bucket:
Label
Region
Endpoint type
Endpoint URL

Just noticed - are we missing a check for the endpoint URL? I see endpoint type, label, and region.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Endpoint URL is the s3_endpoint - added πŸ‘

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.

I have no idea why, but when running

yarn cy:debug all tests are passing, but with

yarn cy:run -s "cypress/e2e/core/objectStorageGen2/bucket-create-gen2.spec.ts"
it's failing.

anyone else?

@mjac0bs
Copy link
Contributor

mjac0bs commented Sep 9, 2024

anyone else?

Actually, yes. I'd tested with yarn cy:debug earlier, but I'm seeing the same as you with yarn cy:run. It looks like every test is failing at the point where it's looking for the created bucket, and the landing page shows none.

I don't know why that is, though...
Screenshot 2024-09-09 at 1 21 00β€―PM

It does pass in CI:
image

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.

Approving since test passes as expected locally and in CI, but curious to know if @jdamore-linode has any insight into the discrepancy shown discussed above

@mjac0bs mjac0bs added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! Ready for Review labels Sep 9, 2024
@jdamore-linode
Copy link
Contributor

jdamore-linode commented Sep 9, 2024

@abailly-akamai @mjac0bs @jaalah-akamai I'm able to reproduce the failures via yarn cy:run, too -- in my case, I'm seeing all 3 fail intermittently, and I think I see two reasons why:

  • Sometimes the "Object Storage Endpoint Type" drop-down doesn't get populated. Judging by the recording, Cypress is clicking the "Create Bucket" button before the OBJ landing page has finished loading. In the past, we've had issues where drawers behave unexpectedly when they're opened before certain API requests have resolved, and this resembles that type of issue.
    • Normally I don't consider this type of bug that serious since the user usually has to race as quickly as they can to trigger it, but because the OBJ landing page takes so long to load we might want to take a closer look at this and rule it out as an issue
    • If this really is causing failures, we can work around it in Cypress by waiting for the page to load (using cy.findByText() to find one of the blurbs that appears once the page has loaded is usually reliable)
  • In each test, we're clicking "Create Bucket" and then setting up the mocks that would reflect the new bucket being created. If the browser fires off an HTTP request in the split second before Cypress has set up the request intercept, the request won't be mocked.
    • I think this is what's causing most of the flakiness, and probably explains why this works in yarn cy:debug but not in yarn cy:run: the debugger is probably just slow enough compared to cy:run not to trigger the issue
    • We're doing this twice in each test: when the bucket is created, and when the bucket is deleted, so it'll need to be fixed for all 6 instances
    • To fix, we just have to move mockGetBuckets() to right before the preceding command that ends with .click().
bucket-create-gen2.spec.ts.mp4

Edit: Deleted second recording because I realized after the fact that I accidentally overrode the recording that showed the failure :(

cc @jaalah-akamai -- Sorry about this! I should've caught this when I reviewed the original E0 test.

@jaalah-akamai
Copy link
Contributor Author

Thanks @jdamore-linode I'll make those changes and confirm back here when it's done πŸ‘

@jaalah-akamai jaalah-akamai merged commit da99b76 into linode:develop Sep 10, 2024
18 of 19 checks passed
nikhagra-akamai pushed a commit to nikhagra-akamai/manager that referenced this pull request Sep 23, 2024
…1 Endpoint (linode#10907)

* test: [M3-8433] - Cypress integration test for Object Storage Gen2: E1 Endpoint

* Added changeset: Cypress integration test for Object Storage Gen2: E1 Endpoint

* test: [M3-8433] - Cypress integration test for Object Storage Gen2: E1 Endpoint

---------

Co-authored-by: Jaalah Ramos <[email protected]>
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! e2e Indicates that a PR touches Cypress tests in some way Object Storage Gen2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants