|
| 1 | +==================================== |
| 2 | +Initial DNS Seedlist Discovery tests |
| 3 | +==================================== |
| 4 | + |
| 5 | +This directory contains platform-independent tests that drivers can use |
| 6 | +to prove their conformance to the Initial DNS Seedlist Discovery spec. |
| 7 | + |
| 8 | +Test Setup |
| 9 | +---------- |
| 10 | + |
| 11 | +Start a three-node replica set on localhost, on ports 27017, 27018, and 27019, |
| 12 | +with replica set name "repl0". The replica set MUST be started with SSL |
| 13 | +enabled. |
| 14 | + |
| 15 | +To run the tests that accompany this spec, you need to configure the SRV and |
| 16 | +TXT records with a real name server. The following records are required for |
| 17 | +these tests:: |
| 18 | + |
| 19 | + Record TTL Class Address |
| 20 | + localhost.test.build.10gen.cc. 86400 IN A 127.0.0.1 |
| 21 | + localhost.sub.test.build.10gen.cc. 86400 IN A 127.0.0.1 |
| 22 | + |
| 23 | + Record TTL Class Port Target |
| 24 | + _mongodb._tcp.test1.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc. |
| 25 | + _mongodb._tcp.test1.test.build.10gen.cc. 86400 IN SRV 27018 localhost.test.build.10gen.cc. |
| 26 | + _mongodb._tcp.test2.test.build.10gen.cc. 86400 IN SRV 27018 localhost.test.build.10gen.cc. |
| 27 | + _mongodb._tcp.test2.test.build.10gen.cc. 86400 IN SRV 27019 localhost.test.build.10gen.cc. |
| 28 | + _mongodb._tcp.test3.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc. |
| 29 | + _mongodb._tcp.test5.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc. |
| 30 | + _mongodb._tcp.test6.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc. |
| 31 | + _mongodb._tcp.test7.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc. |
| 32 | + _mongodb._tcp.test8.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc. |
| 33 | + _mongodb._tcp.test10.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc. |
| 34 | + _mongodb._tcp.test11.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc. |
| 35 | + _mongodb._tcp.test12.test.build.10gen.cc. 86400 IN SRV 27017 localhost.build.10gen.cc. |
| 36 | + _mongodb._tcp.test13.test.build.10gen.cc. 86400 IN SRV 27017 test.build.10gen.cc. |
| 37 | + _mongodb._tcp.test14.test.build.10gen.cc. 86400 IN SRV 27017 localhost.not-test.build.10gen.cc. |
| 38 | + _mongodb._tcp.test15.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.not-build.10gen.cc. |
| 39 | + _mongodb._tcp.test16.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.not-10gen.cc. |
| 40 | + _mongodb._tcp.test17.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.not-cc. |
| 41 | + _mongodb._tcp.test18.test.build.10gen.cc. 86400 IN SRV 27017 localhost.sub.test.build.10gen.cc. |
| 42 | + _mongodb._tcp.test19.test.build.10gen.cc. 86400 IN SRV 27017 localhost.evil.build.10gen.cc. |
| 43 | + _mongodb._tcp.test19.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc. |
| 44 | + |
| 45 | + Record TTL Class Text |
| 46 | + test5.test.build.10gen.cc. 86400 IN TXT "replicaSet=repl0&authSource=thisDB" |
| 47 | + test6.test.build.10gen.cc. 86400 IN TXT "replicaSet=repl0" |
| 48 | + test6.test.build.10gen.cc. 86400 IN TXT "authSource=otherDB" |
| 49 | + test7.test.build.10gen.cc. 86400 IN TXT "ssl=false" |
| 50 | + test8.test.build.10gen.cc. 86400 IN TXT "authSource" |
| 51 | + test10.test.build.10gen.cc. 86400 IN TXT "socketTimeoutMS=500" |
| 52 | + test11.test.build.10gen.cc. 86400 IN TXT "replicaS" "et=rep" "l0" |
| 53 | + |
| 54 | +Note that ``test4`` is omitted deliberately to test what happens with no SRV |
| 55 | +record. ``test9`` is missing because it was deleted during the development of |
| 56 | +the tests. The missing ``test.`` sub-domain in the SRV record target for |
| 57 | +``test12`` is deliberate. |
| 58 | + |
| 59 | +In our tests we have used ``localhost.test.build.10gen.cc`` as the domain, and |
| 60 | +then configured ``localhost.test.build.10gen.cc`` to resolve to 127.0.0.1. |
| 61 | + |
| 62 | +You need to adapt the records shown above to replace ``test.build.10gen.cc`` |
| 63 | +with your own domain name, and update the "uri" field in the YAML or JSON files |
| 64 | +in this directory with the actual domain. |
| 65 | + |
| 66 | +Test Format and Use |
| 67 | +------------------- |
| 68 | + |
| 69 | +These YAML and JSON files contain the following fields: |
| 70 | + |
| 71 | +- ``uri``: a mongodb+srv connection string |
| 72 | +- ``seeds``: the expected set of initial seeds discovered from the SRV record |
| 73 | +- ``hosts``: the discovered topology's list of hosts once SDAM completes a scan |
| 74 | +- ``options``: the parsed connection string options as discovered from URI and |
| 75 | + TXT records |
| 76 | +- ``error``: indicates that the parsing of the URI, or the resolving or |
| 77 | + contents of the SRV or TXT records included errors. |
| 78 | +- ``comment``: a comment to indicate why a test would fail. |
| 79 | + |
| 80 | +For each file, create MongoClient initialized with the mongodb+srv connection |
| 81 | +string. You SHOULD verify that the client's initial seed list matches the list of |
| 82 | +seeds. You MUST verify that the set of ServerDescriptions in the client's |
| 83 | +TopologyDescription eventually matches the list of hosts. You MUST verify that |
| 84 | +each of the values of the Connection String Options under ``options`` match the |
| 85 | +Client's parsed value for that option. There may be other options parsed by |
| 86 | +the Client as well, which a test does not verify. You MUST verify that an |
| 87 | +error has been thrown if ``error`` is present. |
0 commit comments