Skip to content

Add missing tests for load-balancer specification #1802

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions source/load-balancers/tests/dns-seedlist-discovery.json

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

48 changes: 48 additions & 0 deletions source/load-balancers/tests/dns-seedlist-discovery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
description: DNS seedlist discovery for load-balanced clusters

schemaVersion: '1.4'

runOnRequirements:
- topologies: [ load-balanced ]

createEntities:
- client:
id: &client0 client0
useMultipleMongoses: true
observeEvents:
- topologyDescriptionChangedEvent
- database:
id: &database0 database0
client: *client0
databaseName: &database0Name database0

tests:
- description: SRV polling is disabled with loadBalanced=true
operations:
# Wait for initial topology description events
- name: waitForEvent
object: testRunner
arguments:
client: *client0
event:
topologyDescriptionChangedEvent:
topologyType: LoadBalanced
# Wait long enough for any SRV polling to occur (if implemented)
- name: wait
object: testRunner
arguments:
ms: 60000
# Run an operation to check that we're still connected
- name: runCommand
object: *database0
arguments:
commandName: ping
command: { ping: 1 }
# Verify that no additional topology events were published
- name: assertEventCount
object: testRunner
arguments:
client: *client0
event:
topologyDescriptionChangedEvent: 2
count: 2 # Only two events: initial Unknown -> LoadBalanced, and LoadBalanced server details
89 changes: 89 additions & 0 deletions source/load-balancers/tests/driver-sessions.json

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

56 changes: 56 additions & 0 deletions source/load-balancers/tests/driver-sessions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
description: driver sessions for load-balanced clusters

schemaVersion: '1.4'

runOnRequirements:
- topologies: [ load-balanced ]

createEntities:
- client:
id: &client0 client0
useMultipleMongoses: true
observeEvents:
- commandStartedEvent
- database:
id: &database0 database0
client: *client0
databaseName: &database0Name database0
- collection:
id: &collection0 collection0
database: *database0
collectionName: &collection0Name collection0

tests:
- description: sessions are always supported with load-balanced topology
operations:
- name: createClientSession
object: *client0
arguments: {}
saveResultAsEntity: &session0 session0
# Perform a simple operation with the session
- name: insertOne
object: *collection0
arguments:
document: { x: 1 }
session: *session0

- description: ServerType LoadBalancer is considered a data-bearing server
operations:
# The previous test already verifies this implicitly by allowing insertOne,
# but we can add additional operations
- name: createClientSession
object: *client0
arguments: {}
saveResultAsEntity: &session1 session1
- name: runCommand
object: *database0
arguments:
commandName: ping
command: { ping: 1 }
session: *session1
# Test that we can use read operations as well (which require a data-bearing server)
- name: find
object: *collection0
arguments:
filter: {}
session: *session1
81 changes: 81 additions & 0 deletions source/load-balancers/tests/log-messages.json

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

Loading