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


##########
e2e/tests/secrets.crud-required-fields.spec.ts:
##########
@@ -0,0 +1,148 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { secretsPom } from '@e2e/pom/secrets';
+import { e2eReq } from '@e2e/utils/req';
+import { test } from '@e2e/utils/test';
+import { expect } from '@playwright/test';
+
+import { API_SECRETS } from '@/config/constant';
+
+let createdSecretId: string;
+const manager = 'vault';
+
+test.describe('CRUD secret with required fields only (Vault)', () => {
+  test.describe.configure({ mode: 'serial' });
+
+  test.beforeAll(async () => {
+    createdSecretId = 'test-vault-secret-required';
+  });
+
+  test.afterAll(async () => {
+    // cleanup: delete the secret
+    if (createdSecretId) {
+      await 
e2eReq.delete(`${API_SECRETS}/${manager}/${createdSecretId}`).catch(() => {
+        // ignore error if secret doesn't exist

Review Comment:
   You're right, swallowing all errors is bad practice. I've updated the 
cleanup logic to only ignore 404 (Not Found) errors and rethrow anything else



##########
e2e/tests/secrets.crud-all-fields.spec.ts:
##########
@@ -0,0 +1,166 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { secretsPom } from '@e2e/pom/secrets';
+import { e2eReq } from '@e2e/utils/req';
+import { test } from '@e2e/utils/test';
+import { expect } from '@playwright/test';
+
+import { API_SECRETS } from '@/config/constant';
+
+
+let createdSecretId: string;
+const manager = 'aws';
+
+test.describe('CRUD secret with all fields (AWS)', () => {
+  test.describe.configure({ mode: 'serial' });
+
+  test.beforeAll(async () => {
+    createdSecretId = 'test-aws-secret-all-fields';
+  });
+
+  test.afterAll(async () => {
+    // cleanup: delete the secret
+    if (createdSecretId) {
+      await 
e2eReq.delete(`${API_SECRETS}/${manager}/${createdSecretId}`).catch(() => {
+        // ignore error if secret doesn't exist

Review Comment:
   My mistake. I was trying to ensure the cleanup didn't fail if the secret had 
already been deleted during the test.



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