Skip to content

Commit 4070969

Browse files
fix: STORIF-304 - Throughput quota limit conversion fixed. (#13463)
* fix: STORIF-304 - Throughput quota limit conversion fixed. * Added changeset: Throughtput quota conversion logic
1 parent ad72df2 commit 4070969

3 files changed

Lines changed: 61 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/manager": Fixed
3+
---
4+
5+
Throughtput quota conversion logic ([#13463](https://github.com/linode/manager/pull/13463))

packages/manager/src/features/Account/Quotas/QuotasTable/QuotasTable.test.tsx

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,59 @@ describe('QuotasTable', () => {
121121
).toBeInTheDocument();
122122
});
123123
});
124+
125+
it('should display object storage thoughput quotas correctly', async () => {
126+
queryMocks.useAllQuotasQuery.mockReturnValue({
127+
data: [
128+
quotaFactory.build({
129+
quota_name: 'Ingress Throughput (per endpoint)',
130+
description:
131+
'Current total ingress bandwidth per account, per endpoint',
132+
quota_limit: 1250000000,
133+
quota_type: 'obj-total-ingress-throughput',
134+
resource_metric: 'byte_per_second',
135+
has_usage: false,
136+
}),
137+
],
138+
isFetching: false,
139+
});
140+
141+
queryMocks.useQueries.mockReturnValue([
142+
{
143+
data: quotaUsageFactory.build({
144+
quota_limit: 1250000000,
145+
usage: 10,
146+
}),
147+
isLoading: false,
148+
},
149+
]);
150+
151+
const { getByLabelText, getByText } = renderWithTheme(
152+
<QuotasTable
153+
isGlobalScope={false}
154+
selectedLocation={{
155+
label: 'NJ',
156+
value: 'us-east',
157+
}}
158+
selectedService={{
159+
label: 'Object Storage',
160+
value: 'object-storage',
161+
}}
162+
/>
163+
);
164+
165+
await waitFor(() => {
166+
expect(getByText('Ingress Throughput')).toBeInTheDocument();
167+
expect(getByText(`10 Gbps`)).toBeInTheDocument();
168+
expect(
169+
getByLabelText(
170+
'Current total ingress bandwidth per account, per endpoint'
171+
)
172+
).toBeInTheDocument();
173+
expect(getByText('Not applicable')).toBeInTheDocument();
174+
expect(
175+
getByLabelText('Action menu for quota Ingress Throughput')
176+
).toBeInTheDocument();
177+
});
178+
});
124179
});

packages/manager/src/features/Account/Quotas/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ export const convertResourceMetric = ({
249249
return {
250250
convertedUsage: 0,
251251
convertedResourceMetric: 'Gbps',
252-
convertedLimit: readableBytes(initialLimit, {
252+
convertedLimit: readableBytes(initialLimit * 8, {
253253
unit: 'GB',
254254
base10: true,
255255
}).value,

0 commit comments

Comments
 (0)