This is an automated email from the ASF dual-hosted git repository.

kingsword09 pushed a commit to branch feat-concurrent-limit-layer
in repository https://gitbox.apache.org/repos/asf/opendal.git


The following commit(s) were added to refs/heads/feat-concurrent-limit-layer by 
this push:
     new 8593dddb1 add test
8593dddb1 is described below

commit 8593dddb11b5029897b6f2e1f306a38706d39626
Author: Kingsword <[email protected]>
AuthorDate: Sat Oct 25 07:06:36 2025 +0800

    add test
---
 bindings/nodejs/tests/suites/index.mjs       |  2 ++
 bindings/nodejs/tests/suites/layer.suite.mjs | 53 ++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)

diff --git a/bindings/nodejs/tests/suites/index.mjs 
b/bindings/nodejs/tests/suites/index.mjs
index f7848c2dd..791b15c48 100644
--- a/bindings/nodejs/tests/suites/index.mjs
+++ b/bindings/nodejs/tests/suites/index.mjs
@@ -24,6 +24,7 @@ import { checkRandomRootEnabled, generateRandomRoot, 
loadConfigFromEnv } from '.
 import { run as AsyncIOTestRun } from './async.suite.mjs'
 import { run as ServicesTestRun } from './services.suite.mjs'
 import { run as SyncIOTestRun } from './sync.suite.mjs'
+import { run as LayerTestRun } from './layer.suite.mjs'
 import { run as AsyncStatOptionsTestRun } from './asyncStatOptions.suite.mjs'
 import { run as SyncStatOptionsTestRun } from './syncStatOptions.suite.mjs'
 import { run as AsyncReadOptionsTestRun } from './asyncReadOptions.suite.mjs'
@@ -63,6 +64,7 @@ export function runner(testName, scheme) {
     AsyncIOTestRun(operator)
     ServicesTestRun(operator)
     SyncIOTestRun(operator)
+    LayerTestRun(operator)
     AsyncStatOptionsTestRun(operator)
     SyncStatOptionsTestRun(operator)
     AsyncReadOptionsTestRun(operator)
diff --git a/bindings/nodejs/tests/suites/layer.suite.mjs 
b/bindings/nodejs/tests/suites/layer.suite.mjs
new file mode 100644
index 000000000..11739772a
--- /dev/null
+++ b/bindings/nodejs/tests/suites/layer.suite.mjs
@@ -0,0 +1,53 @@
+/*
+ * 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 { test, assert } from 'vitest'
+
+import { RetryLayer, ConcurrentLimitLayer } from '../../index.mjs'
+
+/**
+ * @param {import("../../index").Operator} op
+ */
+export function run(op) {
+    test('test operator with retry layer', async () => {
+        const retryLayer = new RetryLayer()
+        retryLayer.maxTimes = 3
+        retryLayer.jitter = true
+
+        const layeredOp = op.layer(retryLayer.build())
+        await layeredOp.check()
+    })
+
+    test('test operator with concurrent limit layer', async () => {
+        const concurrentLimitLayer = new ConcurrentLimitLayer(1024)
+        const layeredOp = op.layer(concurrentLimitLayer.build())
+
+        await layeredOp.check()
+    })
+
+    test('test operator with concurrent limit layer and http permits', async 
() => {
+        const concurrentLimitLayer = new ConcurrentLimitLayer(1024)
+        concurrentLimitLayer.httpPermits = 512
+
+        const layeredOp = op.layer(concurrentLimitLayer.build())
+
+        await layeredOp.check()
+    })
+}
+

Reply via email to