Skip to content

test: migrate RagPipelineService DB operation SQL tests to Testcontainer#34959

Merged
asukaminato0721 merged 3 commits intolanggenius:mainfrom
wdeveloper16:test/testcontainers-rag-pipeline-service-db-operations
Apr 11, 2026
Merged

test: migrate RagPipelineService DB operation SQL tests to Testcontainer#34959
asukaminato0721 merged 3 commits intolanggenius:mainfrom
wdeveloper16:test/testcontainers-rag-pipeline-service-db-operations

Conversation

@wdeveloper16
Copy link
Copy Markdown
Contributor

Summary

Migrates SQL-patched unit tests to real PostgreSQL integration tests using Testcontainers.

  • Removes 6 tests from unit_tests/services/rag_pipeline/test_rag_pipeline_service.py that patched db.session.scalar, db.session.delete, and db.session.commit:
    • test_get_pipeline_raises_when_dataset_not_found
    • test_update_customized_pipeline_template_success
    • test_update_customized_pipeline_template_not_found
    • test_update_customized_pipeline_template_duplicate_name
    • test_delete_customized_pipeline_template_success
    • test_delete_customized_pipeline_template_not_found
  • Removes now-unused IconInfo and PipelineTemplateInfoEntity imports from the unit test file
  • Adds test_containers_integration_tests/services/rag_pipeline/test_rag_pipeline_service_db.py with real Dataset, Pipeline, and PipelineCustomizedTemplate rows

File 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

  • New integration tests pass: get_pipeline lookups, template update (success + not-found + duplicate name), template delete (success + not-found)
  • Remaining unit tests in test_rag_pipeline_service.py still pass (sync_draft_workflow, template retrieval, etc.)
  • No db.session scalar/delete/commit patches remain for the migrated methods

Closes part of #32454.

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Apr 11, 2026
@asukaminato0721 asukaminato0721 requested a review from Copilot April 11, 2026 15:04
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 for get_pipeline, update_customized_pipeline_template, and delete_customized_pipeline_template.
  • Added new Testcontainers-backed integration test module covering those DB operations with real Dataset, Pipeline, and PipelineCustomizedTemplate rows.
  • 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.

@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

@wdeveloper16 wdeveloper16 force-pushed the test/testcontainers-rag-pipeline-service-db-operations branch from 3da35fd to 3c8668e Compare April 11, 2026 15:41
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

@wdeveloper16
Copy link
Copy Markdown
Contributor Author

Hi, @asukaminato0721
Could you please review this?

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Apr 11, 2026
@asukaminato0721 asukaminato0721 added this pull request to the merge queue Apr 11, 2026
Merged via the queue into langgenius:main with commit 34ce3ca Apr 11, 2026
28 checks passed
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants