Skip to content

Commit

Permalink
DRIVERS-2578 Add tests for pre and post 4.4 behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaneHarvey committed Oct 5, 2023
1 parent acf3ed9 commit 9e2acb0
Show file tree
Hide file tree
Showing 2 changed files with 245 additions and 15 deletions.

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

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ runOnRequirements:
tests:
- description: "connect with serverMonitoringMode=auto >=4.4"
runOnRequirements:
- minServerVersion: "4.4"
- minServerVersion: "4.4.0"
operations:
- name: createEntities
object: testRunner
Expand Down Expand Up @@ -57,9 +57,46 @@ tests:
- serverHeartbeatStartedEvent:
awaited: True

- description: "connect with serverMonitoringMode=auto <4.4"
runOnRequirements:
- maxServerVersion: "4.2.99"
operations:
- name: createEntities
object: testRunner
arguments:
entities:
- client:
id: client
uriOptions:
serverMonitoringMode: "auto"
heartbeatFrequencyMS: 500
useMultipleMongoses: false
observeEvents:
- serverHeartbeatStartedEvent
- serverHeartbeatSucceededEvent
- serverHeartbeatFailedEvent
- database:
id: db
client: client
databaseName: sdam-tests
- *ping
# Wait for the second serverHeartbeatStartedEvent to ensure we do not stream.
- *waitForSecondHeartbeatStarted
expectEvents: &pollingStartedEvents
- client: client
eventType: sdam
ignoreExtraEvents: true
events:
- serverHeartbeatStartedEvent:
awaited: False
- serverHeartbeatSucceededEvent:
awaited: False
- serverHeartbeatStartedEvent:
awaited: False

- description: "connect with serverMonitoringMode=stream >=4.4"
runOnRequirements:
- minServerVersion: "4.4"
- minServerVersion: "4.4.0"
operations:
- name: createEntities
object: testRunner
Expand All @@ -83,6 +120,33 @@ tests:
- *waitForSecondHeartbeatStarted
expectEvents: *streamingStartedEvents

- description: "connect with serverMonitoringMode=stream <4.4"
runOnRequirements:
- maxServerVersion: "4.2.99"
operations:
- name: createEntities
object: testRunner
arguments:
entities:
- client:
id: client
uriOptions:
serverMonitoringMode: "stream"
heartbeatFrequencyMS: 500
useMultipleMongoses: false
observeEvents:
- serverHeartbeatStartedEvent
- serverHeartbeatSucceededEvent
- serverHeartbeatFailedEvent
- database:
id: db
client: client
databaseName: sdam-tests
- *ping
# Wait for the second serverHeartbeatStartedEvent to ensure we do not stream.
- *waitForSecondHeartbeatStarted
expectEvents: *pollingStartedEvents

- description: "connect with serverMonitoringMode=poll"
operations:
- name: createEntities
Expand All @@ -106,14 +170,4 @@ tests:
- *ping
# Wait for the second serverHeartbeatStartedEvent to ensure we do not stream.
- *waitForSecondHeartbeatStarted
expectEvents: &pollingStartedEvents
- client: client
eventType: sdam
ignoreExtraEvents: true
events:
- serverHeartbeatStartedEvent:
awaited: False
- serverHeartbeatSucceededEvent:
awaited: False
- serverHeartbeatStartedEvent:
awaited: False
expectEvents: *pollingStartedEvents

0 comments on commit 9e2acb0

Please sign in to comment.