-
Notifications
You must be signed in to change notification settings - Fork 178
RUST-670 Expect unified test format operations to succeed #388
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -147,7 +147,10 @@ pub struct DatabaseSpecification { | |
pub name: String, | ||
|
||
/// The amount of disk space in bytes that is consumed by the database. | ||
#[serde(deserialize_with = "crate::bson_util::deserialize_u64_from_bson_number")] | ||
#[serde( | ||
deserialize_with = "crate::bson_util::deserialize_u64_from_bson_number", | ||
serialize_with = "crate::bson::serde_helpers::serialize_u64_as_i64" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This addition was necessary because the results from test operations are all serialized into |
||
)] | ||
pub size_on_disk: u64, | ||
|
||
/// Whether the database has any data. | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
63 changes: 63 additions & 0 deletions
63
src/test/spec/json/unified-test-format/valid-fail/assertNumberConnectionsCheckedOut.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"description": "assertNumberConnectionsCheckedOut", | ||
"schemaVersion": "1.3", | ||
"createEntities": [ | ||
{ | ||
"client": { | ||
"id": "client0", | ||
"useMultipleMongoses": true | ||
} | ||
} | ||
], | ||
"tests": [ | ||
{ | ||
"description": "operation fails if client field is not specified", | ||
"operations": [ | ||
{ | ||
"name": "assertNumberConnectionsCheckedOut", | ||
"object": "testRunner", | ||
"arguments": { | ||
"connections": 1 | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "operation fails if connections field is not specified", | ||
"operations": [ | ||
{ | ||
"name": "assertNumberConnectionsCheckedOut", | ||
"object": "testRunner", | ||
"arguments": { | ||
"client": "client0" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "operation fails if client entity does not exist", | ||
"operations": [ | ||
{ | ||
"name": "assertNumberConnectionsCheckedOut", | ||
"object": "testRunner", | ||
"arguments": { | ||
"client": "client1" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "operation fails if number of connections is incorrect", | ||
"operations": [ | ||
{ | ||
"name": "assertNumberConnectionsCheckedOut", | ||
"object": "testRunner", | ||
"arguments": { | ||
"client": "client0", | ||
"connections": 1 | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} |
38 changes: 38 additions & 0 deletions
38
src/test/spec/json/unified-test-format/valid-fail/assertNumberConnectionsCheckedOut.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
description: assertNumberConnectionsCheckedOut | ||
|
||
schemaVersion: '1.3' | ||
|
||
createEntities: | ||
- client: | ||
id: &client0 client0 | ||
useMultipleMongoses: true | ||
|
||
tests: | ||
- description: operation fails if client field is not specified | ||
operations: | ||
- name: assertNumberConnectionsCheckedOut | ||
object: testRunner | ||
arguments: | ||
connections: 1 | ||
|
||
- description: operation fails if connections field is not specified | ||
operations: | ||
- name: assertNumberConnectionsCheckedOut | ||
object: testRunner | ||
arguments: | ||
client: *client0 | ||
|
||
- description: operation fails if client entity does not exist | ||
operations: | ||
- name: assertNumberConnectionsCheckedOut | ||
object: testRunner | ||
arguments: | ||
client: client1 | ||
|
||
- description: operation fails if number of connections is incorrect | ||
operations: | ||
- name: assertNumberConnectionsCheckedOut | ||
object: testRunner | ||
arguments: | ||
client: *client0 | ||
connections: 1 |
18 changes: 18 additions & 0 deletions
18
src/test/spec/json/unified-test-format/valid-fail/entity-bucket-database-undefined.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"description": "entity-bucket-database-undefined", | ||
"schemaVersion": "1.0", | ||
"createEntities": [ | ||
{ | ||
"bucket": { | ||
"id": "bucket0", | ||
"database": "foo" | ||
} | ||
} | ||
], | ||
"tests": [ | ||
{ | ||
"description": "foo", | ||
"operations": [] | ||
} | ||
] | ||
} |
12 changes: 12 additions & 0 deletions
12
src/test/spec/json/unified-test-format/valid-fail/entity-bucket-database-undefined.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
description: "entity-bucket-database-undefined" | ||
|
||
schemaVersion: "1.0" | ||
|
||
createEntities: | ||
- bucket: | ||
id: &bucket0 "bucket0" | ||
database: "foo" | ||
|
||
tests: | ||
- description: "foo" | ||
operations: [] |
20 changes: 20 additions & 0 deletions
20
src/test/spec/json/unified-test-format/valid-fail/entity-client-apiVersion-unsupported.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"description": "entity-client-apiVersion-unsupported", | ||
"schemaVersion": "1.1", | ||
"createEntities": [ | ||
{ | ||
"client": { | ||
"id": "client0", | ||
"serverApi": { | ||
"version": "server_will_never_support_this_api_version" | ||
} | ||
} | ||
} | ||
], | ||
"tests": [ | ||
{ | ||
"description": "foo", | ||
"operations": [] | ||
} | ||
] | ||
} |
13 changes: 13 additions & 0 deletions
13
src/test/spec/json/unified-test-format/valid-fail/entity-client-apiVersion-unsupported.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
description: "entity-client-apiVersion-unsupported" | ||
|
||
schemaVersion: "1.1" | ||
|
||
createEntities: | ||
- client: | ||
id: &client0 client0 | ||
serverApi: | ||
version: "server_will_never_support_this_api_version" | ||
|
||
tests: | ||
- description: "foo" | ||
operations: [] |
28 changes: 28 additions & 0 deletions
28
...d-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_with_client_id.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"description": "entity-client-storeEventsAsEntities-conflict_with_client_id", | ||
"schemaVersion": "1.2", | ||
"createEntities": [ | ||
{ | ||
"client": { | ||
"id": "client0", | ||
"storeEventsAsEntities": [ | ||
{ | ||
"id": "client0", | ||
"events": [ | ||
"PoolCreatedEvent", | ||
"PoolReadyEvent", | ||
"PoolClearedEvent", | ||
"PoolClosedEvent" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"tests": [ | ||
{ | ||
"description": "foo", | ||
"operations": [] | ||
} | ||
] | ||
} |
16 changes: 16 additions & 0 deletions
16
...ed-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_with_client_id.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
description: "entity-client-storeEventsAsEntities-conflict_with_client_id" | ||
|
||
schemaVersion: "1.2" | ||
|
||
createEntities: | ||
- client: | ||
id: &client0 client0 | ||
storeEventsAsEntities: | ||
# Using the client ID here will ensure that test runners also detect | ||
# conflicts with the same entity being defined | ||
- id: *client0 | ||
events: ["PoolCreatedEvent", "PoolReadyEvent", "PoolClearedEvent", "PoolClosedEvent"] | ||
|
||
tests: | ||
- description: "foo" | ||
operations: [] |
43 changes: 43 additions & 0 deletions
43
...ormat/valid-fail/entity-client-storeEventsAsEntities-conflict_within_different_array.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"description": "entity-client-storeEventsAsEntities-conflict_within_different_array", | ||
"schemaVersion": "1.2", | ||
"createEntities": [ | ||
{ | ||
"client": { | ||
"id": "client0", | ||
"storeEventsAsEntities": [ | ||
{ | ||
"id": "events", | ||
"events": [ | ||
"PoolCreatedEvent", | ||
"PoolReadyEvent", | ||
"PoolClearedEvent", | ||
"PoolClosedEvent" | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"client": { | ||
"id": "client1", | ||
"storeEventsAsEntities": [ | ||
{ | ||
"id": "events", | ||
"events": [ | ||
"CommandStartedEvent", | ||
"CommandSucceededEvent", | ||
"CommandFailedEvent" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"tests": [ | ||
{ | ||
"description": "foo", | ||
"operations": [] | ||
} | ||
] | ||
} |
19 changes: 19 additions & 0 deletions
19
...format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_different_array.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
description: "entity-client-storeEventsAsEntities-conflict_within_different_array" | ||
|
||
schemaVersion: "1.2" | ||
|
||
createEntities: | ||
- client: | ||
id: &client0 client0 | ||
storeEventsAsEntities: | ||
- id: &events events | ||
events: ["PoolCreatedEvent", "PoolReadyEvent", "PoolClearedEvent", "PoolClosedEvent"] | ||
- client: | ||
id: &client1 client1 | ||
storeEventsAsEntities: | ||
- id: *events | ||
events: ["CommandStartedEvent", "CommandSucceededEvent", "CommandFailedEvent"] | ||
|
||
tests: | ||
- description: "foo" | ||
operations: [] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason these are the only fields on which you've applied the
default
attribute?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default
is needed whendeserialize_with
is being used to default the field toNone
if it isn't specified. I addeddefault
to these fields specifically because they weren't properly deserializing from the test files.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Does it make more sense to include
default
as a container attribute instead now that the options structs aren'tOption
s? I guess every field is optional so it doesn't matter much either way.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it shouldn't matter,
default
is only really necessary when we're overriding the default deserialization behavior withdeserialize_with
because the method provided there doesn't handleOption
s.