Skip to content

Commit

Permalink
feat(cli-repl): do not show MDB version for SPI STREAMS-576 (#1678)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaketbaby authored Sep 21, 2023
1 parent e099bc0 commit f1677de
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
24 changes: 24 additions & 0 deletions packages/cli-repl/src/mongosh-repl.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1309,4 +1309,28 @@ describe('MongoshNodeRepl', function () {
expect(output).to.not.match(/Using MongoDB/);
});
});

context('with is_stream: true', function () {
beforeEach(async function () {
sp.getConnectionInfo.resolves({
extraInfo: {
uri: 'mongodb://localhost:27017/test',
is_localhost: true,
is_stream: true,
},
buildInfo: {
version: '4.4.1',
},
});
mongoshReplOptions.shellCliOptions = {
nodb: false,
};
mongoshRepl = new MongoshNodeRepl(mongoshReplOptions);
await mongoshRepl.initialize(serviceProvider);
});

it('shows Atlas Stream Processing', function () {
expect(output).to.match(/Using MongoDB:\t\tAtlas Stream Processing/);
});
});
});
5 changes: 4 additions & 1 deletion packages/cli-repl/src/mongosh-repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ class MongoshNodeRepl implements EvaluationListener {
instanceState.setEvaluationListener(this);
await instanceState.fetchConnectionInfo();

let mongodVersion = instanceState.connectionInfo.buildInfo?.version;
const { buildInfo, extraInfo } = instanceState.connectionInfo;
let mongodVersion = extraInfo?.is_stream
? 'Atlas Stream Processing'
: buildInfo?.version;
const apiVersion = serviceProvider.getRawClient()?.serverApi?.version;
if (apiVersion) {
mongodVersion =
Expand Down

0 comments on commit f1677de

Please sign in to comment.