Skip to content

Commit

Permalink
Revert "Release/1.11 (#1146)"
Browse files Browse the repository at this point in the history
This reverts commit bf833d5.
  • Loading branch information
prestonvasquez committed Dec 8, 2022
1 parent bf833d5 commit fc7ebbb
Show file tree
Hide file tree
Showing 65 changed files with 61 additions and 583 deletions.
1 change: 0 additions & 1 deletion .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,6 @@ tasks:
- name: sa-fmt
tags: ["static-analysis"]
commands:
- func: install-linters
- func: run-make
vars:
targets: check-fmt
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ build-tests:

.PHONY: check-fmt
check-fmt:
etc/check_fmt.sh
etc/check_fmt.sh $(PKGS)

# check-modules runs "go mod tidy" then "go mod vendor" and exits with a non-zero exit code if there
# are any module or vendored modules changes. The intent is to confirm two properties:
Expand All @@ -69,7 +69,7 @@ doc:

.PHONY: fmt
fmt:
go fmt ./...
gofmt -l -s -w $(PKGS)

.PHONY: lint
lint:
Expand Down
10 changes: 5 additions & 5 deletions etc/check_fmt.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env bash
# check_fmt
# Runs go fmt on all packages in the repo and checks that *_example_test.go files have wrapped lines.
# check_fmt gopackages...
# Runs gofmt on given packages and checks that *_example_test.go files have wrapped lines.

gofmt_out="$(go fmt ./...)"
gofmt_out="$(gofmt -l -s "$@")"

if [[ $gofmt_out ]]; then
echo "go fmt check failed for:";
echo "gofmt check failed for:";
sed -e 's/^/ - /' <<< "$gofmt_out";
exit 1;
fi
Expand All @@ -16,7 +16,7 @@ fi
# E.g ignored lines:
# // "mongodb://ldap-user:ldap-pwd@localhost:27017/?authMechanism=PLAIN"
# // (https://www.mongodb.com/docs/manual/core/authentication-mechanisms-enterprise/#security-auth-ldap).
lll_out="$(find . -type f -name "*_examples_test.go" | lll -w 4 -l 80 -e '^\s*\/\/.+:\/\/' --files)"
lll_out="$(find "$@" -type f -name "*_examples_test.go" | lll -w 4 -l 80 -e '^\s*\/\/.+:\/\/' --files)"

if [[ $lll_out ]]; then
echo "lll check failed for:";
Expand Down
5 changes: 2 additions & 3 deletions mongo/crud_examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -749,9 +749,8 @@ func ExampleClient_StartSession_withTransaction() {
result, err := sess.WithTransaction(
context.TODO(),
func(sessCtx mongo.SessionContext) (interface{}, error) {
// Use the mongo.SessionContext as the Context parameter for
// InsertOne and FindOne so both operations are run in the same
// transaction.
// Use sessCtx as the Context parameter for InsertOne and FindOne so
// both operations are run in a transaction.

coll := client.Database("db").Collection("coll")
res, err := coll.InsertOne(sessCtx, bson.D{{"x", 1}})
Expand Down
40 changes: 0 additions & 40 deletions mongo/integration/initial_dns_seedlist_discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@ import (
"runtime"
"strings"
"testing"
"time"

"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/internal/testutil/assert"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/description"
"go.mongodb.org/mongo-driver/mongo/integration/mtest"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/mongo/readpref"
"go.mongodb.org/mongo-driver/x/mongo/driver/connstring"
"go.mongodb.org/mongo-driver/x/mongo/driver/topology"
)
Expand All @@ -40,26 +37,19 @@ type seedlistTest struct {
NumHosts *int `bson:"numHosts"`
Error bool `bson:"error"`
Options bson.Raw `bson:"options"`
Ping *bool `bson:"ping"`
}

func TestInitialDNSSeedlistDiscoverySpec(t *testing.T) {
mt := mtest.New(t, noClientOpts)
defer mt.Close()

mt.RunOpts("replica set", mtest.NewOptions().Topologies(mtest.ReplicaSet).CreateClient(false), func(mt *mtest.T) {
mt.Parallel()

runSeedlistDiscoveryDirectory(mt, "replica-set")
})
mt.RunOpts("sharded", mtest.NewOptions().Topologies(mtest.Sharded).CreateClient(false), func(mt *mtest.T) {
mt.Parallel()

runSeedlistDiscoveryDirectory(mt, "sharded")
})
mt.RunOpts("load balanced", mtest.NewOptions().Topologies(mtest.LoadBalanced).CreateClient(false), func(mt *mtest.T) {
mt.Parallel()

runSeedlistDiscoveryDirectory(mt, "load-balanced")
})
}
Expand All @@ -73,24 +63,6 @@ func runSeedlistDiscoveryDirectory(mt *mtest.T, subdirectory string) {
}
}

// runSeedlistDiscoveryPingTest will create a new connection using the test URI and attempt to "ping" the server.
func runSeedlistDiscoveryPingTest(mt *mtest.T, clientOpts *options.ClientOptions) {
ctx := context.Background()

client, err := mongo.Connect(ctx, clientOpts)
assert.Nil(mt, err, "Connect error: %v", err)

defer func() { _ = client.Disconnect(ctx) }()

// Create a context with a timeout to prevent the ping operation from blocking indefinitely.
pingCtx, cancel := context.WithTimeout(ctx, 1*time.Second)
defer cancel()

// Ping the server.
err = client.Ping(pingCtx, readpref.Nearest())
assert.Nil(mt, err, "Ping error: %v", err)
}

func runSeedlistDiscoveryTest(mt *mtest.T, file string) {
content, err := ioutil.ReadFile(file)
assert.Nil(mt, err, "ReadFile error for %v: %v", file, err)
Expand Down Expand Up @@ -159,10 +131,6 @@ func runSeedlistDiscoveryTest(mt *mtest.T, file string) {
_, err := getServerByAddress(host, topo)
assert.Nil(mt, err, "error finding host %q: %v", host, err)
}

if ping := test.Ping; ping == nil || *ping {
runSeedlistDiscoveryPingTest(mt, opts)
}
}

func buildSet(list []string) map[string]struct{} {
Expand Down Expand Up @@ -262,14 +230,6 @@ func getServerByAddress(address string, topo *topology.Topology) (description.Se
if err != nil {
return description.Server{}, err
}

// If the selected server is a topology.SelectedServer, then we can get the description without creating a
// connect pool.
topologySelectedServer, ok := selectedServer.(*topology.SelectedServer)
if ok {
return topologySelectedServer.Description().Server, nil
}

selectedServerConnection, err := selectedServer.Connection(context.Background())
if err != nil {
return description.Server{}, err
Expand Down
2 changes: 1 addition & 1 deletion mongo/integration/retryable_writes_prose_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ func TestRetryableWritesProse(t *testing.T) {

require.True(mt, secondFailPointConfigured)

// Assert that the "ShutdownInProgress" error is returned.
// Assert that the "NotWritablePrimary" error is returned.
require.True(mt, err.(mongo.WriteException).HasErrorCode(int(shutdownInProgressErrorCode)))
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@
"loadBalanced": true,
"ssl": true,
"directConnection": false
},
"ping": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ options:
loadBalanced: true
ssl: true
directConnection: false
ping: true
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
"options": {
"loadBalanced": true,
"ssl": true
},
"ping": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ hosts:
options:
loadBalanced: true
ssl: true
ping: true
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@
"loadBalanced": true,
"srvMaxHosts": 0,
"ssl": true
},
"ping": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ options:
loadBalanced: true
srvMaxHosts: 0
ssl: true
ping: true
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@
"loadBalanced": true,
"srvMaxHosts": 0,
"ssl": true
},
"ping": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ options:
loadBalanced: true
srvMaxHosts: 0
ssl: true
ping: true
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
"options": {
"ssl": true,
"directConnection": false
},
"ping": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ hosts:
options:
ssl: true
directConnection: false
ping: true

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
"options": {
"loadBalanced": false,
"ssl": true
},
"ping": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ hosts:
options:
loadBalanced: false
ssl: true
ping: true
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@
"replicaSet": "repl0",
"ssl": true
},
"ping": true,
"comment": "Is correct, as returned host name shared the URI root \"test.build.10gen.cc\"."
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ hosts:
options:
replicaSet: repl0
ssl: true
ping: true
comment: Is correct, as returned host name shared the URI root "test.build.10gen.cc".
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
"options": {
"replicaSet": "repl0",
"ssl": true
},
"ping": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ hosts:
options:
replicaSet: repl0
ssl: true
ping: true
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
"options": {
"replicaSet": "repl0",
"ssl": true
},
"ping": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ hosts:
options:
replicaSet: repl0
ssl: true
ping: true
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@
"replicaSet": "repl0",
"authSource": "thisDB",
"ssl": true
},
"ping": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ options:
replicaSet: repl0
authSource: thisDB
ssl: true
ping: true
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@
"options": {
"ssl": true,
"srvServiceName": "customname"
},
"ping": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ hosts:
options:
ssl: true
srvServiceName: "customname"
ping: true
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@
"options": {
"srvMaxHosts": 2,
"ssl": true
},
"ping": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ hosts:
options:
srvMaxHosts: 2
ssl: true
ping: true
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@
"options": {
"srvMaxHosts": 3,
"ssl": true
},
"ping": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ hosts:
options:
srvMaxHosts: 3
ssl: true
ping: true
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
"options": {
"srvMaxHosts": 1,
"ssl": true
},
"ping": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ hosts:
options:
srvMaxHosts: 1
ssl: true
ping: true
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@
"replicaSet": "repl0",
"srvMaxHosts": 0,
"ssl": true
},
"ping": true
}
}
Loading

0 comments on commit fc7ebbb

Please sign in to comment.