Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: scality/Arsenal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7.10.60
Choose a base ref
...
head repository: scality/Arsenal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7.10.61
Choose a head ref
  • 3 commits
  • 3 files changed
  • 1 contributor

Commits on Mar 4, 2024

  1. ARSN-403 Set nullVersionId to master when replacing a null version.

    nicolas2bert committed Mar 4, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    1f8b0a4 View commit details

Commits on Mar 5, 2024

  1. ARSN-403 fix tests

    nicolas2bert committed Mar 5, 2024
    Copy the full SHA
    43ff16b View commit details

Commits on Mar 6, 2024

  1. ARSN-403 bump package

    nicolas2bert committed Mar 6, 2024
    Copy the full SHA
    9ee40f3 View commit details
Showing with 70 additions and 2 deletions.
  1. +4 −1 lib/versioning/VersioningRequestProcessor.ts
  2. +1 −1 package.json
  3. +65 −0 tests/unit/versioning/VersioningRequestProcessor.spec.js
5 changes: 4 additions & 1 deletion lib/versioning/VersioningRequestProcessor.ts
Original file line number Diff line number Diff line change
@@ -402,7 +402,10 @@ export default class VersioningRequestProcessor {
if (masterVersionId) {
// => create a new version key from the master version
const masterVersionKey = formatVersionKey(key, masterVersionId);
value = Version.updateOrAppendNullVersionId(request.value, masterVersionId);
// => set the nullVersionId to the master version if put version on top of null version.
if (versionIdFromMaster !== versionId) {
value = Version.updateOrAppendNullVersionId(request.value, masterVersionId);
}
masterVersion.setNullVersion();
ops.push({ key: masterVersionKey,
value: masterVersion.toString() });
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
"engines": {
"node": ">=16"
},
"version": "7.10.59",
"version": "7.10.61",
"description": "Common utilities for the S3 project components",
"main": "build/index.js",
"repository": {
65 changes: 65 additions & 0 deletions tests/unit/versioning/VersioningRequestProcessor.spec.js
Original file line number Diff line number Diff line change
@@ -323,6 +323,7 @@ describe('test VSP', () => {
(res, next) => {
const expectedListing = [
// master version should have the provided version id and a reference of the null version id.
// NOTE: should set nullVersionId to the master version if putting a version on top of a null version.
{
key: 'bar',
value: `{"qux":"quz2","versionId":"${versionId}","nullVersionId":"${nullVersionId}"}`,
@@ -357,4 +358,68 @@ describe('test VSP', () => {
}],
done);
});

it('should be able to update a null suspended version', done => {
let nullVersionId;

async.waterfall([next => {
// simulate the creation of a null suspended version.
const request = {
db: 'foo',
key: 'bar',
value: '{"qux":"quz","isNull":true}',
options: {
versionId: '',
},
};
vsp.put(request, logger, next);
},
(res, next) => {
nullVersionId = JSON.parse(res).versionId;
// simulate update null version with BackbeatClient.putMetadata
const request = {
db: 'foo',
key: 'bar',
value: `{"qux":"quz2","isNull":true,"versionId":"${nullVersionId}"}`,
options: {
versioning: true,
versionId: nullVersionId,
},
};
vsp.put(request, logger, next);
},
(res, next) => {
wgm.list({}, logger, next);
},
(res, next) => {
const expectedListing = [
// NOTE: should not set nullVersionId to the master version if updating a null version.
{
key: 'bar',
value: `{"qux":"quz2","isNull":true,"versionId":"${nullVersionId}"}`,
},
{
key: `bar\x00${nullVersionId}`,
value: `{"qux":"quz","isNull":true,"versionId":"${nullVersionId}"}`,
},
];
assert.deepStrictEqual(res, expectedListing);

const request = {
db: 'foo',
key: 'bar',
};
vsp.get(request, logger, next);
},
(res, next) => {
const expectedGet = {
qux: 'quz2',
isNull: true,
versionId: nullVersionId,
};
assert.deepStrictEqual(JSON.parse(res), expectedGet);
next();
}],
done);
});
});