Add $out stage tests#182
Conversation
|
🤖 Auto-triaged by documentdb-triage-tool. Applied: Reasoningcomponent from path globs (test-coverage, test-framework); effort from diff stats (5885+0 LOC, 16 files); LLM: Adds new integration test coverage for the $out stage operator, touching the compatibility tests directory. If a label is wrong, remove it manually and ping |
e23668c to
8dac8d4
Compare
SaiPradyumn
left a comment
There was a problem hiding this comment.
$out + $merge mutual exclusion -> Both are terminal stages. Test confirming [{"$out": "x"}, {"$merge": {...}}] or [{"$merge": ...}, {"$out": "x"}] errors.
| OutTestCase( | ||
| "out_then_merge", | ||
| docs=[{"_id": 1}], | ||
| pipeline=[{"$out": "target"}, {"$merge": {"into": "target2"}}], | ||
| msg="$out followed by $merge should produce a pipeline position error", | ||
| error_code=OUT_NOT_LAST_STAGE_ERROR, | ||
| ), | ||
| OutTestCase( | ||
| "merge_then_out", | ||
| docs=[{"_id": 1}], | ||
| pipeline=[{"$merge": {"into": "target"}}, {"$out": "target2"}], | ||
| msg="$merge followed by $out should produce a pipeline position error", | ||
| error_code=OUT_NOT_LAST_STAGE_ERROR, | ||
| ), |
There was a problem hiding this comment.
@SaiPradyumn We have $merge and $out error tests here, is this what you were referring to?
There was a problem hiding this comment.
yes i think that should cover it, i might have missed it. Thanks
Signed-off-by: Alina (Xi) Li <Alina.Li@improving.com>
Signed-off-by: Alina (Xi) Li <Alina.Li@improving.com>
Signed-off-by: Alina (Xi) Li <Alina.Li@improving.com>
|
Pushed one commit for |
| c.database.drop_collection("schema_val_warn_target"), | ||
| c.database.command( | ||
| { | ||
| "create": "schema_val_warn_target", |
There was a problem hiding this comment.
Hardcoded collection name "schema_val_warn_target" makes parallel test runs unsafe (different worker may still own this collection from an earlier run).
use collection.name, or f"{collection.name}_suffix" if you need another one to ensure uniqueness.
There was a problem hiding this comment.
Good point. I have changed to use f"{collection.name}..." with different suffix.
Also separated 2 outlier test cases test_out_lookup_equality and test_out_unionwith_merge.
| OutTestCase( | ||
| "null_granularity_defaults_to_seconds", | ||
| docs=[{"_id": 1, "ts": datetime(2024, 1, 1), "value": 10}], | ||
| target_coll="target_gran_null", |
There was a problem hiding this comment.
[Suggestion] for the review: consider deriving target_coll from the test ID (f"{ctx.collection}_{test.id}") so future copy-paste mistakes can't cause silent
collision.
Signed-off-by: Alina (Xi) Li <Alina.Li@improving.com> separate outlier cases Signed-off-by: Alina (Xi) Li <Alina.Li@improving.com> separate outlier cases Signed-off-by: Alina (Xi) Li <Alina.Li@improving.com>
alinaliBQ
left a comment
There was a problem hiding this comment.
Will continue addressing comments next week
| c.database.drop_collection("schema_val_warn_target"), | ||
| c.database.command( | ||
| { | ||
| "create": "schema_val_warn_target", |
There was a problem hiding this comment.
Good point. I have changed to use f"{collection.name}..." with different suffix.
Also separated 2 outlier test cases test_out_lookup_equality and test_out_unionwith_merge.
This change adds tests for the $out stage operator.
Add stage operator tests for $out. Tests database $out behavior, output collection, syntax, and expected errors.
Integration tests are in
documentdb_tests/compatibility/tests/core/operator/stages/test_stages_combination_out.py