chihsuan commented on code in PR #10577:
URL: https://github.com/apache/ozone/pull/10577#discussion_r3657116456


##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/__tests__/capacity/Capacity.test.tsx:
##########
@@ -382,29 +357,27 @@ describe('Capacity Page', () => {
   const setupCountingHandlers = (dnStatuses: string[]) => {
     const counts: EndpointCounts = { storage: 0, scm: 0, om: 0, dn: 0 };
     capacityServer.use(
-      rest.get('api/v1/storageDistribution', (_req, res, ctx) => {
+      http.get('api/v1/storageDistribution', () => {
         counts.storage++;
-        return res(ctx.status(200), 
ctx.json(mockResponses.StorageDistribution));
+        return HttpResponse.json(mockResponses.StorageDistribution);
       }),
-      rest.get('api/v1/pendingDeletion', (req, res, ctx) => {
-        const component = req.url.searchParams.get('component');
+      http.get('api/v1/pendingDeletion', ({ request }) => {
+        const url = new URL(request.url);
+        const component = url.searchParams.get('component');
         if (component === 'dn') {
           const status = dnStatuses[Math.min(counts.dn, dnStatuses.length - 
1)];
           counts.dn++;
-          return res(
-            ctx.status(200),
-            ctx.json({ ...mockResponses.DnPendingDeletion, status })
-          );
+          return HttpResponse.json({ ...mockResponses.DnPendingDeletion, 
status });
         }
         if (component === 'scm') {
           counts.scm++;
-          return res(ctx.status(200), 
ctx.json(mockResponses.ScmPendingDeletion));
+          return HttpResponse.json(mockResponses.ScmPendingDeletion);
         }
         if (component === 'om') {
           counts.om++;
-          return res(ctx.status(200), 
ctx.json(mockResponses.OmPendingDeletion));
+          return HttpResponse.json(mockResponses.OmPendingDeletion);
         }
-        return res(ctx.status(400), ctx.json({ message: 'Unsupported pending 
deletion component.' }));
+        return HttpResponse.json({ message: 'Unsupported pending deletion 
component.' });

Review Comment:
   This fallback lost its 400 status in the msw 2 migration. This fallback lost 
its 400 status in the msw 2 migration kept that, so this one now diverges from 
the real API.



##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/__tests__/capacity/Capacity.test.tsx:
##########
@@ -103,28 +103,26 @@ describe('Capacity Page', () => {
 
   test('defaults to the first available datanode when the first datanode 
reports -1 (offline/unreachable)', async () => {
     capacityServer.use(
-      rest.get('api/v1/pendingDeletion', (req, res, ctx) => {
-        const component = req.url.searchParams.get('component');
+      http.get('api/v1/pendingDeletion', ({ request }) => {
+        const url = new URL(request.url);
+        const component = url.searchParams.get("component");

Review Comment:
   nit: the newly added lines **mix double and single quotes**, e.g. 
`url.searchParams.get("component")` here (and in two other handlers in this 
file, plus `capacityServer.ts`) vs `url.searchParams.get('component')` a few 
lines above. 
   
   



##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/pnpm-lock.yaml:
##########
@@ -133,8 +133,8 @@ importers:
         specifier: ^0.17.4
         version: 0.17.4
       msw:
-        specifier: 1.3.3
-        version: 1.3.3(@types/[email protected])([email protected])
+        specifier: ^2.14.6
+        version: 2.15.0(@types/[email protected])([email protected])

Review Comment:
   It looks like this doesn't match the change in `package.json` (specifier).  
lockfile is already resolved to 2.15.0. Can we either pin the exact version 
here, or update the title/description to reflect the range? Same applies to 
vitest (`^3.2.6` resolves to `3.2.7`).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to