Skip to content

Commit

Permalink
Merge branch 'improvement/BB-618' into q/8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
bert-e committed Nov 7, 2024
2 parents 6240441 + 4607c14 commit 74559db
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
6 changes: 5 additions & 1 deletion extensions/lifecycle/conductor/LifecycleConductor.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,14 @@ class LifecycleConductor {
}

_indexesGetOrCreate(task, log, cb) {
if (this._bucketSource !== 'mongodb' || !task.isLifecycled) {
if (!task.isLifecycled) {
return process.nextTick(cb, null, lifecycleTaskVersions.v1);
}

if (this._bucketSource !== 'mongodb') {
return process.nextTick(cb, null, lifecycleTaskVersions.v2);
}

const backbeatMetadataProxy = this.clientManager.getBackbeatMetadataProxy(
this._accountIdCache.get(task.canonicalId));
if (!backbeatMetadataProxy) {
Expand Down
24 changes: 23 additions & 1 deletion tests/unit/lifecycle/LifecycleConductor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,20 +283,37 @@ describe('Lifecycle Conductor', () => {
indexesForFeature.lifecycle.v2, // getIndex response
null, // metadata proxy error
true, // flag for status ofin progress job retrieval
'mongodb',
],
[
[], // updated job state
null, // expected putIndex object
lifecycleTaskVersions.v2, // expected version
],
],
[
'should return v2 if backend is not MongoDB',
[
[],
null,
null,
true,
'bucketd',
],
[
[],
null,
lifecycleTaskVersions.v2,
],
],
[
'should return v1: missing indexes + put indexes',
[
[],
[],
null,
true,
'mongodb',
],
[
[
Expand All @@ -315,6 +332,7 @@ describe('Lifecycle Conductor', () => {
[],
null,
true,
'mongodb',
],
[
[
Expand All @@ -334,6 +352,7 @@ describe('Lifecycle Conductor', () => {
[],
null,
true,
'mongodb',
],
[
[
Expand All @@ -351,6 +370,7 @@ describe('Lifecycle Conductor', () => {
[],
null,
false,
'mongodb',
],
[
[],
Expand All @@ -365,6 +385,7 @@ describe('Lifecycle Conductor', () => {
[],
new Error('test error'),
true,
'mongodb',
],
[
[],
Expand All @@ -376,13 +397,14 @@ describe('Lifecycle Conductor', () => {

tests.forEach(([msg, input, expected]) =>
it(msg, done => {
const [inJobs, getIndexes, mockError, getInProgressSucceeded] = input;
const [inJobs, getIndexes, mockError, getInProgressSucceeded, bucektSource] = input;
const [expectedJobs, putIndexes, expectedVersion] = expected;

const client = new BackbeatMetadataProxyMock();
conductor.clientManager.getBackbeatMetadataProxy = () => client;
conductor.activeIndexingJobsRetrieved = getInProgressSucceeded;
conductor.activeIndexingJobs = inJobs;
conductor._bucketSource = bucektSource;
client.indexesObj = getIndexes;
client.error = mockError;

Expand Down

0 comments on commit 74559db

Please sign in to comment.