suyanhanx commented on code in PR #3456:
URL:
https://github.com/apache/incubator-opendal/pull/3456#discussion_r1378698599
##########
bindings/nodejs/tests/utils.mjs:
##########
@@ -17,33 +17,40 @@
* under the License.
*/
-const path = require('path')
+import crypto from 'node:crypto'
export function generateBytes() {
- const size = Math.floor(Math.random() * 1024) + 1
- const content = []
+ const size = Math.floor(Math.random() * 1024) + 1
+ const content = []
- for (let i = 0; i < size; i++) {
- content.push(Math.floor(Math.random() * 256))
- }
+ for (let i = 0; i < size; i++) {
+ content.push(Math.floor(Math.random() * 256))
+ }
- return Buffer.from(content)
+ return Buffer.from(content)
}
export function loadTestSchemeFromEnv() {
- require('dotenv').config({ path: path.resolve(__dirname, '../../../.env'),
debug: true })
- return process.env.OPENDAL_TEST
+ return process.env.OPENDAL_TEST
+}
+
+export function checkRandomRootEnabled() {
+ return process.env.OPENDAL_DISABLE_RANDOM_ROOT !== 'false'
+}
+
+export function generateRandomRoot() {
+ return `/opendal_${crypto.randomUUID()}`
Review Comment:
Updated.
--
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]