Skip to content

Commit

Permalink
Merge branch 'main' into oidc-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshusinghs committed Jan 9, 2024
2 parents b03ab7a + 6b91176 commit 074124e
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 58 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/draft-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
PREV_VERSION_TAG=$(gh api repos/:owner/:repo/releases --jq '. | map(select(.draft == false)) | .[0] | .tag_name')
PREV_VERSION=$(npx semver --coerce ${PREV_VERSION_TAG})
NEXT_VERSION=$(npx semver -i $VERSION_INPUT $PREV_VERSION)
NEXT_VERSION=$(npx semver -i $VERSION_BUMP $PREV_VERSION)
else
NEXT_VERSION=${{ github.event.inputs.exactVersion }}
fi
Expand All @@ -59,13 +59,11 @@ jobs:
npx semver v"${NEXT_VERSION}"
npm version "${NEXT_VERSION}" --no-git-tag-version
echo "RELEASE_TAG=v${NEXT_VERSION}" >> $GITHUB_ENV
echo "RELEASE_TAG=v${NEXT_VERSION}" >> "$GITHUB_ENV"
- name: Validate release tag
shell: bash
run: |
RELEASE_TAG=${{ inputs.RELEASE_TAG }}
if [ -z "${RELEASE_TAG}" ]; then
echo "RELEASE_TAG is not set or is empty"
exit 1
Expand Down Expand Up @@ -98,7 +96,7 @@ jobs:
ls *.vsix.sig
gh release create "${RELEASE_TAG}" \
--title "${RELEASE_VERSION}" \
--title "${RELEASE_TAG}" \
--notes "Edit the release notes before publishing." \
--target main \
--draft \
Expand Down
19 changes: 5 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## [v1.4.0](https://github.com/mongodb-js/vscode/releases/tag/untagged-cda8b18ef8ec5f1910ea) - null

Edit the release notes before publishing.


## [v1.3.1](https://github.com/mongodb-js/vscode/releases/tag/v1.3.1) - 2023-10-09

## What's Changed
Expand Down Expand Up @@ -425,17 +430,3 @@ To dig deeper please feel free to follow the links mentioned below:
- Connections in the tree view are now alphabetically sorted


## [v0.0.3](https://github.com/mongodb-js/vscode/releases/tag/v0.0.3) - 2020-05-26

### Added

- Added `require` support in playgrounds

### Fixed

- Fixed an issue with file pathing on SSL and SSH connections on windows
- Fixed an issue with connecting to mongodb through the shell while using SSH
- Fixed a connectivity issue with playgrounds and SSH connections
- Fixed an issue with having a babel config in a workspace root


18 changes: 9 additions & 9 deletions src/test/suite/connectionController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ import {
} from './dbTestHelper';
import type { LoadedConnection } from '../../storage/connectionStorage';

// eslint-disable-next-line @typescript-eslint/no-var-requires
const { version } = require('../../../package.json');

const testDatabaseConnectionName = 'localhost:27088';
const testDatabaseURI2WithTimeout =
'mongodb://shouldfail?connectTimeoutMS=1000&serverSelectionTimeoutMS=1000';
Expand Down Expand Up @@ -245,8 +248,7 @@ suite('Connection Controller Test Suite', function () {
});

test('the connection model loads both global and workspace stored connection models', async () => {
const expectedDriverUrl =
'mongodb://localhost:27088/?appname=mongodb-vscode+0.0.0-dev.0';
const expectedDriverUrl = `mongodb://localhost:27088/?appname=mongodb-vscode+${version}`;

await vscode.workspace
.getConfiguration('mdb.connectionSaving')
Expand Down Expand Up @@ -850,7 +852,7 @@ suite('Connection Controller Test Suite', function () {
);
assert.strictEqual(
connections[0].connectionOptions?.connectionString.includes(
'appname=mongodb-vscode+0.0.0-dev.0'
`appname=mongodb-vscode+${version}`
),
true
);
Expand Down Expand Up @@ -894,8 +896,7 @@ suite('Connection Controller Test Suite', function () {
assert.deepStrictEqual(connectionInfo, {
id: 'c4871b21-92c4-40e2-a2c2-fdd551cff114',
connectionOptions: {
connectionString:
'mongodb+srv://username:[email protected]/?authSource=admin&readPreference=primary&appname=mongodb-vscode+0.0.0-dev.0&ssl=true',
connectionString: `mongodb+srv://username:[email protected]/?authSource=admin&readPreference=primary&appname=mongodb-vscode+${version}&ssl=true`,
},
});
});
Expand All @@ -914,7 +915,7 @@ suite('Connection Controller Test Suite', function () {
delete mongoClientConnectionOptions.options.oidc?.openBrowser;

assert.deepStrictEqual(mongoClientConnectionOptions, {
url: 'mongodb://localhost:27088/?appname=mongodb-vscode+0.0.0-dev.0',
url: `mongodb://localhost:27088/?appname=mongodb-vscode+${version}`,
options: {
autoEncryption: undefined,
monitorCommands: true,
Expand All @@ -929,11 +930,10 @@ suite('Connection Controller Test Suite', function () {
});

test('_getConnectionStringWithProxy returns string with proxy options', () => {
const expectedConnectionStringWithProxy =
'mongodb://localhost:27088/?appname=mongodb-vscode+0.0.0-dev.0&proxyHost=localhost&proxyPassword=gwce7tr8733ujbr&proxyPort=3378&proxyUsername=test';
const expectedConnectionStringWithProxy = `mongodb://localhost:27088/?appname=mongodb-vscode+${version}&proxyHost=localhost&proxyPassword=gwce7tr8733ujbr&proxyPort=3378&proxyUsername=test`;
const connectionString =
testConnectionController._getConnectionStringWithProxy({
url: 'mongodb://localhost:27088/?appname=mongodb-vscode+0.0.0-dev.0',
url: `mongodb://localhost:27088/?appname=mongodb-vscode+${version}`,
options: {
proxyHost: 'localhost',
proxyPassword: 'gwce7tr8733ujbr',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import { ExportToLanguageMode } from '../../../types/playgroundType';
import { TEST_DATABASE_URI } from '../dbTestHelper';
import { ExtensionContextStub } from '../stubs';

// eslint-disable-next-line @typescript-eslint/no-var-requires
const { version } = require('../../../../package.json');

const expect = chai.expect;

suite('Playground Selected CodeAction Provider Test Suite', function () {
Expand Down Expand Up @@ -385,8 +388,7 @@ suite('Playground Selected CodeAction Provider Test Suite', function () {
expectedResult = {
namespace: 'db.coll',
type: null,
content:
"# Requires the PyMongo package.\n# https://api.mongodb.com/python/current\n\nclient = MongoClient('mongodb://localhost:27088/?appname=mongodb-vscode+0.0.0-dev.0')\nfilter={\n 'name': '22'\n}\n\nresult = client['db']['coll'].find(\n filter=filter\n)",
content: `# Requires the PyMongo package.\n# https://api.mongodb.com/python/current\n\nclient = MongoClient('mongodb://localhost:27088/?appname=mongodb-vscode+${version}')\nfilter={\n 'name': '22'\n}\n\nresult = client['db']['coll'].find(\n filter=filter\n)`,
language: 'python',
};

Expand Down Expand Up @@ -460,8 +462,7 @@ suite('Playground Selected CodeAction Provider Test Suite', function () {
expectedResult = {
namespace: 'db.coll',
type: null,
content:
"# Requires the MongoDB Ruby Driver\n# https://docs.mongodb.com/ruby-driver/master/\n\nclient = Mongo::Client.new('mongodb://localhost:27088/?appname=mongodb-vscode+0.0.0-dev.0', :database => 'db')\n\nresult = client.database['coll'].find({\n 'name' => '22'\n})",
content: `# Requires the MongoDB Ruby Driver\n# https://docs.mongodb.com/ruby-driver/master/\n\nclient = Mongo::Client.new('mongodb://localhost:27088/?appname=mongodb-vscode+${version}', :database => 'db')\n\nresult = client.database['coll'].find({\n 'name' => '22'\n})`,
language: 'ruby',
};

Expand Down Expand Up @@ -535,8 +536,7 @@ suite('Playground Selected CodeAction Provider Test Suite', function () {
expectedResult = {
namespace: 'db.coll',
type: null,
content:
'// Requires the MongoDB Go Driver\n// https://go.mongodb.org/mongo-driver\nctx := context.TODO()\n\n// Set client options\nclientOptions := options.Client().ApplyURI("mongodb://localhost:27088/?appname=mongodb-vscode+0.0.0-dev.0")\n\n// Connect to MongoDB\nclient, err := mongo.Connect(ctx, clientOptions)\nif err != nil {\n log.Fatal(err)\n}\ndefer func() {\n if err := client.Disconnect(ctx); err != nil {\n log.Fatal(err)\n }\n}()\n\n// Find data\ncoll := client.Database("db").Collection("coll")\n_, err = coll.Find(ctx, bson.D{{"name", "22"}})\nif err != nil {\n log.Fatal(err)\n}',
content: `// Requires the MongoDB Go Driver\n// https://go.mongodb.org/mongo-driver\nctx := context.TODO()\n\n// Set client options\nclientOptions := options.Client().ApplyURI("mongodb://localhost:27088/?appname=mongodb-vscode+${version}")\n\n// Connect to MongoDB\nclient, err := mongo.Connect(ctx, clientOptions)\nif err != nil {\n log.Fatal(err)\n}\ndefer func() {\n if err := client.Disconnect(ctx); err != nil {\n log.Fatal(err)\n }\n}()\n\n// Find data\ncoll := client.Database("db").Collection("coll")\n_, err = coll.Find(ctx, bson.D{{"name", "22"}})\nif err != nil {\n log.Fatal(err)\n}`,
language: 'go',
};

Expand Down
51 changes: 27 additions & 24 deletions src/test/suite/telemetry/telemetryService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import { mdbTestExtension } from '../stubbableMdbExtension';
import { DatabaseTreeItem, DocumentTreeItem } from '../../../explorer';
import { DataServiceStub } from '../stubs';

// eslint-disable-next-line @typescript-eslint/no-var-requires
const { version } = require('../../../../package.json');

const expect = chai.expect;

chai.use(sinonChai);
Expand Down Expand Up @@ -129,7 +132,7 @@ suite('Telemetry Controller Test Suite', () => {
event: 'Command Run',
properties: {
command: 'mdb.addConnection',
extension_version: '0.0.0-dev.0',
extension_version: version,
},
})
);
Expand All @@ -149,8 +152,8 @@ suite('Telemetry Controller Test Suite', () => {
is_used_connect_screen: false,
is_used_command_palette: true,
is_used_saved_connection: false,
vscode_mdb_extension_version: '0.0.0-dev.0',
extension_version: '0.0.0-dev.0',
vscode_mdb_extension_version: version,
extension_version: version,
},
})
);
Expand All @@ -170,8 +173,8 @@ suite('Telemetry Controller Test Suite', () => {
is_used_connect_screen: true,
is_used_command_palette: false,
is_used_saved_connection: false,
vscode_mdb_extension_version: '0.0.0-dev.0',
extension_version: '0.0.0-dev.0',
vscode_mdb_extension_version: version,
extension_version: version,
},
})
);
Expand All @@ -191,8 +194,8 @@ suite('Telemetry Controller Test Suite', () => {
is_used_connect_screen: false,
is_used_command_palette: false,
is_used_saved_connection: true,
vscode_mdb_extension_version: '0.0.0-dev.0',
extension_version: '0.0.0-dev.0',
vscode_mdb_extension_version: version,
extension_version: version,
},
})
);
Expand All @@ -209,7 +212,7 @@ suite('Telemetry Controller Test Suite', () => {
properties: {
source: 'treeview',
success: true,
extension_version: '0.0.0-dev.0',
extension_version: version,
},
})
);
Expand All @@ -223,7 +226,7 @@ suite('Telemetry Controller Test Suite', () => {
sinon.match({
anonymousId,
event: 'Document Edited',
properties: { source: 'playground', extension_version: '0.0.0-dev.0' },
properties: { source: 'playground', extension_version: version },
})
);
});
Expand All @@ -241,7 +244,7 @@ suite('Telemetry Controller Test Suite', () => {
type: 'other',
partial: false,
error: false,
extension_version: '0.0.0-dev.0',
extension_version: version,
},
})
);
Expand All @@ -261,7 +264,7 @@ suite('Telemetry Controller Test Suite', () => {
event: 'Playground Loaded',
properties: {
file_type: 'mongodb',
extension_version: '0.0.0-dev.0',
extension_version: version,
},
})
);
Expand All @@ -280,7 +283,7 @@ suite('Telemetry Controller Test Suite', () => {
event: 'Playground Loaded',
properties: {
file_type: 'mongodbjs',
extension_version: '0.0.0-dev.0',
extension_version: version,
},
})
);
Expand All @@ -295,7 +298,7 @@ suite('Telemetry Controller Test Suite', () => {
event: 'Playground Saved',
properties: {
file_type: 'mongodbjs',
extension_version: '0.0.0-dev.0',
extension_version: version,
},
})
);
Expand All @@ -311,7 +314,7 @@ suite('Telemetry Controller Test Suite', () => {
properties: {
screen: 'helpPanel',
link_id: 'linkId',
extension_version: '0.0.0-dev.0',
extension_version: version,
},
})
);
Expand All @@ -335,7 +338,7 @@ suite('Telemetry Controller Test Suite', () => {
with_import_statements: false,
with_builders: false,
with_driver_syntax: false,
extension_version: '0.0.0-dev.0',
extension_version: version,
},
})
);
Expand All @@ -361,7 +364,7 @@ suite('Telemetry Controller Test Suite', () => {
with_import_statements: false,
with_builders: false,
with_driver_syntax: false,
extension_version: '0.0.0-dev.0',
extension_version: version,
},
})
);
Expand Down Expand Up @@ -551,7 +554,7 @@ suite('Telemetry Controller Test Suite', () => {
event: 'Playground Created',
properties: {
playground_type: 'search',
extension_version: '0.0.0-dev.0',
extension_version: version,
},
})
);
Expand All @@ -576,7 +579,7 @@ suite('Telemetry Controller Test Suite', () => {
event: 'Playground Created',
properties: {
playground_type: 'createCollection',
extension_version: '0.0.0-dev.0',
extension_version: version,
},
})
);
Expand All @@ -593,7 +596,7 @@ suite('Telemetry Controller Test Suite', () => {
event: 'Playground Created',
properties: {
playground_type: 'createDatabase',
extension_version: '0.0.0-dev.0',
extension_version: version,
},
})
);
Expand All @@ -611,7 +614,7 @@ suite('Telemetry Controller Test Suite', () => {
event: 'Playground Created',
properties: {
playground_type: 'index',
extension_version: '0.0.0-dev.0',
extension_version: version,
},
})
);
Expand Down Expand Up @@ -648,7 +651,7 @@ suite('Telemetry Controller Test Suite', () => {
event: 'Playground Created',
properties: {
playground_type: 'cloneDocument',
extension_version: '0.0.0-dev.0',
extension_version: version,
},
})
);
Expand All @@ -663,7 +666,7 @@ suite('Telemetry Controller Test Suite', () => {
event: 'Playground Created',
properties: {
playground_type: 'crud',
extension_version: '0.0.0-dev.0',
extension_version: version,
},
})
);
Expand All @@ -680,7 +683,7 @@ suite('Telemetry Controller Test Suite', () => {
event: 'Playground Created',
properties: {
playground_type: 'crud',
extension_version: '0.0.0-dev.0',
extension_version: version,
},
})
);
Expand All @@ -697,7 +700,7 @@ suite('Telemetry Controller Test Suite', () => {
event: 'Playground Created',
properties: {
playground_type: 'crud',
extension_version: '0.0.0-dev.0',
extension_version: version,
},
})
);
Expand Down

0 comments on commit 074124e

Please sign in to comment.