@@ -50,93 +50,6 @@ describe('server selection', function () {
5050 ok : 0
5151 } ) ;
5252
53- describe ( '#readPreferenceServerSelector' , function ( ) {
54- let selector ;
55- let servers ;
56-
57- context ( 'when the topology is sharded' , function ( ) {
58- const topologyDescription = new TopologyDescription (
59- TopologyType . Sharded ,
60- new Map ( ) ,
61- 'test' ,
62- MIN_SECONDARY_WRITE_WIRE_VERSION ,
63- new ObjectId ( ) ,
64- MIN_SECONDARY_WRITE_WIRE_VERSION
65- ) ;
66-
67- beforeEach ( function ( ) {
68- selector = readPreferenceServerSelector ( ReadPreference . secondaryPreferred ) ;
69- } ) ;
70-
71- context ( 'when there are deprioritized servers' , function ( ) {
72- context ( 'when there are other servers' , function ( ) {
73- beforeEach ( function ( ) {
74- servers = selector ( topologyDescription , [ mongos ] , [ mongosTwo ] ) ;
75- } ) ;
76-
77- it ( 'returns a server from the other servers' , function ( ) {
78- expect ( servers ) . to . deep . equal ( [ mongos ] ) ;
79- } ) ;
80- } ) ;
81-
82- context ( 'when there are no other servers' , function ( ) {
83- beforeEach ( function ( ) {
84- servers = selector ( topologyDescription , [ ] , [ mongosTwo ] ) ;
85- } ) ;
86-
87- it ( 'returns a server from the deprioritized servers' , function ( ) {
88- expect ( servers ) . to . deep . equal ( [ mongosTwo ] ) ;
89- } ) ;
90- } ) ;
91- } ) ;
92-
93- context ( 'when there are no deprioritised servers' , function ( ) {
94- beforeEach ( function ( ) {
95- servers = selector ( topologyDescription , [ mongos ] ) ;
96- } ) ;
97-
98- it ( 'returns a server from the other servers' , function ( ) {
99- expect ( servers ) . to . deep . equal ( [ mongos ] ) ;
100- } ) ;
101- } ) ;
102- } ) ;
103-
104- context ( 'when the topology is not sharded' , function ( ) {
105- const topologyDescription = new TopologyDescription (
106- TopologyType . ReplicaSetWithPrimary ,
107- new Map ( ) ,
108- 'test' ,
109- MIN_SECONDARY_WRITE_WIRE_VERSION ,
110- new ObjectId ( ) ,
111- MIN_SECONDARY_WRITE_WIRE_VERSION
112- ) ;
113-
114- beforeEach ( function ( ) {
115- selector = readPreferenceServerSelector ( ReadPreference . secondary ) ;
116- } ) ;
117-
118- context ( 'when there are deprioritized servers' , function ( ) {
119- beforeEach ( function ( ) {
120- servers = selector ( topologyDescription , [ secondaryTwo ] , [ secondary ] ) ;
121- } ) ;
122-
123- it ( 'selects from all server lists' , function ( ) {
124- expect ( servers ) . to . contain . oneOf ( [ secondary , secondaryTwo ] ) ;
125- } ) ;
126- } ) ;
127-
128- context ( 'when there are no deprioritised servers' , function ( ) {
129- beforeEach ( function ( ) {
130- servers = selector ( topologyDescription , [ secondary ] , [ ] ) ;
131- } ) ;
132-
133- it ( 'selects from all non-deprioritised servers' , function ( ) {
134- expect ( servers ) . to . deep . equal ( [ secondary ] ) ;
135- } ) ;
136- } ) ;
137- } ) ;
138- } ) ;
139-
14053 describe ( '#sameServerSelector' , function ( ) {
14154 const topologyDescription = sinon . stub ( ) ;
14255 const serverDescriptions = new Map ( ) ;
0 commit comments