-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed minor bug parsing url connection. Updated dependencies librarie…
…s. (#209) * Fixed minor bug parsing url connection. Updated dependencies libraries. * Incremented max_nesting option in credo refactor nestring * Changed function ReadPreference.primary() by ReadPreference.merge_defaults() in topology test file --------- Co-authored-by: Juan Antonio Jiménez <[email protected]> Co-authored-by: Michael Maier <[email protected]>
- Loading branch information
1 parent
50ea98d
commit f68b9c1
Showing
12 changed files
with
76 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,52 @@ defmodule Mongo.UrlParserTest do | |
assert UrlParser.parse_url(url: "mongodb://localhost:27017") == [seeds: ["localhost:27017"]] | ||
end | ||
|
||
test "basic url and trailing slash" do | ||
assert UrlParser.parse_url(url: "mongodb://localhost:27017/") == [seeds: ["localhost:27017"]] | ||
end | ||
|
||
test "basic url and trailing slash and options" do | ||
assert UrlParser.parse_url(url: "mongodb://localhost:27017/?replicaSet=set-name&authSource=admin&maxPoolSize=5") == [ | ||
pool_size: 5, | ||
auth_source: "admin", | ||
set_name: "set-name", | ||
seeds: ["localhost:27017"] | ||
] | ||
end | ||
|
||
test "basic url, trailing slash and options" do | ||
assert UrlParser.parse_url(url: "mongodb://localhost:27017/") == [seeds: ["localhost:27017"]] | ||
end | ||
|
||
test "Missing delimiting slash between hosts and options" do | ||
assert UrlParser.parse_url(url: "mongodb://example.com?w=1") == [url: "mongodb://example.com?w=1"] | ||
end | ||
|
||
test "Incomplete key value pair for option" do | ||
assert UrlParser.parse_url(url: "mongodb://example.com/test?w") == [url: "mongodb://example.com/test?w"] | ||
end | ||
|
||
test "User info for single IPv4 host without database" do | ||
assert UrlParser.parse_url(url: "mongodb://alice:[email protected]") |> Keyword.drop([:pw_safe]) == [password: "*****", username: "alice", seeds: ["127.0.0.1"]] | ||
end | ||
|
||
test "User info for single IPv4 host with database" do | ||
assert UrlParser.parse_url(url: "mongodb://alice:[email protected]/test") |> Keyword.drop([:pw_safe]) == [ | ||
password: "*****", | ||
username: "alice", | ||
database: "test", | ||
seeds: ["127.0.0.1"] | ||
] | ||
end | ||
|
||
test "User info for single hostname without database" do | ||
assert UrlParser.parse_url(url: "mongodb://eve:[email protected]") |> Keyword.drop([:pw_safe]) == [ | ||
password: "*****", | ||
username: "eve", | ||
seeds: ["example.com"] | ||
] | ||
end | ||
|
||
test "cluster url with ssl" do | ||
url = "mongodb://user:[email protected]:27017,seed2.domain.com:27017,seed3.domain.com:27017/db_name?ssl=true&replicaSet=set-name&authSource=admin&maxPoolSize=5" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters