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-8485] - Unit Tests for Object Storage Gen2 feature #10862

Conversation

harsh-akamai
Copy link
Contributor

@harsh-akamai harsh-akamai commented Aug 30, 2024

Description 📝

Unit tests for Bucket Landing page, Bucket Detail Drawer and Object Detail Drawers.

Changes 🔄

  • Added test to check if "Endpoint Type" column is displayed
  • Added test to check if the CORS switch is disabled for E2 and E3 buckets in the Bucket Details Drawer
  • Added test to check if the Bucket Rate Limit table is rendered for E2 and E3 buckets in the Bucket Detail Drawer
  • Added test to check if the ACL switch is disabled for E2 and E3 buckets in the Object Details Drawer

Target release date 🗓️

N/A

How to test 🧪

Verification steps

  • Run the unit tests for Object Storage feature and check if all 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

@harsh-akamai harsh-akamai self-assigned this Aug 30, 2024
@harsh-akamai harsh-akamai requested a review from a team as a code owner August 30, 2024 06:18
@harsh-akamai harsh-akamai requested review from cpathipa, hkhalil-akamai and coliu-akamai and removed request for a team August 30, 2024 06:18
@harsh-akamai harsh-akamai force-pushed the feature/M3-8485-browsing-buckets-and-objects-unit-and-itegration-tests branch from 475d702 to 35c2bab Compare August 30, 2024 06:37
Copy link

github-actions bot commented Aug 30, 2024

Coverage Report:
Base Coverage: 86.41%
Current Coverage: 86.41%

@bnussman-akamai bnussman-akamai changed the title test: [M3-8485] -Unit Tests for Object Storage Gen2 feature test: [M3-8485] - Unit Tests for Object Storage Gen2 feature Aug 30, 2024
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.

✅ confirmed tests pass - thanks for adding test coverage!

Some v small comments + one question below

@@ -141,7 +141,7 @@ export const BucketDetailsDrawer = React.memo(
)}
{/* @TODO OBJ Multicluster: use region instead of cluster if isObjMultiClusterEnabled
to getBucketAccess and updateBucketAccess. */}
{
{Boolean(endpoint_type) && (
Copy link
Contributor

Choose a reason for hiding this comment

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

are the changes in this file just for stuff that was missed earlier? I don't see anything mentioned in the AC or ticket description about them

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, these changes are stuff that was missed earlier.

Copy link
Contributor

@cpathipa cpathipa left a comment

Choose a reason for hiding this comment

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

All tests passed! thank you adding unit test coverage.

@mjac0bs mjac0bs added the Approved Multiple approvals and ready to merge! label Sep 3, 2024
@hkhalil-akamai
Copy link
Contributor

The ticket mentions updating integration tests to reflect the new changes. Is this still required (perhaps updating bucket-create-gen2.spec.ts)?

@harsh-akamai
Copy link
Contributor Author

The ticket mentions updating integration tests to reflect the new changes. Is this still required (perhaps updating bucket-create-gen2.spec.ts)?

@hkhalil-akamai the ticket asked to perform integration tests to ensure the UI changes function as expected without affecting other feature. If we need to update the integration tests I guess handling that in a different ticket/PR would be better

Copy link
Contributor

Choose a reason for hiding this comment

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

Using renderWithThemeAndHookFormContext is unnecessary since the component doesn't need a Hook Form Context. Use renderWithTheme instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently the component doesn't need a Hook Form, but M3-8501(optimzing AccessSelect.tsx using Hook Form) is in progress. Hence, I decided to go with renderWithThemeAndHookFormContext

Copy link
Contributor

Choose a reason for hiding this comment

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

Ohhh understood. Sounds good!

Copy link
Contributor

@hkhalil-akamai hkhalil-akamai Sep 11, 2024

Choose a reason for hiding this comment

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

For future reference, each PR should be self-contained and generally should not include changes for another ticket. This prevents issues when, for example, the other ticket is closed or modified.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noted 🗒️

Comment on lines 264 to 277
const { getByTestId } = renderWithThemeAndHookFormContext({
component: (
<BucketDetailsDrawer
onClose={mockOnClose}
open={true}
selectedBucket={e3Bucket}
/>
),
options: {
flags: { objMultiCluster: false, objectStorageGen2: { enabled: true } },
},
});

const rateLimitTable = getByTestId('bucket-rate-limit-table');
Copy link
Contributor

Choose a reason for hiding this comment

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

This test is failing since isObjectStorageGen2Enabled is derived from an RQ hook and is initially undefined. Awaiting via await findByTestId will wait for the query to resolve.

Suggested change
const { getByTestId } = renderWithThemeAndHookFormContext({
component: (
<BucketDetailsDrawer
onClose={mockOnClose}
open={true}
selectedBucket={e3Bucket}
/>
),
options: {
flags: { objMultiCluster: false, objectStorageGen2: { enabled: true } },
},
});
const rateLimitTable = getByTestId('bucket-rate-limit-table');
const { findByTestId } = renderWithTheme(
<BucketDetailsDrawer
onClose={mockOnClose}
open={true}
selectedBucket={e3Bucket}
/>,
{
flags: { objMultiCluster: false, objectStorageGen2: { enabled: true } },
}
);
const rateLimitTable = await findByTestId('bucket-rate-limit-table');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you so much for pointing this out! I've made the changes in 8974ea4

Comment on lines 282 to 298
const { getByText } = renderWithThemeAndHookFormContext({
component: (
<BucketDetailsDrawer
onClose={mockOnClose}
open={true}
selectedBucket={e1Bucket}
/>
),
options: {
flags: { objMultiCluster: false, objectStorageGen2: { enabled: true } },
},
});
expect(
getByText(
/This endpoint type supports up to 750 Requests Per Second \(RPS\)./
)
).toBeInTheDocument();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const { getByText } = renderWithThemeAndHookFormContext({
component: (
<BucketDetailsDrawer
onClose={mockOnClose}
open={true}
selectedBucket={e1Bucket}
/>
),
options: {
flags: { objMultiCluster: false, objectStorageGen2: { enabled: true } },
},
});
expect(
getByText(
/This endpoint type supports up to 750 Requests Per Second \(RPS\)./
)
).toBeInTheDocument();
const { findByText } = renderWithTheme(
<BucketDetailsDrawer
onClose={mockOnClose}
open={true}
selectedBucket={e1Bucket}
/>,
{
flags: { objMultiCluster: false, objectStorageGen2: { enabled: true } },
}
);
expect(
await findByText(
/This endpoint type supports up to 750 Requests Per Second \(RPS\)./
)
).toBeInTheDocument();

@harsh-akamai harsh-akamai removed the Approved Multiple approvals and ready to merge! label Sep 11, 2024
Copy link
Contributor

@hkhalil-akamai hkhalil-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 making requested changes! Approved pending CI passes!

Copy link
Contributor

Choose a reason for hiding this comment

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

Ohhh understood. Sounds good!

@mjac0bs mjac0bs added the Approved Multiple approvals and ready to merge! label Sep 11, 2024
@harsh-akamai harsh-akamai merged commit 6581070 into linode:develop Sep 12, 2024
19 checks passed
@harsh-akamai harsh-akamai deleted the feature/M3-8485-browsing-buckets-and-objects-unit-and-itegration-tests branch September 12, 2024 06:22
nikhagra-akamai pushed a commit to nikhagra-akamai/manager that referenced this pull request Sep 23, 2024
…10862)

* upcoming:[M3-8485] - Browsing Buckets & Objects - Unit Tests

* test: Unit test for 'Endpoint Type' column in the Bucket Landing Table

* test: [M3-8485] - updated tests for object storage bucket feature

* test: [M3-8485] fixed failing unit test

* test: [M3-8485] - udpated tests that need to wait for OBJGen2 flag
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! Object Storage Gen2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants