Skip to content

Commit

Permalink
NC | NSFS | Versioning | Delete Objects | Add a Test | GPFS
Browse files Browse the repository at this point in the history
Signed-off-by: shirady <[email protected]>
  • Loading branch information
shirady committed Sep 17, 2024
1 parent f393125 commit 16a2d06
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/test/unit_tests/test_nsfs_versioning_gpfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,16 @@ mocha.describe('namespace_fs gpfs- versioning', async function() {
assert.equal(head_res.version_id, latest_version_id);
});

mocha.it('delete objects - versioning enabled - use delete_multiple_objects to delete a single non-existing key', async function() {
// 1. put bucket versioning enabled
await ns_obj.set_bucket_versioning('ENABLED', dummy_object_sdk);
// 2. delete objects (a single non existing key)
const objects = [{ key: 'non-existing-key', version_id: undefined }];
const delete_objects_res = await delete_multiple_objects(dummy_object_sdk, ns_obj, gpfs_bucket, objects);
assert.equal(delete_objects_res.created_delete_marker, true);
assert.ok(delete_objects_res.created_version_id !== undefined);
});

});

async function put_object(dummy_object_sdk, ns, bucket, key) {
Expand Down Expand Up @@ -229,6 +239,15 @@ async function delete_object(dummy_object_sdk, ns, bucket, key, version_id) {
return delete_res;
}

async function delete_multiple_objects(dummy_object_sdk, ns, bucket, objects) {
const delete_objects_res = await ns.delete_multiple_objects({
bucket,
objects
}, dummy_object_sdk);
console.log('delete_multiple_objects response', util.inspect(delete_objects_res));
return delete_objects_res;
}


async function stat_and_get_all(full_path, key) {
const key_path = path.join(full_path, key);
Expand Down

0 comments on commit 16a2d06

Please sign in to comment.