Skip to content

Commit

Permalink
TOOLS-2287: URI parser incorrectly prints unsupported parameter warn…
Browse files Browse the repository at this point in the history
…ings (#261)

Compatibility with breaking change in mongo-tools-common/#40 - revendor MTC and remove calls to URI.AddKnownURIParameters
  • Loading branch information
hariamoor-zz committed Jul 8, 2020
1 parent 9548711 commit 9c63fb7
Show file tree
Hide file tree
Showing 10 changed files with 6 additions and 15 deletions.
6 changes: 3 additions & 3 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ required = ["github.com/3rf/mongo-lint"]

[[constraint]]
name = "github.com/mongodb/mongo-tools-common"
version = "v3.0.9"
version = "v3.0.13"

[[constraint]]
name = "github.com/nsf/termbox-go"
Expand Down
1 change: 0 additions & 1 deletion mongodump/mongodump_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ func simpleMongoDumpInstance() *MongoDump {
if uri := os.Getenv("MONGOD"); uri != "" {
fakeArgs := []string{"--uri=" + uri}
toolOptions = options.New("mongodump", "", "", "", true, options.EnabledOptions{URI: true})
toolOptions.URI.AddKnownURIParameters(options.KnownURIOptionsReadPreference)
_, err := toolOptions.ParseArgs(fakeArgs)
if err != nil {
panic("Could not parse MONGOD environment variable")
Expand Down
1 change: 0 additions & 1 deletion mongodump/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ func ParseOptions(rawArgs []string, versionStr, gitCommit string) (Options, erro
opts.AddOptions(inputOpts)
outputOpts := &OutputOptions{}
opts.AddOptions(outputOpts)
opts.URI.AddKnownURIParameters(options.KnownURIOptionsReadPreference)

extraArgs, err := opts.ParseArgs(rawArgs)
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion mongoexport/mongoexport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ func simpleMongoExportOpts() Options {
if uri := os.Getenv("MONGOD"); uri != "" {
fakeArgs := []string{"--uri=" + uri}
toolOptions = options.New("mongoexport", "", "", "", true, options.EnabledOptions{URI: true})
toolOptions.URI.AddKnownURIParameters(options.KnownURIOptionsReadPreference)
_, err := toolOptions.ParseArgs(fakeArgs)
if err != nil {
panic("Could not parse MONGOD environment variable")
Expand Down
1 change: 0 additions & 1 deletion mongoexport/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ func ParseOptions(rawArgs []string, versionStr, gitCommit string) (Options, erro
opts.AddOptions(outputOpts)
inputOpts := &InputOptions{}
opts.AddOptions(inputOpts)
opts.AddKnownURIParameters(options.KnownURIOptionsReadPreference)

extraArgs, err := opts.ParseArgs(rawArgs)
if err != nil {
Expand Down
2 changes: 0 additions & 2 deletions mongofiles/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ func ParseOptions(rawArgs []string, versionStr, gitCommit string) (Options, erro

opts.AddOptions(storageOpts)
opts.AddOptions(inputOpts)
opts.URI.AddKnownURIParameters(options.KnownURIOptionsReadPreference)
opts.URI.AddKnownURIParameters(options.KnownURIOptionsWriteConcern)

extraArgs, err := opts.ParseArgs(rawArgs)
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion mongoimport/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ func ParseOptions(rawArgs []string, versionStr, gitCommit string) (Options, erro
ingestOpts := &IngestOptions{}
opts.AddOptions(inputOpts)
opts.AddOptions(ingestOpts)
opts.URI.AddKnownURIParameters(options.KnownURIOptionsWriteConcern)

extraArgs, err := opts.ParseArgs(rawArgs)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions mongorestore/mongorestore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func TestDeprecatedDBAndCollectionOptions(t *testing.T) {
log.SetWriter(&buffer)
defer log.SetWriter(os.Stderr)

Convey("and no warning is issued in the well-defined case", t, func() {
Convey("and no warning is issued in the well-defined case", func() {
// No error and nothing written in the log
args := []string{
"testdata/hashedIndexes.bson",
Expand All @@ -100,7 +100,7 @@ func TestDeprecatedDBAndCollectionOptions(t *testing.T) {
So(buffer.String(), ShouldBeEmpty)
})

Convey("and a warning is issued in the deprecated case", t, func() {
Convey("and a warning is issued in the deprecated case", func() {
// No error and some kind of warning message in the log
args := []string{
DBOption, "db1",
Expand Down
2 changes: 0 additions & 2 deletions mongorestore/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ func ParseOptions(rawArgs []string, versionStr, gitCommit string) (Options, erro
outputOpts := &OutputOptions{}
opts.AddOptions(outputOpts)

opts.URI.AddKnownURIParameters(options.KnownURIOptionsWriteConcern)

extraArgs, err := opts.ParseArgs(rawArgs)
if err != nil {
return Options{}, err
Expand Down

0 comments on commit 9c63fb7

Please sign in to comment.