Skip to content

Commit 5b86471

Browse files
authored
chore(shell-api): add interrupt/resume integration test (#908)
1 parent d855f95 commit 5b86471

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

packages/shell-api/src/integration.spec.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,6 +2011,7 @@ describe('Shell API (integration)', function() {
20112011
it('DBQuery.batchSize takes precedence over config', async() => {
20122012
await shellApi.config.set('batchSize', 10);
20132013
shellApi.DBQuery.batchSize = 30;
2014+
expect(shellApi.DBQuery.batchSize).to.equal(30);
20142015
expect((await collection.find()._it()).documents).to.have.lengthOf(30);
20152016
});
20162017

@@ -2086,4 +2087,22 @@ describe('Shell API (integration)', function() {
20862087
});
20872088
});
20882089
});
2090+
2091+
describe('interruption', () => {
2092+
it('allows interrupting and resuming Mongo instances', async() => {
2093+
expect(internalState.interrupted.isSet()).to.equal(false);
2094+
expect(await database.runCommand({ ping: 1 })).to.deep.equal({ ok: 1 });
2095+
await internalState.onInterruptExecution();
2096+
expect(internalState.interrupted.isSet()).to.equal(true);
2097+
try {
2098+
await database.runCommand({ ping: 1 });
2099+
expect.fail('missed exceptino');
2100+
} catch (e) {
2101+
expect(e.name).to.equal('MongoshInterruptedError');
2102+
}
2103+
await internalState.onResumeExecution();
2104+
expect(internalState.interrupted.isSet()).to.equal(false);
2105+
expect(await database.runCommand({ ping: 1 })).to.deep.equal({ ok: 1 });
2106+
});
2107+
});
20892108
});

0 commit comments

Comments
 (0)