Skip to content

Commit

Permalink
Check connection urls
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysmeister committed Oct 4, 2024
1 parent a5febb8 commit bcba698
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/integration/targets/mongodb_shell/tasks/677.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@
debug: true
register: mongo_output

- assert:
that:
- mongo_output.changed
- "'mongodb://localhost:3001/test?retryWrites=false' in mongo_output.cmd"

- name: Test with a dict conn option
community.mongodb.mongodb_shell:
<<: *mongo_parameters
Expand All @@ -77,6 +82,11 @@
debug: true
register: mongo_output

- assert:
that:
- mongo_output.changed
- "'mongodb://localhost:3001/test?retryWrites=false' in mongo_output.cmd"

- name: This will throw an error because false is not quoted
community.mongodb.mongodb_shell:
<<: *mongo_parameters
Expand All @@ -91,6 +101,7 @@
that:
- mongo_output.failed
- "'MongoParseError: retryWrites must be either' in mongo_output.msg"
- "'mongodb://localhost:3001/test?retryWrites=False' in mongo_output.cmd"

- name: Test with a 2 string conn options
community.mongodb.mongodb_shell:
Expand All @@ -102,6 +113,11 @@
debug: true
register: mongo_output

- assert:
that:
- mongo_output.changed
- "'mongodb://localhost:3001/test?retryWrites=false&replicaSet=issue_677' in mongo_output.cmd"

- name: Test with 2 dict conn options
community.mongodb.mongodb_shell:
<<: *mongo_parameters
Expand All @@ -112,6 +128,11 @@
debug: true
register: mongo_output

- assert:
that:
- mongo_output.changed
- "'mongodb://localhost:3001/test?retryWrites=false&replicaSet=issue_677' in mongo_output.cmd"

- name: Test with a 3 string conn options
community.mongodb.mongodb_shell:
<<: *mongo_parameters
Expand All @@ -123,6 +144,11 @@
debug: true
register: mongo_output

- assert:
that:
- mongo_output.changed
- "'mongodb://localhost:3001/test?retryWrites=false&replicaSet=issue_677&connectTimeoutMS=10000' in mongo_output.cmd"

- name: Test with 3 dict conn options
community.mongodb.mongodb_shell:
<<: *mongo_parameters
Expand All @@ -133,3 +159,8 @@
- connectTimeoutMS: 10000
debug: true
register: mongo_output

- assert:
that:
- mongo_output.changed
- "'mongodb://localhost:3001/test?retryWrites=false&replicaSet=issue_677&connectTimeoutMS=10000' in mongo_output.cmd"

0 comments on commit bcba698

Please sign in to comment.