-
Notifications
You must be signed in to change notification settings - Fork 67
SWIFT-779 Safe access to ReadPreference pointer #456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #456 +/- ##
==========================================
+ Coverage 76.42% 76.62% +0.19%
==========================================
Files 117 117
Lines 12935 12982 +47
==========================================
+ Hits 9886 9947 +61
+ Misses 3049 3035 -14
Continue to review full report at Codecov.
|
| .target(name: "TestsCommon", dependencies: ["MongoSwift", "Nimble"]), | ||
| .testTarget(name: "BSONTests", dependencies: ["MongoSwift", "TestsCommon", "Nimble", "CLibMongoC"]), | ||
| .testTarget(name: "MongoSwiftTests", dependencies: ["MongoSwift", "TestsCommon", "Nimble", "NIO", "CLibMongoC"]), | ||
| .testTarget(name: "MongoSwiftTests", dependencies: ["MongoSwift", "TestsCommon", "Nimble", "NIO"]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉🎉🎉
|
whoops sorry i was trying to actually remove your name @mbroadst but i guess since you commented once already you are stuck on the list forever |
patrickfreed
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, just a few minor comments
@mbroadst I'm not sure if you want me to keep including you on these, LMK.
This PR switches
ReadPreferenceover to the "create a temporary libmongoc equivalent, use it to execute a closure, and then clean it up" approach we follow forReadConcern,WriteConcern,MongoDatabase, andMongoCollection.We had existing tests regarding
ReadConcernandWriteConcernthat verified these got set correctly on mongoc clients, dbs, and collections. I think we skipped these forReadPreferenceat the time because it was just wrapping amongoc_read_prefs_tso there was no need to test out the temporary creation of the libmongoc type.I have now added similar tests for
ReadPreference. As part of that I also moved libmongoc-dependent helper methods for getting theReadConcern/WriteConcernon a temporary db/collection into the driver itself. This allowed me to remove the CLibMongoC dependency fromMongoSwiftTests🎉Now we just need to remove it fromBSONTests.I also added some round trip testing between Swift and libmongoc types for all three of RC, WC, RP.