DSingh0304 commented on code in PR #3255:
URL: https://github.com/apache/apisix-dashboard/pull/3255#discussion_r2622038782


##########
src/apis/stream_routes.ts:
##########
@@ -77,7 +77,14 @@ export const deleteAllStreamRoutes = async (req: 
AxiosInstance) => {
       page_size: PAGE_SIZE_MAX,
     });
     await Promise.all(
-      res.list.map((d) => req.delete(`${API_STREAM_ROUTES}/${d.value.id}`))
+      res.list.map((d) =>
+        req.delete(`${API_STREAM_ROUTES}/${d.value.id}`).catch((err) => {
+          // Ignore 404 errors - resource already deleted

Review Comment:
   This ensures the test cleanup is robust against race conditions or 
inconsistent states. If a resource is deleted by another process (or a previous 
test step) between the time we `list` the resources and the time we try to 
[delete](cci:1://file:///home/deep/Desktop/Code/Organizations/apisix-dashboard/src/apis/stream_routes.ts:66:0-89:2)
 them, the server returns a 404. Ignoring 404s prevents the 
[deleteAllStreamRoutes](cci:1://file:///home/deep/Desktop/Code/Organizations/apisix-dashboard/src/apis/stream_routes.ts:66:0-89:2)
 helper from crashing the test suite when the resource is already gone, which 
is the desired state anyway.



-- 
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]

Reply via email to