Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use V2 listing when listing backend is not mongodb #2571

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading