|
3 | 3 |
|
4 | 4 | const mocha = require('mocha');
|
5 | 5 | const assert = require('assert');
|
| 6 | +const config = require('../../../config'); |
6 | 7 |
|
7 | 8 | const buffer_utils = require('../../util/buffer_utils');
|
| 9 | +const fs_utils = require('../../util/fs_utils'); |
8 | 10 |
|
9 | 11 | // eslint-disable-next-line max-lines-per-function
|
10 | 12 | function test_ns_list_objects(ns, object_sdk, bucket) {
|
@@ -313,6 +315,33 @@ function test_ns_list_objects(ns, object_sdk, bucket) {
|
313 | 315 | });
|
314 | 316 | });
|
315 | 317 |
|
| 318 | + mocha.describe('list objects - hidden dir', function() { |
| 319 | + |
| 320 | + this.timeout(10 * 60 * 1000); // eslint-disable-line no-invalid-this |
| 321 | + |
| 322 | + const hidden_dir_bkt = 'test_ns_hidder_dir'; |
| 323 | + const dummy_file1 = 'dummy1'; |
| 324 | + const dummy_file2 = 'dummy2'; |
| 325 | + const hidden_dir = config.NSFS_TEMP_DIR_NAME + '-buck_id'; |
| 326 | + |
| 327 | + mocha.before(async function() { |
| 328 | + fs_utils.create_fresh_path(`${ns.bucket_path}/${hidden_dir}`); // creating new hidden dir starting with .noobaa-nsfs |
| 329 | + await create_keys([dummy_file1, dummy_file2]); |
| 330 | + }); |
| 331 | + mocha.after(async function() { |
| 332 | + await delete_keys([dummy_file1, dummy_file2]); |
| 333 | + }); |
| 334 | + |
| 335 | + mocha.it('should not list the hidden/internal dir as common_prefixes', async function() { |
| 336 | + const r = await ns.list_objects({ |
| 337 | + bucket: hidden_dir_bkt, |
| 338 | + delimiter: '/' |
| 339 | + }, object_sdk); |
| 340 | + assert.deepStrictEqual(r.is_truncated, false); |
| 341 | + assert.deepStrictEqual(r.common_prefixes, []); |
| 342 | + assert.deepStrictEqual(r.objects.length, 2); |
| 343 | + }); |
| 344 | + }); |
316 | 345 | mocha.describe('max keys test', function() {
|
317 | 346 |
|
318 | 347 | this.timeout(10 * 60 * 1000); // eslint-disable-line no-invalid-this
|
|
0 commit comments