From b8004e68a007b45b68a4cf39a03d98026b2230c9 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 31 Oct 2023 14:51:15 -0500 Subject: [PATCH] GODRIVER-3018 Use pre-commit for development (#1443) --- .evergreen/ocsp-requirements.txt | 2 +- .evergreen/run-fuzz.sh | 3 +- .evergreen/run-tests.sh | 4 +- .github/workflows/test.yml | 21 ++++++++ .pre-commit-config.yaml | 50 +++++++++++++++++++ README.md | 33 +++++++----- THIRD-PARTY-NOTICES | 6 +-- bson/bsonrw/copier.go | 2 +- bson/mgocompat/bson_test.go | 6 +-- docs/CONTRIBUTING.md | 28 +++++++++-- docs/common-issues.md | 1 + docs/pull_request_template.md | 3 +- etc/api_report.sh | 2 +- etc/assets/docs-mongodb-green.svg | 2 +- etc/assets/godev-bson-blue.svg | 2 +- etc/assets/godev-mongo-blue.svg | 2 +- etc/gen-ec-certs/gen-ec-certs.sh | 3 +- etc/generate_notices.pl | 6 +-- etc/install-libmongocrypt.sh | 2 +- internal/assert/assertion_format.go | 2 +- internal/assert/assertions.go | 4 +- internal/assert/assertions_test.go | 2 +- internal/assert/difflib.go | 2 +- internal/aws/signer/v4/v4_test.go | 2 +- internal/logger/logger.go | 2 +- internal/rand/rand.go | 2 +- internal/require/require.go | 4 +- internal/test/faas/awslambda/Makefile | 1 - internal/test/faas/awslambda/mongodb/main.go | 4 +- mongo/bulk_write.go | 2 +- mongo/collection.go | 2 +- mongo/integration/cursor_test.go | 2 +- .../integration/retryable_reads_prose_test.go | 2 +- .../retryable_writes_prose_test.go | 2 +- mongo/integration/unified/admin_helpers.go | 2 +- .../integration/unified/bulkwrite_helpers.go | 2 +- mongo/integration/unified/entity_test.go | 2 +- mongo/mongo_test.go | 2 +- mongo/options/clientoptions.go | 2 +- mongo/options/clientoptions_test.go | 4 +- .../testdata/one-pk-multiple-certs.pem | 2 +- mongo/results.go | 2 +- testdata/auth/mongodb-aws.rst | 16 +++--- testdata/client-side-encryption/README.rst | 2 +- .../client-side-operations-timeout/README.rst | 2 +- .../README.rst | 6 +-- .../connection-monitoring-and-pooling.rst | 22 ++++---- testdata/crud/README.rst | 2 +- testdata/kmip-certs/README.md | 1 - testdata/mongocrypt/kms-reply.txt | 2 +- testdata/read-write-concern/README.rst | 4 +- testdata/retryable-reads/README.rst | 14 +++--- testdata/retryable-writes/README.rst | 2 +- .../logging/load-balanced.json | 0 .../logging/load-balanced.yml | 0 .../logging/operation-id.json | 0 testdata/transactions/README.rst | 2 +- x/README.md | 4 +- x/bsonx/bsoncore/bsoncore.go | 2 +- x/mongo/driver/DESIGN.md | 4 ++ .../driver/auth/internal/gssapi/gss_wrapper.c | 12 ++--- .../driver/auth/internal/gssapi/gss_wrapper.h | 8 +-- x/mongo/driver/auth/internal/gssapi/sspi.go | 2 +- .../auth/internal/gssapi/sspi_wrapper.c | 6 +-- .../auth/internal/gssapi/sspi_wrapper.h | 4 +- x/mongo/driver/batches.go | 2 +- x/mongo/driver/errors.go | 2 +- x/mongo/driver/ocsp/ocsp.go | 2 +- x/mongo/driver/operation.go | 6 +-- x/mongo/driver/operation/hello.go | 2 +- x/mongo/driver/topology/DESIGN.md | 7 ++- x/mongo/driver/topology/cmap_prose_test.go | 2 +- x/mongo/driver/topology/connection_test.go | 2 +- x/mongo/driver/topology/fsm.go | 4 +- x/mongo/driver/topology/pool_test.go | 2 +- x/mongo/driver/topology/sdam_spec_test.go | 4 +- x/mongo/driver/topology/server.go | 2 +- x/mongo/driver/topology/topology.go | 2 +- x/mongo/driver/topology/topology_options.go | 2 +- 79 files changed, 249 insertions(+), 140 deletions(-) create mode 100644 .github/workflows/test.yml create mode 100644 .pre-commit-config.yaml mode change 100755 => 100644 etc/gen-ec-certs/gen-ec-certs.sh mode change 100755 => 100644 testdata/server-selection/logging/load-balanced.json mode change 100755 => 100644 testdata/server-selection/logging/load-balanced.yml mode change 100755 => 100644 testdata/server-selection/logging/operation-id.json diff --git a/.evergreen/ocsp-requirements.txt b/.evergreen/ocsp-requirements.txt index 7325f2f8bc..398d15b210 100644 --- a/.evergreen/ocsp-requirements.txt +++ b/.evergreen/ocsp-requirements.txt @@ -1,3 +1,3 @@ asn1crypto==1.3.0 bottle==0.12.20 -oscrypto==1.2.0 \ No newline at end of file +oscrypto==1.2.0 diff --git a/.evergreen/run-fuzz.sh b/.evergreen/run-fuzz.sh index 5871c06c10..3538da7f34 100755 --- a/.evergreen/run-fuzz.sh +++ b/.evergreen/run-fuzz.sh @@ -44,7 +44,7 @@ do for CORPUS_FILE in $PARENTDIR/testdata/fuzz/$FUNC/* do # Check to see if the value for CORPUS_FILE is in cset. - if [[ ! " ${cset[@]} " =~ " ${CORPUS_FILE} " ]]; then + if [[ ! " ${cset[*]} " =~ " ${CORPUS_FILE} " ]]; then # Create the directory if it doesn't exist. if [ ! -d $PROJECT_DIRECTORY/fuzz/$FUNC ]; then mkdir -p $PROJECT_DIRECTORY/fuzz/$FUNC @@ -69,4 +69,3 @@ if [ -d $PROJECT_DIRECTORY/fuzz ]; then # This will trigger a notification to be sent to the Go Driver team. exit 1 fi - diff --git a/.evergreen/run-tests.sh b/.evergreen/run-tests.sh index 43b1ac0c29..d4abde9b3b 100644 --- a/.evergreen/run-tests.sh +++ b/.evergreen/run-tests.sh @@ -7,7 +7,7 @@ export GOCACHE="$(pwd)/.cache" export DRIVERS_TOOLS=${DRIVERS_TOOLS:-""} if [ -z $DRIVERS_TOOLS ]; then - export DRIVERS_TOOLS=="$(dirname $(dirname $(dirname `pwd`)))/drivers-tools" + export DRIVERS_TOOLS="$(dirname $(dirname $(dirname `pwd`)))/drivers-tools" fi if [ "Windows_NT" = "$OS" ]; then @@ -49,7 +49,7 @@ fi # Using python3-venv in Ubuntu 14.04 (an OS required for legacy server version # tasks) requires the use of apt-get, which we wish to avoid. So, we do not set # a python3 binary on Ubuntu 14.04. Setting AWS temp credentials for legacy -# server version tasks is unneccesary, as temp credentials are only needed on 4.2+. +# server version tasks is unnecessary, as temp credentials are only needed on 4.2+. if [ ! -z ${PYTHON3_BINARY} ]; then export AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID}" export AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY}" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000000..ab05fafebe --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,21 @@ +name: GoDriver Tests + +on: + push: + pull_request: + +concurrency: + group: test-${{ github.ref }} + cancel-in-progress: true + +defaults: + run: + shell: bash -eux {0} + +jobs: + pre_commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + - uses: pre-commit/action@v3.0.0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000..c13963a748 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,50 @@ + +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-added-large-files + - id: check-case-conflict + - id: check-merge-conflict + - id: check-json + - id: end-of-file-fixer + exclude: ^vendor/ + exclude_types: [json,yaml] + - id: trailing-whitespace + exclude: ^(vendor/|internal/assert/assertions_test.go) + exclude_types: [json,yaml] + +- repo: https://github.com/executablebooks/mdformat + rev: 0.7.17 + hooks: + - id: mdformat + exclude: ^vendor/ + +- repo: https://github.com/python-jsonschema/check-jsonschema + rev: 0.27.0 + hooks: + - id: check-github-workflows + +# We use the Python version instead of the original version which seems to require Docker +# https://github.com/koalaman/shellcheck-precommit +- repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.9.0.6 + hooks: + - id: shellcheck + name: shellcheck + args: ["--severity=error"] + +- repo: https://github.com/codespell-project/codespell + rev: "v2.2.6" + hooks: + - id: codespell + args: ["-L", "te,fo,fle,alo,nin,compres,wil,collone,asess,sav,ot,wll,dne,nulll,hellow"] + exclude: ^(vendor/|benchmark/operation_test.go) + exclude_types: [json,yaml,pem] + +- repo: https://github.com/golangci/golangci-lint + rev: v1.55.1 + hooks: + - id: golangci-lint diff --git a/README.md b/README.md index 82d0a7ba5e..5631fbc5bc 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,8 @@ The MongoDB supported driver for Go. -------------------------- +______________________________________________________________________ + ## Requirements - Go 1.13 or higher. We aim to support the latest versions of Go. @@ -18,7 +19,8 @@ The MongoDB supported driver for Go. - Go 1.20 or higher is required to run the driver test suite. - MongoDB 3.6 and higher. -------------------------- +______________________________________________________________________ + ## Installation The recommended way to get started using the MongoDB Go driver is by using Go modules to install the dependency in @@ -35,7 +37,8 @@ When using a version of Go that does not support modules, the driver can be inst dep ensure -add "go.mongodb.org/mongo-driver/mongo" ``` -------------------------- +______________________________________________________________________ + ## Usage To get started with the driver, import the `mongo` package and create a `mongo.Client` with the `Connect` function: @@ -150,13 +153,13 @@ Additional examples and documentation can be found under the examples directory ### Network Compression -Network compression will reduce bandwidth requirements between MongoDB and the application. +Network compression will reduce bandwidth requirements between MongoDB and the application. The Go Driver supports the following compression algorithms: 1. [Snappy](https://google.github.io/snappy/) (`snappy`): available in MongoDB 3.4 and later. -2. [Zlib](https://zlib.net/) (`zlib`): available in MongoDB 3.6 and later. -3. [Zstandard](https://github.com/facebook/zstd/) (`zstd`): available in MongoDB 4.2 and later. +1. [Zlib](https://zlib.net/) (`zlib`): available in MongoDB 3.6 and later. +1. [Zstandard](https://github.com/facebook/zstd/) (`zstd`): available in MongoDB 4.2 and later. #### Specify Compression Algorithms @@ -176,35 +179,41 @@ If compressors are set, the Go Driver negotiates with the server to select the f Messages compress when both parties enable network compression; otherwise, messages remain uncompressed -------------------------- +______________________________________________________________________ + ## Feedback For help with the driver, please post in the [MongoDB Community Forums](https://developer.mongodb.com/community/forums/tag/golang/). New features and bugs can be reported on jira: https://jira.mongodb.org/browse/GODRIVER -------------------------- +______________________________________________________________________ + ## Contribution Check out the [project page](https://jira.mongodb.org/browse/GODRIVER) for tickets that need completing. See our [contribution guidelines](docs/CONTRIBUTING.md) for details. -------------------------- +______________________________________________________________________ + ## Continuous Integration Commits to master are run automatically on [evergreen](https://evergreen.mongodb.com/waterfall/mongo-go-driver). -------------------------- +______________________________________________________________________ + ## Frequently Encountered Issues See our [common issues](docs/common-issues.md) documentation for troubleshooting frequently encountered issues. -------------------------- +______________________________________________________________________ + ## Thanks and Acknowledgement - The Go Gopher artwork by [@ashleymcnamara](https://github.com/ashleymcnamara) - The original Go Gopher was designed by [Renee French](http://reneefrench.blogspot.com/) -------------------------- +______________________________________________________________________ + ## License The MongoDB Go Driver is licensed under the [Apache License](LICENSE). diff --git a/THIRD-PARTY-NOTICES b/THIRD-PARTY-NOTICES index cd84bb4f0f..9e0bb2ae15 100644 --- a/THIRD-PARTY-NOTICES +++ b/THIRD-PARTY-NOTICES @@ -192,13 +192,13 @@ Copyright (c) 2010-2013 - Gustavo Niemeyer All rights reserved. Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: +modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. + list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. + and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED diff --git a/bson/bsonrw/copier.go b/bson/bsonrw/copier.go index c146d02e58..4d279b7fee 100644 --- a/bson/bsonrw/copier.go +++ b/bson/bsonrw/copier.go @@ -124,7 +124,7 @@ func (c Copier) CopyBytesToDocumentWriter(dst DocumentWriter, src []byte) error } func (c Copier) copyBytesToValueWriter(src []byte, wef writeElementFn) error { - // TODO(skriptble): Create errors types here. Anything thats a tag should be a property. + // TODO(skriptble): Create errors types here. Anything that is a tag should be a property. length, rem, ok := bsoncore.ReadLength(src) if !ok { return fmt.Errorf("couldn't read length from src, not enough bytes. length=%d", len(src)) diff --git a/bson/mgocompat/bson_test.go b/bson/mgocompat/bson_test.go index 9b4495dcc3..45fb5b27f6 100644 --- a/bson/mgocompat/bson_test.go +++ b/bson/mgocompat/bson_test.go @@ -916,13 +916,13 @@ func TestUnmarshalAllItemsWithPtrSetter(t *testing.T) { if i == 0 { assert.Nil(t, field, "expected field to be nil, got: %v", field) } else { - assert.Nil(t, field.Received, "expected field.recieved to be nil, got: %v", field.Received) + assert.Nil(t, field.Received, "expected field.received to be nil, got: %v", field.Received) } } else { expected := item.obj.(bson.M)["_"] assert.NotNil(t, field, "Pointer not initialized (%#v)", expected) - assert.True(t, reflect.DeepEqual(expected, field.Received), "expected field.recieved to be: %v, got: %v", expected, field.Received) + assert.True(t, reflect.DeepEqual(expected, field.Received), "expected field.received to be: %v, got: %v", expected, field.Received) } } }) @@ -933,7 +933,7 @@ func TestUnmarshalWholeDocumentWithSetter(t *testing.T) { obj := &setterType{} err := bson.UnmarshalWithRegistry(Registry, []byte(sampleItems[0].data), obj) assert.Nil(t, err, "expected nil error, got: %v", err) - assert.True(t, reflect.DeepEqual(bson.M{"hello": "world"}, obj.Received), "expected obj.recieved to be: %v, got: %v", bson.M{"hello": "world"}, obj.Received) + assert.True(t, reflect.DeepEqual(bson.M{"hello": "world"}, obj.Received), "expected obj.received to be: %v, got: %v", bson.M{"hello": "world"}, obj.Received) } func TestUnmarshalSetterErrors(t *testing.T) { diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 8a25e6f4d9..a46749c44b 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -18,6 +18,7 @@ The Go Driver team uses GitHub to manage and review all code changes. Patches sh applicable. Code should compile and tests should pass under all Go versions which the driver currently supports. Currently the Go Driver supports a minimum version of Go 1.13 and requires Go 1.20 for development. Please run the following Make targets to validate your changes: + - `make fmt` - `make lint` (requires [golangci-lint](https://github.com/golangci/golangci-lint) and [lll](https://github.com/walle/lll) to be installed and available in the `PATH`) - `make test` @@ -29,6 +30,23 @@ If any tests do not pass, or relevant tests are not included, the patch will not If you are working on a bug or feature listed in Jira, please include the ticket number prefixed with GODRIVER in the commit message and GitHub pull request title, (e.g. GODRIVER-123). For the patch commit message itself, please follow the [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/) guide. +### Linting on commit + +The Go team uses [pre-commit](https://pre-commit.com/#installation) to lint both source and text files. + +To install locally, run: + +```bash +brew install pre-commit +pre-commit install +``` + +After that, the checks will run on any changed files when committing. To manually run the checks on all files, run: + +```bash +pre-commit run --all-files +``` + ### Cherry-picking between branches You must first install the `gh` cli (`brew install gh`), then set your GitHub username: @@ -77,6 +95,7 @@ mongod \ ``` To run the tests with `make`, set: + - `MONGO_GO_DRIVER_CA_FILE` to the location of the CA file used by the database - `MONGO_GO_DRIVER_KEY_FILE` to the location of the client key file - `MONGO_GO_DRIVER_PKCS8_ENCRYPTED_KEY_FILE` to the location of the pkcs8 client key file encrypted with the password string: `password` @@ -98,6 +117,7 @@ make ``` Notes: + - The `--tlsAllowInvalidCertificates` flag is required on the server for the test suite to work correctly. - The test suite requires the auth database to be set with `?authSource=admin`, not `/admin`. @@ -120,7 +140,7 @@ The requirements for testing FaaS implementations in the Go Driver vary dependin The following are the requirements for running the AWS Lambda tests locally: 1. [AWS SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html) -2. [Docker](https://www.docker.com/products/docker-desktop/) +1. [Docker](https://www.docker.com/products/docker-desktop/) Local testing requires exporting the `MONGODB_URI` environment variables. To build the AWS Lambda image and invoke the `MongoDBFunction` lambda function use the `build-faas-awslambda` make target: @@ -134,15 +154,15 @@ There is currently no arm64 support for the go1.x runtime, see [here](https://do ### Testing in Docker -We support local testing in Docker. Ensure ``docker`` is installed and running, and then run: +We support local testing in Docker. Ensure `docker` is installed and running, and then run: ```bash bash etc/run_docker.sh ``` -The script takes an optional argument for the ``MAKEFILE_TARGET`` and allows for some environment variable overrides. +The script takes an optional argument for the `MAKEFILE_TARGET` and allows for some environment variable overrides. The docker container has the required binaries, including libmongocrypt. -The entry script starts a MongoDB topology, and then executes the desired ``MAKEFILE_TARGET``. +The entry script starts a MongoDB topology, and then executes the desired `MAKEFILE_TARGET`. For example, to test against a sharded cluster, using enterprise auth, run: diff --git a/docs/common-issues.md b/docs/common-issues.md index 0dc3c6ae56..d89ffc323e 100644 --- a/docs/common-issues.md +++ b/docs/common-issues.md @@ -58,6 +58,7 @@ When connecting to a MongoDB deployment with password authentication enabled, if > connection() error occurred during connection handshake: auth error: sasl conversation error: unable to authenticate using mechanism "SCRAM-SHA-256": (AuthenticationFailed) Authentication failed. That error can be caused by a number of issues. The error message intentionally omits the exact authentication failure reason (see the [OWASP Authentication and Error Messages guidelines](https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html#authentication-and-error-messages) for an explanation). Possible causes of the error include: + - Incorrect password. - Incorrect username. - Incorrect authentication database (i.e. [authSource](https://www.mongodb.com/docs/manual/reference/connection-string/#mongodb-urioption-urioption.authSource)). diff --git a/docs/pull_request_template.md b/docs/pull_request_template.md index 2976bfd437..1a3d537d10 100644 --- a/docs/pull_request_template.md +++ b/docs/pull_request_template.md @@ -1,8 +1,9 @@ ## Summary + ## Background & Motivation - + diff --git a/etc/api_report.sh b/etc/api_report.sh index 5478241dca..4c60f76b3f 100755 --- a/etc/api_report.sh +++ b/etc/api_report.sh @@ -8,7 +8,7 @@ if [ "$BASE_SHA" == "$HEAD_SHA" ]; then echo "Skipping API Report" exit 0 fi - + # Ensure a clean checkout. git checkout -b test-api-report git add . diff --git a/etc/assets/docs-mongodb-green.svg b/etc/assets/docs-mongodb-green.svg index ed5d848731..ad7bc74c09 100644 --- a/etc/assets/docs-mongodb-green.svg +++ b/etc/assets/docs-mongodb-green.svg @@ -1 +1 @@ - docsdocsmongodbmongodb \ No newline at end of file + docsdocsmongodbmongodb diff --git a/etc/assets/godev-bson-blue.svg b/etc/assets/godev-bson-blue.svg index 1a4b37b260..055fe77db3 100644 --- a/etc/assets/godev-bson-blue.svg +++ b/etc/assets/godev-bson-blue.svg @@ -1 +1 @@ - go.devgo.devbsonbson \ No newline at end of file + go.devgo.devbsonbson diff --git a/etc/assets/godev-mongo-blue.svg b/etc/assets/godev-mongo-blue.svg index 7b490a3b79..184dd69fb8 100644 --- a/etc/assets/godev-mongo-blue.svg +++ b/etc/assets/godev-mongo-blue.svg @@ -1 +1 @@ - go.devgo.devmongomongo \ No newline at end of file + go.devgo.devmongomongo diff --git a/etc/gen-ec-certs/gen-ec-certs.sh b/etc/gen-ec-certs/gen-ec-certs.sh old mode 100755 new mode 100644 index db901f9d0b..57c03a528f --- a/etc/gen-ec-certs/gen-ec-certs.sh +++ b/etc/gen-ec-certs/gen-ec-certs.sh @@ -1,7 +1,8 @@ +#!/usr/bin/env bash # This script is used to generate Elliptic Curve (EC) certificates. # The EC certificates are used for testing the Go driver with PyKMIP. # PyKMIP does not support Go's default TLS cipher suites with RSA. -# See: GODRIVER-2239. +# See: GODRIVER-2239. set -euo pipefail CA_SERIAL=$RANDOM SERVER_SERIAL=$RANDOM diff --git a/etc/generate_notices.pl b/etc/generate_notices.pl index df375a4577..b40278ef9c 100755 --- a/etc/generate_notices.pl +++ b/etc/generate_notices.pl @@ -228,13 +228,13 @@ sub forked_licenses { All rights reserved. Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: +modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. + list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. + and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED diff --git a/etc/install-libmongocrypt.sh b/etc/install-libmongocrypt.sh index af0a266aa9..5c447368ce 100644 --- a/etc/install-libmongocrypt.sh +++ b/etc/install-libmongocrypt.sh @@ -18,7 +18,7 @@ if [ "Windows_NT" = "${OS:-}" ]; then cd .. cp libmongocrypt-all/windows-test/bin/mongocrypt.dll c:/libmongocrypt/bin cp libmongocrypt-all/windows-test/include/mongocrypt/*.h c:/libmongocrypt/include - + rm -rf libmongocrypt-all echo "fetching build for Windows ... end" else diff --git a/internal/assert/assertion_format.go b/internal/assert/assertion_format.go index 5cfaef5519..474a5f42fb 100644 --- a/internal/assert/assertion_format.go +++ b/internal/assert/assertion_format.go @@ -61,7 +61,7 @@ func EqualErrorf(t TestingT, theError error, errString string, msg string, args return EqualError(t, theError, errString, append([]interface{}{msg}, args...)...) } -// EqualValuesf asserts that two objects are equal or convertable to the same types +// EqualValuesf asserts that two objects are equal or convertible to the same types // and equal. // // assert.EqualValuesf(t, uint32(123), int32(123), "error message %s", "formatted") diff --git a/internal/assert/assertions.go b/internal/assert/assertions.go index b8502b2aa7..c227d47c83 100644 --- a/internal/assert/assertions.go +++ b/internal/assert/assertions.go @@ -172,7 +172,7 @@ func messageFromMsgAndArgs(msgAndArgs ...interface{}) string { // Aligns the provided message so that all lines after the first line start at the same location as the first line. // Assumes that the first line starts at the correct location (after carriage return, tab, label, spacer and tab). -// The longestLabelLen parameter specifies the length of the longest label in the output (required becaues this is the +// The longestLabelLen parameter specifies the length of the longest label in the output (required because this is the // basis on which the alignment occurs). func indentMessageLines(message string, longestLabelLen int) string { outBuf := new(bytes.Buffer) @@ -354,7 +354,7 @@ func truncatingFormat(data interface{}) string { return value } -// EqualValues asserts that two objects are equal or convertable to the same types +// EqualValues asserts that two objects are equal or convertible to the same types // and equal. // // assert.EqualValues(t, uint32(123), int32(123)) diff --git a/internal/assert/assertions_test.go b/internal/assert/assertions_test.go index 2e50a8136f..6c03bbd2e1 100644 --- a/internal/assert/assertions_test.go +++ b/internal/assert/assertions_test.go @@ -691,7 +691,7 @@ func TestError(t *testing.T) { True(t, Error(mockT, err), "Error with error should return True") // go vet check - True(t, Errorf(mockT, err, "example with %s", "formatted message"), "Errorf with error should rturn True") + True(t, Errorf(mockT, err, "example with %s", "formatted message"), "Errorf with error should return True") // returning an empty error interface err = func() error { diff --git a/internal/assert/difflib.go b/internal/assert/difflib.go index cc46ad4474..e13a66a930 100644 --- a/internal/assert/difflib.go +++ b/internal/assert/difflib.go @@ -65,7 +65,7 @@ type OpCode struct { // notion, pairing up elements that appear uniquely in each sequence. // That, and the method here, appear to yield more intuitive difference // reports than does diff. This method appears to be the least vulnerable -// to synching up on blocks of "junk lines", though (like blank lines in +// to syncing up on blocks of "junk lines", though (like blank lines in // ordinary text files, or maybe "

" lines in HTML files). That may be // because this is the only method of the 3 that has a *concept* of // "junk" . diff --git a/internal/aws/signer/v4/v4_test.go b/internal/aws/signer/v4/v4_test.go index a71fe300c7..51966b96db 100644 --- a/internal/aws/signer/v4/v4_test.go +++ b/internal/aws/signer/v4/v4_test.go @@ -305,7 +305,7 @@ func TestSignWithBody_ReplaceRequestBody(t *testing.T) { } if req.Body == origBody { - t.Errorf("expeect request body to not be origBody") + t.Errorf("expect request body to not be origBody") } if req.Body == nil { diff --git a/internal/logger/logger.go b/internal/logger/logger.go index 0762fc8868..03d42814f4 100644 --- a/internal/logger/logger.go +++ b/internal/logger/logger.go @@ -19,7 +19,7 @@ import ( // logged for a stringified BSON document. const DefaultMaxDocumentLength = 1000 -// TruncationSuffix are trailling ellipsis "..." appended to a message to +// TruncationSuffix are trailing ellipsis "..." appended to a message to // indicate to the user that truncation occurred. This constant does not count // toward the max document length. const TruncationSuffix = "..." diff --git a/internal/rand/rand.go b/internal/rand/rand.go index ffd0509bd5..4c3d3e6ee2 100644 --- a/internal/rand/rand.go +++ b/internal/rand/rand.go @@ -357,7 +357,7 @@ func (s *LockedSource) Seed(seed uint64) { s.lk.Unlock() } -// seedPos implements Seed for a LockedSource without a race condiiton. +// seedPos implements Seed for a LockedSource without a race condition. func (s *LockedSource) seedPos(seed uint64, readPos *int8) { s.lk.Lock() s.src.Seed(seed) diff --git a/internal/require/require.go b/internal/require/require.go index 901c3818ee..4854bbcd54 100644 --- a/internal/require/require.go +++ b/internal/require/require.go @@ -131,7 +131,7 @@ func EqualErrorf(t TestingT, theError error, errString string, msg string, args t.FailNow() } -// EqualValues asserts that two objects are equal or convertable to the same types +// EqualValues asserts that two objects are equal or convertible to the same types // and equal. // // assert.EqualValues(t, uint32(123), int32(123)) @@ -145,7 +145,7 @@ func EqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArg t.FailNow() } -// EqualValuesf asserts that two objects are equal or convertable to the same types +// EqualValuesf asserts that two objects are equal or convertible to the same types // and equal. // // assert.EqualValuesf(t, uint32(123), int32(123), "error message %s", "formatted") diff --git a/internal/test/faas/awslambda/Makefile b/internal/test/faas/awslambda/Makefile index b374dc97b8..82cc7bb955 100644 --- a/internal/test/faas/awslambda/Makefile +++ b/internal/test/faas/awslambda/Makefile @@ -5,4 +5,3 @@ default: # These cases require either building a mongodb docker container or # using a serverless service such as Atlas. sam local invoke --parameter-overrides "MongoDbUri=${MONGODB_URI}" - diff --git a/internal/test/faas/awslambda/mongodb/main.go b/internal/test/faas/awslambda/mongodb/main.go index a0c55f9085..e4aac39688 100644 --- a/internal/test/faas/awslambda/mongodb/main.go +++ b/internal/test/faas/awslambda/mongodb/main.go @@ -25,7 +25,7 @@ const timeout = 60 * time.Second // eventListener supports command, heartbeat, and pool event handlers to record // event durations, as well as the number of heartbeats, commands, and open -// conections. +// connections. type eventListener struct { commandCount int commandDuration int64 @@ -75,7 +75,7 @@ func (listener *eventListener) serverMonitor() *event.ServerMonitor { } // poolMonitor initialize an event.PoolMonitor that will increment each time a -// new conneciton is created and decrement each time a connection is closed. +// new connection is created and decrement each time a connection is closed. func (listener *eventListener) poolMonitor() *event.PoolMonitor { poolEvent := func(e *event.PoolEvent) { switch e.Type { diff --git a/mongo/bulk_write.go b/mongo/bulk_write.go index 58e64f1d9a..42d286ea7d 100644 --- a/mongo/bulk_write.go +++ b/mongo/bulk_write.go @@ -26,7 +26,7 @@ type bulkWriteBatch struct { indexes []int } -// bulkWrite perfoms a bulkwrite operation +// bulkWrite performs a bulkwrite operation type bulkWrite struct { comment interface{} ordered *bool diff --git a/mongo/collection.go b/mongo/collection.go index 6699a6d4c0..fcbfcc77a1 100644 --- a/mongo/collection.go +++ b/mongo/collection.go @@ -1867,7 +1867,7 @@ func (coll *Collection) drop(ctx context.Context) error { ServerAPI(coll.client.serverAPI).Timeout(coll.client.timeout) err = op.Execute(ctx) - // ignore namespace not found erorrs + // ignore namespace not found errors driverErr, ok := err.(driver.Error) if !ok || (ok && !driverErr.NamespaceNotFound()) { return replaceErrors(err) diff --git a/mongo/integration/cursor_test.go b/mongo/integration/cursor_test.go index 9f57d3a6dd..8354bb3325 100644 --- a/mongo/integration/cursor_test.go +++ b/mongo/integration/cursor_test.go @@ -130,7 +130,7 @@ func TestCursor(t *testing.T) { evt := mt.GetStartedEvent() assert.Nil(mt, evt, "expected no events, got %v", evt) - // The batch is exhaused, so the batch length should be 0. Do one Next call, which should do a getMore and + // The batch is exhausted, so the batch length should be 0. Do one Next call, which should do a getMore and // fetch batchSize more documents. The batch length after the call should be (batchSize-1) because Next consumes // one document. assertCursorBatchLength(mt, cursor, 0) diff --git a/mongo/integration/retryable_reads_prose_test.go b/mongo/integration/retryable_reads_prose_test.go index 80f4d3329a..7d153d852f 100644 --- a/mongo/integration/retryable_reads_prose_test.go +++ b/mongo/integration/retryable_reads_prose_test.go @@ -111,7 +111,7 @@ func TestRetryableReadsProse(t *testing.T) { // Note that setting this value greater than 2 will result in false // negatives. The current specification does not account for CSOT, which - // might allow for an "inifinite" number of retries over a period of time. + // might allow for an "infinite" number of retries over a period of time. // Because of this, we only track the "previous server". hostCount int failpointErrorCode int32 diff --git a/mongo/integration/retryable_writes_prose_test.go b/mongo/integration/retryable_writes_prose_test.go index 165c683e36..0c93a45417 100644 --- a/mongo/integration/retryable_writes_prose_test.go +++ b/mongo/integration/retryable_writes_prose_test.go @@ -292,7 +292,7 @@ func TestRetryableWritesProse(t *testing.T) { // Note that setting this value greater than 2 will result in false // negatives. The current specification does not account for CSOT, which - // might allow for an "inifinite" number of retries over a period of time. + // might allow for an "infinite" number of retries over a period of time. // Because of this, we only track the "previous server". hostCount int failpointErrorCode int32 diff --git a/mongo/integration/unified/admin_helpers.go b/mongo/integration/unified/admin_helpers.go index f7bcb99146..29955aed82 100644 --- a/mongo/integration/unified/admin_helpers.go +++ b/mongo/integration/unified/admin_helpers.go @@ -25,7 +25,7 @@ var ( } ) -// terminateOpenSessions executes a killAllSessions command to ensure that sesssions left open on the server by a test +// terminateOpenSessions executes a killAllSessions command to ensure that sessions left open on the server by a test // do not cause future tests to hang. func terminateOpenSessions(ctx context.Context) error { if mtest.CompareServerVersions(mtest.ServerVersion(), "3.6") < 0 { diff --git a/mongo/integration/unified/bulkwrite_helpers.go b/mongo/integration/unified/bulkwrite_helpers.go index 895c57e990..5e5ade0f16 100644 --- a/mongo/integration/unified/bulkwrite_helpers.go +++ b/mongo/integration/unified/bulkwrite_helpers.go @@ -259,7 +259,7 @@ func createBulkWriteModel(rawModel bson.Raw) (mongo.WriteModel, error) { return rom.SetFilter(filter).SetReplacement(replacement), nil default: - return nil, fmt.Errorf("unrecongized request type: %v", requestType) + return nil, fmt.Errorf("unrecognized request type: %v", requestType) } } diff --git a/mongo/integration/unified/entity_test.go b/mongo/integration/unified/entity_test.go index 134e882e2f..3974e58400 100644 --- a/mongo/integration/unified/entity_test.go +++ b/mongo/integration/unified/entity_test.go @@ -73,7 +73,7 @@ func TestEntityMap(t *testing.T) { notFoundErr := newEntityNotFoundError("event list", "bar") assert.Equal(t, err, notFoundErr, "expected error %v, got %v", notFoundErr, err) }) - t.Run("interations entity", func(t *testing.T) { + t.Run("iterations entity", func(t *testing.T) { name := "iters" notFoundName := "bar" notFoundErr := newEntityNotFoundError("iterations", "bar") diff --git a/mongo/mongo_test.go b/mongo/mongo_test.go index fd3f1ce869..8055236a86 100644 --- a/mongo/mongo_test.go +++ b/mongo/mongo_test.go @@ -113,7 +113,7 @@ func TestEnsureID(t *testing.T) { } for _, tc := range testCases { - tc := tc // Capture range varible. + tc := tc // Capture range variable. t.Run(tc.description, func(t *testing.T) { t.Parallel() diff --git a/mongo/options/clientoptions.go b/mongo/options/clientoptions.go index fe9178cc49..6ce514d21c 100644 --- a/mongo/options/clientoptions.go +++ b/mongo/options/clientoptions.go @@ -317,7 +317,7 @@ func (c *ClientOptions) GetURI() string { // ApplyURI parses the given URI and sets options accordingly. The URI can contain host names, IPv4/IPv6 literals, or // an SRV record that will be resolved when the Client is created. When using an SRV record, TLS support is -// implictly enabled. Specify the "tls=false" URI option to override this. +// implicitly enabled. Specify the "tls=false" URI option to override this. // // If the connection string contains any options that have previously been set, it will overwrite them. Options that // correspond to multiple URI parameters, such as WriteConcern, will be completely overwritten if any of the query diff --git a/mongo/options/clientoptions_test.go b/mongo/options/clientoptions_test.go index 7c148ca0bd..4760e05bbb 100644 --- a/mongo/options/clientoptions_test.go +++ b/mongo/options/clientoptions_test.go @@ -623,7 +623,7 @@ func TestClientOptions(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { err := tc.opts.SetDirect(true).Validate() - assert.NotNil(t, err, "expected errror, got nil") + assert.NotNil(t, err, "expected error, got nil") assert.Equal(t, expectedErr.Error(), err.Error(), "expected error %v, got %v", expectedErr, err) }) } @@ -635,7 +635,7 @@ func TestClientOptions(t *testing.T) { opts.cs.Scheme = connstring.SchemeMongoDBSRV err := opts.SetDirect(true).Validate() - assert.NotNil(t, err, "expected errror, got nil") + assert.NotNil(t, err, "expected error, got nil") assert.Equal(t, expectedErr.Error(), err.Error(), "expected error %v, got %v", expectedErr, err) }) }) diff --git a/mongo/options/testdata/one-pk-multiple-certs.pem b/mongo/options/testdata/one-pk-multiple-certs.pem index 7845a6603d..449fc4d314 100644 --- a/mongo/options/testdata/one-pk-multiple-certs.pem +++ b/mongo/options/testdata/one-pk-multiple-certs.pem @@ -75,4 +75,4 @@ KDvyUILEI59TWaScYnQmQcb/v81gLIq1IjaINAkuZcCHAgu2ZWLOSofgnEATiLYH cXyy9WeRpd8nB3pgy1OjCN1E7+K6yHYYJYPQol25znAB5TLPbWwA8ek8fdmC3IpG HOQXMsoPKCdlgNzG1RXalFSIO1AU2nYO5zeVB1l+WbzEp+o/zq0bi/HcvBhNAtRm Lg== ------END CERTIFICATE----- \ No newline at end of file +-----END CERTIFICATE----- diff --git a/mongo/results.go b/mongo/results.go index 8408e8ba1b..2dbaf2af62 100644 --- a/mongo/results.go +++ b/mongo/results.go @@ -87,7 +87,7 @@ func newListDatabasesResultFromOperation(res operation.ListDatabasesResult) List type DatabaseSpecification struct { Name string // The name of the database. SizeOnDisk int64 // The total size of the database files on disk in bytes. - Empty bool // Specfies whether or not the database is empty. + Empty bool // Specifies whether or not the database is empty. } // UpdateResult is the result type returned from UpdateOne, UpdateMany, and ReplaceOne operations. diff --git a/testdata/auth/mongodb-aws.rst b/testdata/auth/mongodb-aws.rst index 1a256b5608..092db3f202 100644 --- a/testdata/auth/mongodb-aws.rst +++ b/testdata/auth/mongodb-aws.rst @@ -12,7 +12,7 @@ There are 5 scenarios drivers MUST test: For brevity, this section gives the values ````, ```` and ```` in place of a valid access key ID, secret access key and session token (also known as a security token). Note that if these values are passed into the URI they MUST be URL encoded. Sample values are below. -.. code-block:: +.. code-block:: AccessKeyId=AKIAI44QH8DHBEXAMPLE SecretAccessKey=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY @@ -25,7 +25,7 @@ Regular credentials Drivers MUST be able to authenticate by providing a valid access key id and secret access key pair as the username and password, respectively, in the MongoDB URI. An example of a valid URI would be: -.. code-block:: +.. code-block:: mongodb://:@localhost/?authMechanism=MONGODB-AWS | @@ -35,10 +35,10 @@ EC2 Credentials Drivers MUST be able to authenticate from an EC2 instance via temporary credentials assigned to the machine. A sample URI on an EC2 machine would be: .. code-block:: - + mongodb://localhost/?authMechanism=MONGODB-AWS | -.. note:: No username, password or session token is passed into the URI. Drivers MUST query the EC2 instance endpoint to obtain these credentials. +.. note:: No username, password or session token is passed into the URI. Drivers MUST query the EC2 instance endpoint to obtain these credentials. ECS instance ============ @@ -49,12 +49,12 @@ Drivers MUST be able to authenticate from an ECS container via temporary credent mongodb://localhost/?authMechanism=MONGODB-AWS | -.. note:: No username, password or session token is passed into the URI. Drivers MUST query the ECS container endpoint to obtain these credentials. +.. note:: No username, password or session token is passed into the URI. Drivers MUST query the ECS container endpoint to obtain these credentials. AssumeRole ========== -Drivers MUST be able to authenticate using temporary credentials returned from an assume role request. These temporary credentials consist of an access key ID, a secret access key, and a security token passed into the URI. A sample URI would be: +Drivers MUST be able to authenticate using temporary credentials returned from an assume role request. These temporary credentials consist of an access key ID, a secret access key, and a security token passed into the URI. A sample URI would be: .. code-block:: @@ -63,12 +63,12 @@ Drivers MUST be able to authenticate using temporary credentials returned from a AWS Lambda ========== -Drivers MUST be able to authenticate via an access key ID, secret access key and optional session token taken from the environment variables, respectively: +Drivers MUST be able to authenticate via an access key ID, secret access key and optional session token taken from the environment variables, respectively: .. code-block:: AWS_ACCESS_KEY_ID - AWS_SECRET_ACCESS_KEY + AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN | diff --git a/testdata/client-side-encryption/README.rst b/testdata/client-side-encryption/README.rst index 137d19b6df..5bbfa246af 100644 --- a/testdata/client-side-encryption/README.rst +++ b/testdata/client-side-encryption/README.rst @@ -1019,7 +1019,7 @@ KMS TLS Tests The following tests that connections to KMS servers with TLS verify peer certificates. The two tests below make use of mock KMS servers which can be run on Evergreen using `the mock KMS server script `_. -Drivers can set up their local Python enviroment for the mock KMS server by running `the virtualenv activation script `_. +Drivers can set up their local Python environment for the mock KMS server by running `the virtualenv activation script `_. To start a mock KMS server on port 8000 with `ca.pem`_ as a CA file and `expired.pem`_ as a cert file, run the following commands from the ``.evergreen/csfle`` directory. diff --git a/testdata/client-side-operations-timeout/README.rst b/testdata/client-side-operations-timeout/README.rst index b3130ef942..1ff923f2e5 100644 --- a/testdata/client-side-operations-timeout/README.rst +++ b/testdata/client-side-operations-timeout/README.rst @@ -371,7 +371,7 @@ This test only applies to drivers that provide an API to abort a GridFS upload s #. Create a new MongoClient (referred to as ``client``) with ``timeoutMS=10``. #. Using ``client``, create a GridFS bucket (referred to as ``bucket``) that wraps the ``db`` database with ``chunkSizeBytes=2``. -#. Call ``bucket.open_upload_stream()`` with the filename ``filename`` to create an upload stream (referred to as ``uploadStream``). +#. Call ``bucket.open_upload_stream()`` with the filename ``filename`` to create an upload stream (referred to as ``uploadStream``). - Expect this to succeed and return a non-null stream. diff --git a/testdata/connection-monitoring-and-pooling/README.rst b/testdata/connection-monitoring-and-pooling/README.rst index 4577255427..016e50507d 100644 --- a/testdata/connection-monitoring-and-pooling/README.rst +++ b/testdata/connection-monitoring-and-pooling/README.rst @@ -67,7 +67,7 @@ All Unit Tests have some of the following fields: - ``address``: The address of the pool emitting the event - ``connectionId``: The id of a connection associated with the event - ``options``: Options used to create the pool - - ``reason``: A reason giving mroe information on why the event was emitted + - ``reason``: A reason giving more information on why the event was emitted - ``ignore``: An array of event names to ignore @@ -143,7 +143,7 @@ The definition of MATCH or MATCHES in the Spec Test Runner is as follows: Pseudocode implementation of ``actual`` MATCHES ``expected``: :: - + If expected is "42" or 42: Assert that actual exists (is not null or undefined) Else: @@ -178,7 +178,7 @@ For each YAML file with ``style: unit``: - Assert that an actual error ``actualError`` was thrown by the main thread - Assert that ``actualError`` MATCHES ``error`` -- Else: +- Else: - Assert that no errors were thrown by the main thread diff --git a/testdata/connection-monitoring-and-pooling/connection-monitoring-and-pooling.rst b/testdata/connection-monitoring-and-pooling/connection-monitoring-and-pooling.rst index ab99013356..b81b862836 100644 --- a/testdata/connection-monitoring-and-pooling/connection-monitoring-and-pooling.rst +++ b/testdata/connection-monitoring-and-pooling/connection-monitoring-and-pooling.rst @@ -19,7 +19,7 @@ Abstract Drivers currently support a variety of options that allow users to configure connection pooling behavior. Users are confused by drivers supporting different subsets of these options. Additionally, drivers implement their connection pools differently, making it difficult to design cross-driver pool functionality. By unifying and codifying pooling options and behavior across all drivers, we will increase user comprehension and code base maintainability. -META +META ==== The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in `RFC 2119 `_. @@ -234,18 +234,18 @@ A driver-defined entity that encapsulates all non-monitoring connections associa * The Queue of threads waiting for a connection to be available */ waitQueue: WaitQueue; - + /** * A generation number representing the SDAM generation of the pool */ generation: number; - + /** * An integer expressing how many total connections * (active + in use) the pool currently has */ totalConnectionCount: number; - + /** * An integer expressing how many connections are currently * available in the pool. @@ -525,12 +525,12 @@ Events * Emitted when a Connection Pool creates a Connection object. * NOTE: This does not mean that the connection is ready for use. */ - interface ConnectionCreatedEvent { + interface ConnectionCreatedEvent { /** * The ServerAddress of the Endpoint the pool is attempting to connect to. */ address: string; - + /** * The ID of the Connection */ @@ -545,7 +545,7 @@ Events * The ServerAddress of the Endpoint the pool is attempting to connect to. */ address: string; - + /** * The ID of the Connection */ @@ -560,12 +560,12 @@ Events * The ServerAddress of the Endpoint the pool is attempting to connect to. */ address: string; - + /** * The ID of the Connection */ connectionId: number; - + /** * A reason explaining why this connection was closed. * Can be implemented as a string or enum. @@ -597,7 +597,7 @@ Events * The ServerAddress of the Endpoint the pool is attempting to connect to. */ address: string; - + /** * A reason explaining why connection check out failed. * Can be implemented as a string or enum. @@ -632,7 +632,7 @@ Events * The ServerAddress of the Endpoint the pool is attempting to connect to. */ address: string; - + /** * The ID of the Connection */ diff --git a/testdata/crud/README.rst b/testdata/crud/README.rst index 2cf319b643..6fd4626c06 100644 --- a/testdata/crud/README.rst +++ b/testdata/crud/README.rst @@ -89,7 +89,7 @@ For each test file: - Using ``globalMongoClient``, check that the current server version satisfies one of the configurations provided in the top-level ``runOn`` field in the test file (if applicable). If the - requirements are not satisifed, the test file should be skipped. + requirements are not satisfied, the test file should be skipped. - Determine the collection and database under test, utilizing the top-level ``collection_name`` and/or ``database_name`` fields if present. diff --git a/testdata/kmip-certs/README.md b/testdata/kmip-certs/README.md index 719eb1f968..383c0228d4 100644 --- a/testdata/kmip-certs/README.md +++ b/testdata/kmip-certs/README.md @@ -1,4 +1,3 @@ These Elliptic Curve (EC) certificates were generated by running `etc/gen-ec-certs/gen-ec-certs.sh`. The EC certificates are used for testing the Go driver with PyKMIP. PyKMIP does not support Golang's default TLS cipher suites with RSA. - diff --git a/testdata/mongocrypt/kms-reply.txt b/testdata/mongocrypt/kms-reply.txt index c2c52e3841..ebbedccc71 100644 --- a/testdata/mongocrypt/kms-reply.txt +++ b/testdata/mongocrypt/kms-reply.txt @@ -3,4 +3,4 @@ x-amzn-RequestId: deeb35e5-4ecb-4bf1-9af5-84a54ff0af0e Content-Type: application/x-amz-json-1.1 Content-Length: 233 -{"KeyId": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", "Plaintext": "TqhXy3tKckECjy4/ZNykMWG8amBF46isVPzeOgeusKrwheBmYaU8TMG5AHR/NeUDKukqo8hBGgogiQOVpLPkqBQHD8YkLsNbDmHoGOill5QAHnniF/Lz405bGucB5TfR"} \ No newline at end of file +{"KeyId": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", "Plaintext": "TqhXy3tKckECjy4/ZNykMWG8amBF46isVPzeOgeusKrwheBmYaU8TMG5AHR/NeUDKukqo8hBGgogiQOVpLPkqBQHD8YkLsNbDmHoGOill5QAHnniF/Lz405bGucB5TfR"} diff --git a/testdata/read-write-concern/README.rst b/testdata/read-write-concern/README.rst index 5995590136..df94273510 100644 --- a/testdata/read-write-concern/README.rst +++ b/testdata/read-write-concern/README.rst @@ -3,7 +3,7 @@ Connection String Tests ======================= The YAML and JSON files in this directory tree are platform-independent tests -that drivers can use to prove their conformance to the Read and Write Concern +that drivers can use to prove their conformance to the Read and Write Concern specification. Version @@ -37,7 +37,7 @@ for drivers that might substitute default values *during* parsing. Document ~~~~~~~~ -These tests are designed to ensure compliance with the spec in relation to what should be +These tests are designed to ensure compliance with the spec in relation to what should be sent to the server. Each YAML file contains an object with a single ``tests`` key. This key is an diff --git a/testdata/retryable-reads/README.rst b/testdata/retryable-reads/README.rst index f57adb7d77..0c3a3fee1a 100644 --- a/testdata/retryable-reads/README.rst +++ b/testdata/retryable-reads/README.rst @@ -93,7 +93,7 @@ Each YAML file has the following keys: - ``database_name`` and ``collection_name``: Optional. The database and collection to use for testing. - + - ``bucket_name``: Optional. The GridFS bucket name to use for testing. - ``data``: The data that should exist in the collection(s) under test before @@ -101,19 +101,19 @@ Each YAML file has the following keys: into the collection under test (i.e. ``collection_name``); however, this field may also be an object mapping collection names to arrays of documents to be inserted into the specified collection. - + - ``tests``: An array of tests that are to be run independently of each other. Each test will have some or all of the following fields: - ``description``: The name of the test. - + - ``clientOptions``: Optional, parameters to pass to MongoClient(). - ``useMultipleMongoses`` (optional): If ``true``, the MongoClient for this test should be initialized with multiple mongos seed addresses. If ``false`` or omitted, only a single mongos address should be specified. This field has no effect for non-sharded topologies. - + - ``skipReason``: Optional, string describing why this test should be skipped. - ``failPoint``: Optional, a server fail point to enable, expressed as the @@ -132,10 +132,10 @@ Each YAML file has the following keys: - ``result``: Optional. The return value from the operation, if any. This field may be a scalar (e.g. in the case of a count), a single document, or an array of documents in the case of a multi-document read. - + - ``error``: Optional. If ``true``, the test should expect an error or exception. - + - ``expectations``: Optional list of command-started events. GridFS Tests @@ -159,7 +159,7 @@ data. .. _GridFSBucket spec: https://github.com/mongodb/specifications/blob/master/source/gridfs/gridfs-spec.rst#configurable-gridfsbucket-class - + Speeding Up Tests ----------------- diff --git a/testdata/retryable-writes/README.rst b/testdata/retryable-writes/README.rst index 2f431ba39d..d681fff285 100644 --- a/testdata/retryable-writes/README.rst +++ b/testdata/retryable-writes/README.rst @@ -317,7 +317,7 @@ and sharded clusters. retryWrites=false to your connection string. and the error code is 20. - + **Note**: Drivers that rely on ``serverStatus`` to determine the storage engine in use MAY skip this test for sharded clusters, since ``mongos`` does not report this information in its ``serverStatus`` response. diff --git a/testdata/server-selection/logging/load-balanced.json b/testdata/server-selection/logging/load-balanced.json old mode 100755 new mode 100644 diff --git a/testdata/server-selection/logging/load-balanced.yml b/testdata/server-selection/logging/load-balanced.yml old mode 100755 new mode 100644 diff --git a/testdata/server-selection/logging/operation-id.json b/testdata/server-selection/logging/operation-id.json old mode 100755 new mode 100644 diff --git a/testdata/transactions/README.rst b/testdata/transactions/README.rst index a1b27dcf01..496a6b2ef8 100644 --- a/testdata/transactions/README.rst +++ b/testdata/transactions/README.rst @@ -255,7 +255,7 @@ Then for each element in ``tests``: - When testing against a sharded cluster and ``useMultipleMongoses`` is ``true`` the client MUST be created with multiple (valid) mongos seed - addreses. + addresses. #. Call ``client.startSession`` twice to create ClientSession objects ``session0`` and ``session1``, using the test's "sessionOptions" if they diff --git a/x/README.md b/x/README.md index ceeabf893d..6d8800a014 100644 --- a/x/README.md +++ b/x/README.md @@ -1,5 +1,5 @@ -MongoDB Go Driver Unstable Libraries -==================================== +# MongoDB Go Driver Unstable Libraries + This directory contains unstable MongoDB Go driver libraries and packages. The APIs of these packages are not stable and there is no backward compatibility guarantee. diff --git a/x/bsonx/bsoncore/bsoncore.go b/x/bsonx/bsoncore/bsoncore.go index e52674aacf..88133293ea 100644 --- a/x/bsonx/bsoncore/bsoncore.go +++ b/x/bsonx/bsoncore/bsoncore.go @@ -235,7 +235,7 @@ func BuildDocumentValue(elems ...[]byte) Value { return Value{Type: bsontype.EmbeddedDocument, Data: BuildDocument(nil, elems...)} } -// BuildDocumentElement will append a BSON embedded document elemnt using key and the provided +// BuildDocumentElement will append a BSON embedded document element using key and the provided // elements and return the extended buffer. func BuildDocumentElement(dst []byte, key string, elems ...[]byte) []byte { return BuildDocument(AppendHeader(dst, bsontype.EmbeddedDocument, key), elems...) diff --git a/x/mongo/driver/DESIGN.md b/x/mongo/driver/DESIGN.md index 2fde89f81f..3c3e6c56cd 100644 --- a/x/mongo/driver/DESIGN.md +++ b/x/mongo/driver/DESIGN.md @@ -1,12 +1,15 @@ # Driver Library Design + This document outlines the design for this package. ## Deployment, Server, and Connection + Acquiring a `Connection` from a `Server` selected from a `Deployment` enables sending and receiving wire messages. A `Deployment` represents an set of MongoDB servers and a `Server` represents a member of that set. These three types form the operation execution stack. ### Compression + Compression is handled by Connection type while uncompression is handled automatically by the Operation type. This is done because the compressor to use for compressing a wire message is chosen by the connection during handshake, while uncompression can be performed without this @@ -14,6 +17,7 @@ information. This does make the design of compression non-symmetric, but it make to implement and more consistent. ## Operation + The `Operation` type handles executing a series of commands using a `Deployment`. For most uses `Operation` will only execute a single command, but the main use case for a series of commands is batch split write commands, such as insert. The type itself is heavily documented, so reading the diff --git a/x/mongo/driver/auth/internal/gssapi/gss_wrapper.c b/x/mongo/driver/auth/internal/gssapi/gss_wrapper.c index ec49d96125..68b7254149 100644 --- a/x/mongo/driver/auth/internal/gssapi/gss_wrapper.c +++ b/x/mongo/driver/auth/internal/gssapi/gss_wrapper.c @@ -12,9 +12,9 @@ #include "gss_wrapper.h" OM_uint32 gssapi_canonicalize_name( - OM_uint32* minor_status, - char *input_name, - gss_OID input_name_type, + OM_uint32* minor_status, + char *input_name, + gss_OID input_name_type, gss_name_t *output_name ) { @@ -39,8 +39,8 @@ OM_uint32 gssapi_canonicalize_name( } int gssapi_error_desc( - OM_uint32 maj_stat, - OM_uint32 min_stat, + OM_uint32 maj_stat, + OM_uint32 min_stat, char **desc ) { @@ -207,7 +207,7 @@ int gssapi_client_wrap_msg( void* input, size_t input_length, void** output, - size_t* output_length + size_t* output_length ) { gss_buffer_desc input_buffer = GSS_C_EMPTY_BUFFER; diff --git a/x/mongo/driver/auth/internal/gssapi/gss_wrapper.h b/x/mongo/driver/auth/internal/gssapi/gss_wrapper.h index 1cb9cd3c18..a105ba58b7 100644 --- a/x/mongo/driver/auth/internal/gssapi/gss_wrapper.h +++ b/x/mongo/driver/auth/internal/gssapi/gss_wrapper.h @@ -32,8 +32,8 @@ typedef struct { } gssapi_client_state; int gssapi_error_desc( - OM_uint32 maj_stat, - OM_uint32 min_stat, + OM_uint32 maj_stat, + OM_uint32 min_stat, char **desc ); @@ -62,11 +62,11 @@ int gssapi_client_wrap_msg( void* input, size_t input_length, void** output, - size_t* output_length + size_t* output_length ); int gssapi_client_destroy( gssapi_client_state *client ); -#endif \ No newline at end of file +#endif diff --git a/x/mongo/driver/auth/internal/gssapi/sspi.go b/x/mongo/driver/auth/internal/gssapi/sspi.go index 36e9633f8f..6e7d3ed8ad 100644 --- a/x/mongo/driver/auth/internal/gssapi/sspi.go +++ b/x/mongo/driver/auth/internal/gssapi/sspi.go @@ -112,7 +112,7 @@ func (sc *SaslClient) Start() (string, []byte, error) { status := C.sspi_client_init(&sc.state, cusername, cpassword) if status != C.SSPI_OK { - return mechName, nil, sc.getError("unable to intitialize client") + return mechName, nil, sc.getError("unable to initialize client") } payload, err := sc.Next(nil) diff --git a/x/mongo/driver/auth/internal/gssapi/sspi_wrapper.c b/x/mongo/driver/auth/internal/gssapi/sspi_wrapper.c index f655654713..bc73723e83 100644 --- a/x/mongo/driver/auth/internal/gssapi/sspi_wrapper.c +++ b/x/mongo/driver/auth/internal/gssapi/sspi_wrapper.c @@ -69,7 +69,7 @@ int sspi_client_init( if (username) { if (password) { SEC_WINNT_AUTH_IDENTITY auth_identity; - + #ifdef _UNICODE auth_identity.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE; #else @@ -186,7 +186,7 @@ int sspi_client_wrap_msg( PVOID input, ULONG input_length, PVOID* output, - ULONG* output_length + ULONG* output_length ) { SecPkgContext_Sizes sizes; @@ -246,4 +246,4 @@ int sspi_client_destroy( sspi_functions->FreeCredentialsHandle(&client->cred); return SSPI_OK; -} \ No newline at end of file +} diff --git a/x/mongo/driver/auth/internal/gssapi/sspi_wrapper.h b/x/mongo/driver/auth/internal/gssapi/sspi_wrapper.h index 2d08e939e5..e59e55c696 100644 --- a/x/mongo/driver/auth/internal/gssapi/sspi_wrapper.h +++ b/x/mongo/driver/auth/internal/gssapi/sspi_wrapper.h @@ -54,11 +54,11 @@ int sspi_client_wrap_msg( PVOID input, ULONG input_length, PVOID* output, - ULONG* output_length + ULONG* output_length ); int sspi_client_destroy( sspi_client_state *client ); -#endif \ No newline at end of file +#endif diff --git a/x/mongo/driver/batches.go b/x/mongo/driver/batches.go index 3e7dca9ac1..be430afa15 100644 --- a/x/mongo/driver/batches.go +++ b/x/mongo/driver/batches.go @@ -17,7 +17,7 @@ import ( var ErrDocumentTooLarge = errors.New("an inserted document is too large") // Batches contains the necessary information to batch split an operation. This is only used for write -// oeprations. +// operations. type Batches struct { Identifier string Documents []bsoncore.Document diff --git a/x/mongo/driver/errors.go b/x/mongo/driver/errors.go index 177aa1234b..3b8b9823b7 100644 --- a/x/mongo/driver/errors.go +++ b/x/mongo/driver/errors.go @@ -40,7 +40,7 @@ var ( TransientTransactionError = "TransientTransactionError" // NetworkError is an error label for network errors. NetworkError = "NetworkError" - // RetryableWriteError is an error lable for retryable write errors. + // RetryableWriteError is an error label for retryable write errors. RetryableWriteError = "RetryableWriteError" // NoWritesPerformed is an error label indicated that no writes were performed for an operation. NoWritesPerformed = "NoWritesPerformed" diff --git a/x/mongo/driver/ocsp/ocsp.go b/x/mongo/driver/ocsp/ocsp.go index 0e7dbfe2d5..849530fde9 100644 --- a/x/mongo/driver/ocsp/ocsp.go +++ b/x/mongo/driver/ocsp/ocsp.go @@ -149,7 +149,7 @@ func processStaple(cfg config, staple []byte) (*ResponseDetails, error) { // If the server has a Must-Staple certificate and the server does not present a stapled OCSP response, error. if mustStaple && len(staple) == 0 { return nil, errors.New("server provided a certificate with the Must-Staple extension but did not " + - "provde a stapled OCSP response") + "provide a stapled OCSP response") } if len(staple) == 0 { diff --git a/x/mongo/driver/operation.go b/x/mongo/driver/operation.go index 6b56191a01..905c9cfc55 100644 --- a/x/mongo/driver/operation.go +++ b/x/mongo/driver/operation.go @@ -846,7 +846,7 @@ func (op Operation) Execute(ctx context.Context) error { // If the error is no longer retryable and has the NoWritesPerformed label, then we should // set the error to the "previous indefinite error" unless the current error is already the - // "previous indefinite error". After reseting, repeat the error check. + // "previous indefinite error". After resetting, repeat the error check. if tt.HasErrorLabel(NoWritesPerformed) && !prevIndefiniteErrIsSet { err = prevIndefiniteErr prevIndefiniteErrIsSet = true @@ -943,7 +943,7 @@ func (op Operation) Execute(ctx context.Context) error { // If the error is no longer retryable and has the NoWritesPerformed label, then we should // set the error to the "previous indefinite error" unless the current error is already the - // "previous indefinite error". After reseting, repeat the error check. + // "previous indefinite error". After resetting, repeat the error check. if tt.HasErrorLabel(NoWritesPerformed) && !prevIndefiniteErrIsSet { err = prevIndefiniteErr prevIndefiniteErrIsSet = true @@ -1873,7 +1873,7 @@ func (op Operation) decodeResult(opcode wiremessage.OpCode, wm []byte) (bsoncore return nil, errors.New("malformed wire message: insufficient bytes to read document sequence") } default: - return nil, fmt.Errorf("malformed wire message: uknown section type %v", stype) + return nil, fmt.Errorf("malformed wire message: unknown section type %v", stype) } } diff --git a/x/mongo/driver/operation/hello.go b/x/mongo/driver/operation/hello.go index de7e05cb5f..35e1b29efd 100644 --- a/x/mongo/driver/operation/hello.go +++ b/x/mongo/driver/operation/hello.go @@ -484,7 +484,7 @@ retry: } if len(dst) > maxLen { - // Implementors SHOULD cumulatively update fields in the + // Implementers SHOULD cumulatively update fields in the // following order until the document is under the size limit // // 1. Omit fields from ``env`` except ``env.name`` diff --git a/x/mongo/driver/topology/DESIGN.md b/x/mongo/driver/topology/DESIGN.md index 6594a85d08..8a67dd9935 100644 --- a/x/mongo/driver/topology/DESIGN.md +++ b/x/mongo/driver/topology/DESIGN.md @@ -1,7 +1,9 @@ # Topology Package Design + This document outlines the design for this package. ## Topology + The `Topology` type handles monitoring the state of a MongoDB deployment and selecting servers. Updating the description is handled by finite state machine which implements the server discovery and monitoring specification. A `Topology` can be connected and fully disconnected, which enables @@ -9,9 +11,11 @@ saving resources. The `Topology` type also handles server selection following th specification. ## Server + The `Server` type handles heartbeating a MongoDB server and holds a pool of connections. ## Connection + Connections are handled by two main types and an auxiliary type. The two main types are `connection` and `Connection`. The first holds most of the logic required to actually read and write wire messages. Instances can be created with the `newConnection` method. Inside the `newConnection` @@ -26,6 +30,7 @@ The connection implementations in this package are conduits for wire messages bu ability to encode, decode, or validate wire messages. That must be handled by consumers. ## Pool + The `pool` type implements a connection pool. It handles caching idle connections and dialing new ones, but it does not track a maximum number of connections. That is the responsibility of a wrapping type, like `Server`. @@ -37,4 +42,4 @@ There is a `close` method, but this is used to close a connection. There are three methods related to getting and putting connections: `get`, `close`, and `put`. The `get` method will either retrieve a connection from the cache or it will dial a new `connection`. The `close` method will close the underlying socket of a `connection`. The `put` method will put a -connection into the pool, placing it in the cahce if there is space, otherwise it will close it. +connection into the pool, placing it in the cache if there is space, otherwise it will close it. diff --git a/x/mongo/driver/topology/cmap_prose_test.go b/x/mongo/driver/topology/cmap_prose_test.go index 53c6e9ba36..9c83b7a9c5 100644 --- a/x/mongo/driver/topology/cmap_prose_test.go +++ b/x/mongo/driver/topology/cmap_prose_test.go @@ -241,7 +241,7 @@ func TestCMAPProse(t *testing.T) { conns = conns[2:] assertConnectionCounts(t, pool, numConns, 0) - // Close and assert that events are published for all conections. + // Close and assert that events are published for all connections. pool.close(context.Background()) assertConnectionCounts(t, pool, numConns, numConns) diff --git a/x/mongo/driver/topology/connection_test.go b/x/mongo/driver/topology/connection_test.go index ab2496b1ac..42c50e65ab 100644 --- a/x/mongo/driver/topology/connection_test.go +++ b/x/mongo/driver/topology/connection_test.go @@ -146,7 +146,7 @@ func TestConnection(t *testing.T) { _ = conn.connect(context.Background()) }() - // Simulate cancelling connection establishment and assert that this cleares the CancelFunc. + // Simulate cancelling connection establishment and assert that this clears the CancelFunc. conn.closeConnectContext() assert.Nil(t, conn.cancelConnectContext, "cancellation function was not cleared") close(doneChan) diff --git a/x/mongo/driver/topology/fsm.go b/x/mongo/driver/topology/fsm.go index 1494ae7807..2acf527b9d 100644 --- a/x/mongo/driver/topology/fsm.go +++ b/x/mongo/driver/topology/fsm.go @@ -48,7 +48,7 @@ func newFSM() *fsm { // where a "nil" value is considered less than 0. // // Otherwise, if the FSM's logicalSessionTimeoutMinutes exist, then this -// function returns the FSM timout. +// function returns the FSM timeout. // // In the case where the FSM timeout DNE, we check all servers to see if any // still do not have a timeout. This function chooses the lowest of the existing @@ -283,7 +283,7 @@ func hasStalePrimary(fsm fsm, srv description.Server) bool { compRes := bytes.Compare(srv.ElectionID[:], fsm.maxElectionID[:]) if wireVersion := srv.WireVersion; wireVersion != nil && wireVersion.Max >= 17 { - // In the Post-6.0 case, a primary is considered "stale" if the server's election ID is greather than the + // In the Post-6.0 case, a primary is considered "stale" if the server's election ID is greater than the // topology's max election ID. In these versions, the primary is also considered "stale" if the server's // election ID is LTE to the topologies election ID and the server's "setVersion" is less than the topology's // max "setVersion". diff --git a/x/mongo/driver/topology/pool_test.go b/x/mongo/driver/topology/pool_test.go index 8a7603dcc4..013403981d 100644 --- a/x/mongo/driver/topology/pool_test.go +++ b/x/mongo/driver/topology/pool_test.go @@ -751,7 +751,7 @@ func TestPool(t *testing.T) { err.(WaitQueueTimeoutError).Wrapped, "expected wrapped error to be a context.DeadlineExceeded") - // Start a goroutine that closes one of the checked-out conections and checks it in. + // Start a goroutine that closes one of the checked-out connections and checks it in. // Expect that the checked-in connection is closed and allows blocked checkOut() to // complete. Assert that the time between checking in the closed connection and when the // checkOut() completes is within 100ms. diff --git a/x/mongo/driver/topology/sdam_spec_test.go b/x/mongo/driver/topology/sdam_spec_test.go index 3548d69b3e..e09ffb87f0 100644 --- a/x/mongo/driver/topology/sdam_spec_test.go +++ b/x/mongo/driver/topology/sdam_spec_test.go @@ -486,11 +486,11 @@ func runTest(t *testing.T, directory string, filename string) { publishedEvents = nil if phase.Outcome.Compatible == nil || *phase.Outcome.Compatible { assert.True(t, topo.fsm.compatible.Load().(bool), "Expected servers to be compatible") - assert.Nil(t, topo.fsm.compatibilityErr, "expected fsm.compatiblity to be nil, got %v", + assert.Nil(t, topo.fsm.compatibilityErr, "expected fsm.compatibility to be nil, got %v", topo.fsm.compatibilityErr) } else { assert.False(t, topo.fsm.compatible.Load().(bool), "Expected servers to not be compatible") - assert.NotNil(t, topo.fsm.compatibilityErr, "expected fsm.compatiblity error to be non-nil") + assert.NotNil(t, topo.fsm.compatibilityErr, "expected fsm.compatibility error to be non-nil") continue } desc := topo.Description() diff --git a/x/mongo/driver/topology/server.go b/x/mongo/driver/topology/server.go index 4a59643282..9ff6e533c4 100644 --- a/x/mongo/driver/topology/server.go +++ b/x/mongo/driver/topology/server.go @@ -429,7 +429,7 @@ func (s *Server) ProcessError(err error, conn driver.Connection) driver.ProcessE } // Ignore errors from stale connections because the error came from a previous generation of the - // connection pool. The root cause of the error has aleady been handled, which is what caused + // connection pool. The root cause of the error has already been handled, which is what caused // the pool generation to increment. Processing errors for stale connections could result in // handling the same error root cause multiple times (e.g. a temporary network interrupt causing // all connections to the same server to return errors). diff --git a/x/mongo/driver/topology/topology.go b/x/mongo/driver/topology/topology.go index b79efed4ed..bbffbd1da7 100644 --- a/x/mongo/driver/topology/topology.go +++ b/x/mongo/driver/topology/topology.go @@ -98,7 +98,7 @@ type Topology struct { subscriptionsClosed bool subLock sync.Mutex - // We should redesign how we Connect and handle individal servers. This is + // We should redesign how we Connect and handle individual servers. This is // too difficult to maintain and it's rather easy to accidentally access // the servers without acquiring the lock or checking if the servers are // closed. This lock should also be an RWMutex. diff --git a/x/mongo/driver/topology/topology_options.go b/x/mongo/driver/topology/topology_options.go index 8deb614815..ec30487187 100644 --- a/x/mongo/driver/topology/topology_options.go +++ b/x/mongo/driver/topology/topology_options.go @@ -72,7 +72,7 @@ func newLogger(opts *options.LoggerOptions) (*logger.Logger, error) { } // NewConfig will translate data from client options into a topology config for building non-default deployments. -// Server and topoplogy options are not honored if a custom deployment is used. +// Server and topology options are not honored if a custom deployment is used. func NewConfig(co *options.ClientOptions, clock *session.ClusterClock) (*Config, error) { var serverAPI *driver.ServerAPIOptions