test: migrate RagPipelineService DB operation SQL tests to Testcontainer#34959
Merged
asukaminato0721 merged 3 commits intolanggenius:mainfrom Apr 11, 2026
Conversation
Contributor
Pyrefly DiffNo changes detected. |
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Migrates RagPipelineService SQL-mocked unit tests to real PostgreSQL integration tests using Testcontainers, removing brittle db.session.* patches and validating behavior against actual persisted rows.
Changes:
- Removed 6
db.session.scalar/delete/commit-patched unit tests forget_pipeline,update_customized_pipeline_template, anddelete_customized_pipeline_template. - Added new Testcontainers-backed integration test module covering those DB operations with real
Dataset,Pipeline, andPipelineCustomizedTemplaterows. - Added package init for the new integration test directory.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| api/tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py | Removes SQL-mocked unit tests that are now covered by DB-backed integration tests. |
| api/tests/test_containers_integration_tests/services/rag_pipeline/test_rag_pipeline_service_db.py | Adds PostgreSQL integration tests for pipeline lookup, template update, and template delete flows. |
| api/tests/test_containers_integration_tests/services/rag_pipeline/init.py | New package marker for the integration test module path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Pyrefly DiffNo changes detected. |
…service integration tests
3da35fd to
3c8668e
Compare
Contributor
Pyrefly DiffNo changes detected. |
Contributor
Pyrefly DiffNo changes detected. |
Contributor
Author
|
Hi, @asukaminato0721 |
asukaminato0721
approved these changes
Apr 11, 2026
HanqingZ
pushed a commit
to HanqingZ/dify
that referenced
this pull request
Apr 23, 2026
…ner (langgenius#34959) Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Migrates SQL-patched unit tests to real PostgreSQL integration tests using Testcontainers.
unit_tests/services/rag_pipeline/test_rag_pipeline_service.pythat patcheddb.session.scalar,db.session.delete, anddb.session.commit:test_get_pipeline_raises_when_dataset_not_foundtest_update_customized_pipeline_template_successtest_update_customized_pipeline_template_not_foundtest_update_customized_pipeline_template_duplicate_nametest_delete_customized_pipeline_template_successtest_delete_customized_pipeline_template_not_foundIconInfoandPipelineTemplateInfoEntityimports from the unit test filetest_containers_integration_tests/services/rag_pipeline/test_rag_pipeline_service_db.pywith realDataset,Pipeline, andPipelineCustomizedTemplaterowsFile changes
api/tests/test_containers_integration_tests/services/rag_pipeline/test_rag_pipeline_service_db.py(new)api/tests/test_containers_integration_tests/services/rag_pipeline/__init__.py(new)api/tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py(removed SQL-patched tests)Test plan
get_pipelinelookups, template update (success + not-found + duplicate name), template delete (success + not-found)test_rag_pipeline_service.pystill pass (sync_draft_workflow, template retrieval, etc.)db.sessionscalar/delete/commit patches remain for the migrated methodsCloses part of #32454.