Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mcasimir committed Aug 25, 2021
1 parent 24186d0 commit bf0b602
Show file tree
Hide file tree
Showing 42 changed files with 1,241 additions and 469 deletions.
15 changes: 0 additions & 15 deletions .eslintrc

This file was deleted.

44 changes: 44 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const jsConfigurations = ['eslint:recommended'];

const tsConfigurations = [
...jsConfigurations,
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
];
const tsRules = {
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
};

const testConfigurations = ['plugin:mocha/recommended'];

module.exports = {
parserOptions: {
project: ['./tsconfig-lint.json'],
},
plugins: ['@typescript-eslint', 'mocha'],
env: { node: true },
overrides: [
{
parserOptions: {
ecmaVersion: 2018,
},
files: ['**/*.js'],
env: { node: true, es6: true },
extends: [...jsConfigurations, 'prettier'],
},
{
parser: '@typescript-eslint/parser',
files: ['**/*.ts'],
extends: [...tsConfigurations, 'prettier'],
rules: { ...tsRules },
},
{
files: ['**/*.spec.js', '**/*.spec.ts'],
env: { mocha: true },
extends: [...testConfigurations],
},
],
};
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,5 @@ lib
**/*.js
**/*.js.map
!**/initdb/*.js
*.tgz
!.eslintrc.js
*.tgz
3 changes: 3 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ This README is generated from the `README.tmpl.md` and all the `README.md` in th

1. Start a testing environment defined in a directory by running:

``` sh
docker-compose -f docker/<directory>/docker-compose.yaml up
```
```sh
docker-compose -f docker/<directory>/docker-compose.yaml up
```

2. Connect using the instructions specific for that testing environment as specified in the readme of each folder

Expand Down Expand Up @@ -51,7 +51,7 @@ You can either run `docker-compose up` from the subfolder containing the `docker

For example this will start a sharded cluster:

``` sh
```sh
docker-compose -f sharded/docker-compose.yaml up
```

Expand All @@ -61,16 +61,12 @@ Please also refer to the official documentation ([Getting Started](https://docs.

#### Programmatically

``` js
```js
const createTestEnvironments = require('@mongodb-js/devtools-docker-test-envs');

const testEnvironments = createTestEnvironments([
'...',
'sharded',
'...'
]);
const testEnvironments = createTestEnvironments(['...', 'sharded', '...']);

before(async() => {
before(async () => {
await testEnvironments.start();
});

Expand All @@ -79,7 +75,7 @@ it('can connect to sharded cluster', () => {
await MongoClient.connect(connectionString);
});

after(async() => {
after(async () => {
await testEnvironments.stop();
});
```
Expand Down
5 changes: 2 additions & 3 deletions docker/community/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@

### Standalone community server (no auth)

``` sh
```sh
docker-compose -f community/docker-compose.yaml up
```

#### How to connect

``` sh
```sh
mongo \
--host localhost \
--port 27020
Expand Down
8 changes: 4 additions & 4 deletions docker/community/config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const path = require("path");
import path from 'path';

export default {
dockerCompose: {
projectName: path.basename(__dirname),
yamlPath: path.resolve(__dirname, "docker-compose.yaml"),
yamlPath: path.resolve(__dirname, 'docker-compose.yaml'),
},
waitOn: ["tcp:27020"],
waitOn: ['tcp:27020'],
connections: {
community: {
connectionString: "mongodb://localhost:27020/test",
connectionString: 'mongodb://localhost:27020/test',
},
},
};
4 changes: 2 additions & 2 deletions docker/community/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ version: '3'

services:
mongodb:
image: "mongo:${MONGODB_VERSION:-4.4}"
image: 'mongo:${MONGODB_VERSION:-4.4}'
ports:
- "27020:27017"
- '27020:27017'
19 changes: 9 additions & 10 deletions docker/enterprise/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@

### Enterprise server

``` sh
```sh
docker-compose -f enterprise/docker-compose.yaml up
```

#### How to connect

``` sh
```sh
mongo \
--host localhost \
--port 27021
Expand Down Expand Up @@ -40,11 +39,11 @@ Additional dependencies for kerberos and LDAP are automatically added in a `RUN`
Enterprise images can be referenced by other testing environments that requires the enterprise server. It can be done pointing the build context to one of the image directory and setting
the right build arguments.

``` yaml
build:
image: devtools-mongodb-enterprise:<VERSION>
context: "../enterprise/<VERSION>"
args:
MONGO_PACKAGE: "mongodb-enterprise"
MONGO_REPO: repo.mongodb.com
```yaml
build:
image: devtools-mongodb-enterprise:<VERSION>
context: '../enterprise/<VERSION>'
args:
MONGO_PACKAGE: 'mongodb-enterprise'
MONGO_REPO: repo.mongodb.com
```
8 changes: 4 additions & 4 deletions docker/enterprise/config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const path = require("path");
import path from 'path';

export default {
dockerCompose: {
projectName: path.basename(__dirname),
yamlPath: path.resolve(__dirname, "docker-compose.yaml"),
yamlPath: path.resolve(__dirname, 'docker-compose.yaml'),
},
waitOn: ["tcp:27021"],
waitOn: ['tcp:27021'],
connections: {
enterprise: {
connectionString: "mongodb://localhost:27021/test",
connectionString: 'mongodb://localhost:27021/test',
},
},
};
6 changes: 3 additions & 3 deletions docker/enterprise/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ services:
mongodb:
image: devtools-mongodb-enterprise:${MONGODB_VERSION:-4.4}
build:
context: "${MONGODB_VERSION:-4.4}"
context: '${MONGODB_VERSION:-4.4}'
args:
MONGO_PACKAGE: "mongodb-enterprise"
MONGO_PACKAGE: 'mongodb-enterprise'
MONGO_REPO: repo.mongodb.com
ports:
- "27021:27017"
- '27021:27017'
32 changes: 18 additions & 14 deletions docker/kerberos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

Make sure you have this line in your `/etc/hosts`:

``` conf
```conf
127.0.0.1 mongodb-kerberos-1.example.com mongodb-kerberos-2.example.com mongodb-kerberos-3.examplecrossrealm.com
```

Make sure you have this in `/etc/krb5.conf` (note the `domain_realm` section to configure cross-realm):

``` conf
```conf
[realms]
EXAMPLE.COM = {
kdc = localhost
Expand All @@ -28,26 +28,26 @@ Make sure you have this in `/etc/krb5.conf` (note the `domain_realm` section to

Start the docker environment:

``` sh
```sh
docker-compose -f kerberos/docker-compose.yaml up
```

Authenticate with kdc (the password is `password`):

``` sh
```sh
kinit [email protected]
```

**Important:** To stop the environment, make sure to use the `-v` flag:

``` sh
```sh
docker-compose -f kerberos/docker-compose.yaml down -v
```


#### How to connect

##### Kerberos Setup

There are two Kerberos _Key Distribution Centers_ (KDCs) setup: `kdc-admin` and `kdc-admin2`. These two cover the `EXAMPLE.COM` and `EXAMPLE2.COM` realm respectively. All users listed below are registered in the `EXAMPLE.COM` realm. The service principals for `mongodb-kerberos-1` and `mongodb-kerberos-2` are also registered in the `EXAMPLE.COM` realm. The service principal for `mongodb-kerberos-3` is registered in the `EXAMPLE2.COM` realm.

The two Kerberos installations have cross-realm authentication enabled so that `kdc-admin2` (realm `EXAMPLE2.COM`) **trusts** `kdc-admin` (realm `EXAMPLE.COM`). For details on how this cross-realm trust is configured refer to [Setting up Cross-Realm Kerberos Trusts](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system-level_authentication_guide/using_trusts).
Expand All @@ -68,7 +68,7 @@ The server `mongodb-kerberos-3.examplecrossrealm.com` has the default `gssapiSer

##### Compass

``` yaml
```yaml
hostname: mongodb-kerberos-1.example.com
port: 29017
principal: [email protected]
Expand All @@ -78,28 +78,32 @@ gssapiServiceName: mongodb
##### Connection string
With as few properties as possible (`gssapiServiceName`, `authSource` will be inferred automatically) - does not work in the _old shell_:
``` sh

```sh
mongodb://mongodb.user%[email protected]:29017/?authMechanism=GSSAPI
```

With `authSource` for the old shell:
``` sh

```sh
mongodb://mongodb.user%[email protected]:29017/?authMechanism=GSSAPI&authSource=%24external
```

With an alternate service name using official `SERVICE_NAME` auth - does not work in the _old shell_:
``` sh
With an alternate service name using official `SERVICE_NAME` auth - does not work in the _old shell_:

```sh
mongodb://mongodb.user%[email protected]:29018/?authMechanism=GSSAPI&authMechanismProperties=SERVICE_NAME:alternate
```

With an alternate service name for the old shell:
``` sh

```sh
mongodb://mongodb.user%[email protected]:29018/?gssapiServiceName=alternate&authMechanism=GSSAPI&authSource=%24external
```

##### Shell (enterprise)

``` sh
```sh
mongo \
--host mongodb-kerberos-1.example.com \
--port 29017 \
Expand All @@ -108,7 +112,7 @@ mongo \
-u [email protected]
```

``` sh
```sh
mongo \
--host mongodb-kerberos-2.example.com \
--port 29018 \
Expand Down
Loading

0 comments on commit bf0b602

Please sign in to comment.