Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ describe('object storage failure paths', () => {
*/
it('shows error upon object upload failure', () => {
const bucketLabel = randomLabel();
const bucketCluster = 'us-southeast-1';
const bucketRegion = 'us-southeast';
const bucketMock = objectStorageBucketFactory.build({
cluster: bucketCluster,
hostname: `${bucketLabel}.${bucketCluster}.linodeobjects.com`,
region: bucketRegion,
hostname: `${bucketLabel}.${bucketRegion}-1.linodeobjects.com`,
label: bucketLabel,
objects: 0,
});
Expand All @@ -39,19 +39,17 @@ describe('object storage failure paths', () => {

// Mock empty object list and failed object-url upload request.
mockGetBuckets([bucketMock]).as('getBuckets');
mockGetBucketObjects(bucketLabel, bucketCluster, []).as('getBucketObjects');
mockGetBucketObjects(bucketLabel, bucketRegion, []).as('getBucketObjects');
mockUploadBucketObject(
bucketLabel,
bucketCluster,
bucketRegion,
bucketFilename,
makeError(randomString()),
404
).as('uploadBucketObject');

// Visit bucket details page, initiate object upload.
cy.visitWithLogin(
`/object-storage/buckets/${bucketCluster}/${bucketLabel}`
);
cy.visitWithLogin(`/object-storage/buckets/${bucketRegion}/${bucketLabel}`);
cy.wait('@getBucketObjects');

cy.fixture(bucketFile, null).then((bucketFileContents) => {
Expand Down Expand Up @@ -82,25 +80,23 @@ describe('object storage failure paths', () => {
*/
it('shows error upon object list retrieval failure', () => {
const bucketLabel = randomLabel();
const bucketCluster = 'us-southeast-1';
const bucketRegion = 'us-southeast';
const bucketMock = objectStorageBucketFactory.build({
cluster: bucketCluster,
hostname: `${bucketLabel}.${bucketCluster}.linodeobjects.com`,
region: bucketRegion,
hostname: `${bucketLabel}.${bucketRegion}-1.linodeobjects.com`,
label: bucketLabel,
objects: 0,
});

mockGetBuckets([bucketMock]).as('getBuckets');
mockGetBucketObjects(
bucketLabel,
bucketCluster,
bucketRegion,
makeError(randomString()),
404
).as('getBucketObjects');

cy.visitWithLogin(
`/object-storage/buckets/${bucketCluster}/${bucketLabel}`
);
cy.visitWithLogin(`/object-storage/buckets/${bucketRegion}/${bucketLabel}`);
cy.wait('@getBucketObjects');
cy.findByText('We were unable to load your Objects.').should('be.visible');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
mockDeleteBucketObjectS3,
mockGetBucketObjects,
mockGetBuckets,
mockGetBucketsForRegion,
mockUploadBucketObject,
mockUploadBucketObjectS3,
} from 'support/intercepts/object-storage';
Expand Down Expand Up @@ -87,9 +88,10 @@ describe('object storage smoke tests', () => {
*/
it('can upload, view, and delete bucket objects - smoke', () => {
const bucketLabel = randomLabel();
const bucketCluster = 'us-southeast-1';
const bucketRegion = 'us-southeast';
const bucketCluster = `${bucketRegion}-1`;
const bucketMock = objectStorageBucketFactory.build({
cluster: bucketCluster,
region: bucketRegion,
hostname: `${bucketLabel}.${bucketCluster}.linodeobjects.com`,
label: bucketLabel,
objects: 0,
Expand All @@ -102,23 +104,23 @@ describe('object storage smoke tests', () => {
'object-storage-files/4.zip',
];

mockGetBuckets([bucketMock]).as('getBuckets');
mockGetBucketObjects(bucketLabel, bucketCluster, []).as('getBucketObjects');

cy.visitWithLogin(
`/object-storage/buckets/${bucketCluster}/${bucketLabel}`
mockGetBucketsForRegion(bucketRegion, [bucketMock]).as(
'getBucketsForRegion'
);
cy.wait('@getBuckets');
mockGetBucketObjects(bucketLabel, bucketRegion, []).as('getBucketObjects');

cy.visitWithLogin(`/object-storage/buckets/${bucketRegion}/${bucketLabel}`);
cy.wait('@getBucketsForRegion');
cy.wait('@getBucketObjects');

cy.log('Upload bucket objects');
bucketContents.forEach((bucketFile) => {
const filename = bucketFile.split('/')[1];

mockUploadBucketObject(bucketLabel, bucketCluster, filename).as(
mockUploadBucketObject(bucketLabel, bucketRegion, filename).as(
'uploadBucketObject'
);
mockUploadBucketObjectS3(bucketLabel, bucketCluster, filename).as(
mockUploadBucketObjectS3(bucketLabel, bucketRegion, filename).as(
'uploadBucketObjectS3'
);
// @TODO Intercept and mock bucket objects GET request to reflect upload.
Expand All @@ -142,10 +144,10 @@ describe('object storage smoke tests', () => {
bucketContents.forEach((bucketFile) => {
const filename = bucketFile.split('/')[1];

mockDeleteBucketObject(bucketLabel, bucketCluster, filename).as(
mockDeleteBucketObject(bucketLabel, bucketRegion, filename).as(
'deleteBucketObject'
);
mockDeleteBucketObjectS3(bucketLabel, bucketCluster, filename).as(
mockDeleteBucketObjectS3(bucketLabel, bucketRegion, filename).as(
'deleteBucketObjectS3'
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,21 @@ describe('Object Storage Gen 2 bucket details tabs', () => {
it(`does not hide the CORS toggle and SSL/TLS tab for buckets with an ${endpoint} endpoint`, () => {
const { mockBucket, mockEndpoint } =
createMocksBasedOnEndpointType(endpoint);
const { cluster, label } = mockBucket;
const { label } = mockBucket;

mockGetBucketAccess(label, cluster, mockAccess).as('getBucketAccess');
mockGetBucketAccess(label, mockRegion.id, mockAccess).as(
'getBucketAccess'
);
mockGetBucketsForRegion(mockRegion.id, [mockBucket]).as(
'getBucketsForRegion'
);
mockGetObjectStorageEndpoints([mockEndpoint]).as(
'getObjectStorageEndpoints'
);

cy.visitWithLogin(`/object-storage/buckets/${cluster}/${label}/access`);
cy.visitWithLogin(
`/object-storage/buckets/${mockRegion.id}/${label}/access`
);
cy.wait([
'@getFeatureFlags',
'@getAccount',
Expand Down Expand Up @@ -110,17 +114,21 @@ describe('Object Storage Gen 2 bucket details tabs', () => {
it(`hides the CORS toggle and SSL/TLS tab for for buckets with an ${endpoint} endpoint`, () => {
const { mockBucket, mockEndpoint } =
createMocksBasedOnEndpointType(endpoint);
const { cluster, label } = mockBucket;
const { label } = mockBucket;

mockGetBucketAccess(label, cluster, mockAccess).as('getBucketAccess');
mockGetBucketAccess(label, mockRegion.id, mockAccess).as(
'getBucketAccess'
);
mockGetBucketsForRegion(mockRegion.id, [mockBucket]).as(
'getBucketsForRegion'
);
mockGetObjectStorageEndpoints([mockEndpoint]).as(
'getObjectStorageEndpoints'
);

cy.visitWithLogin(`/object-storage/buckets/${cluster}/${label}/access`);
cy.visitWithLogin(
`/object-storage/buckets/${mockRegion.id}/${label}/access`
);
cy.wait([
'@getFeatureFlags',
'@getAccount',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const emptyFolderMessage = 'This folder is empty.';
* @returns Non-empty bucket error message.
*/
const getNonEmptyBucketMessage = (bucketLabel: string) => {
return `Bucket ${bucketLabel} is not empty. Please delete all objects and try again.`;
return `The specified bucket '${bucketLabel}' is not empty. Please delete all objects before retrying.`;
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const ObjectDetailsDrawer = React.memo(
const isLoadingEndpoint = isLoadingEndpointData || !bucketsData;

const bucket = bucketsData?.buckets.find(
({ label }) => label === bucketName
({ label, region }) => label === bucketName && region === clusterId
);

const { endpoint_type: endpointType } = bucket ?? {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ export const BucketDetailLanding = React.memo(() => {
isPending,
} = useObjectStorageBuckets();

const bucket = bucketsData?.buckets.find(({ label }) => label === bucketName);
const bucket = bucketsData?.buckets.find(
({ label, region }) => label === bucketName && region === clusterId
);

const {
data: region,
Expand Down
Loading