Skip to content

Commit

Permalink
Add example of using PostCondition for after-the-fact validation of w…
Browse files Browse the repository at this point in the history
…rite volume
  • Loading branch information
jseyster committed Jan 25, 2023
1 parent fe54aa7 commit 8de8df4
Showing 1 changed file with 59 additions and 2 deletions.
61 changes: 59 additions & 2 deletions src/workloads/execution/CheckMetricsTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GlobalDefaults:
Collection: &Collection Collection0
DocumentCount: &DocumentCount 100
Threads: &Threads 1
MaxPhases: &MaxPhases 3
MaxPhases: &MaxPhases 6

Actors:
# Clear any pre-existing collection state.
Expand Down Expand Up @@ -67,5 +67,62 @@ Actors:
- Metric: documents
GT: 4
LT: 50

- Name: CrudWriterExample
Type: CrudActor
Database: *Database
Threads: 1
Phases:
OnlyActiveInPhases:
Active: [3]
NopInPhasesUpTo: *MaxPhases
PhaseConfig:
Repeat: 10
Collection: *Collection
Operations:
- OperationName: insertMany
OperationMetricsName: InsertLargeString
OperationCommand:
Documents:
- {str: {^FastRandomString: {length: 1024}}}

# Make sure that the "LargeStringInserts" workload wrote the expected amount of data.
- Name: ValidateLargeStringInserts
Type: CrudActor
Database: *Database
Threads: 1
Phases:
OnlyActiveInPhases:
Active: [4]
NopInPhasesUpTo: *MaxPhases
PhaseConfig:
Repeat: 1
Collection: *Collection
Operations:
- OperationName: find
OperationMetricsName: LargeStringBytes
OperationCommand:
Filter: {str: {$ne: null}}
PostCondition:
- Metric: bytes
EQ: 100
GT: 10000

- Name: AATest
Type: AssertiveActor
Database: *Database
Threads: 1
Phases:
OnlyActiveInPhases:
Active: [5]
NopInPhasesUpTo: *MaxPhases
PhaseConfig:
Repeat: 1
Message: Test message
Actual:
aggregate: *Collection
pipeline: [{$project: {size: {$bsonSize: "$$ROOT"}}}, {$group: {_id: null, totalSize: {$sum: "$size"}}}, {$project: {passed: {$gt: ["$totalSize", 15000]}}}]
cursor: {}
Expected:
aggregate: 1
pipeline: [{$documents: [{passed: true}]}]
cursor: {}

0 comments on commit 8de8df4

Please sign in to comment.