Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 29, 2025

Adds end-to-end integration tests for the ETL pipeline using testcontainers to validate database extraction, streaming, and error handling.

Changes

Dependencies (build.sbt)

  • testcontainers-scala-scalatest 0.41.4
  • testcontainers-scala-postgresql 0.41.4
  • cats-effect-testing-scalatest 1.5.0

Integration Test Suite (EtlPipelineIntegrationSpec.scala)

  • PostgreSQL extraction with 10-record validation
  • Empty result set handling
  • Batch streaming verification (configurable batch size)
  • Uses PostgreSQL testcontainer for isolated testing
  • AsyncIOSpec for proper Cats Effect IO testing

Documentation

  • Added integration test section to README with Docker requirement
  • Updated PROJECT_SUMMARY with test counts and current dependency versions

Example

"EtlPipeline" should "successfully extract data from PostgreSQL" in {
  withContainers { postgres =>
    (for {
      _ <- setupTestData(postgres)
      config = createTestConfig(postgres)
      _ <- DatabaseConnection.createTransactor[IO](config.database).use { xa =>
        for {
          data <- DataRepository[IO](xa)
            .streamData(config.etl.query, config.etl.batchSize)
            .compile.toList
          _ <- IO {
            data.size should be(10)
            data.head.name shouldBe "Product A"
          }
        } yield succeed
      }
    } yield succeed).unsafeToFuture()
  }
}

Test Results: 9 tests passing (6 unit + 3 integration)

Original prompt

This section details on the original issue you should resolve

<issue_title>Add integration tests using testcontainers</issue_title>
<issue_description>* use testcontainers scala</issue_description>

<agent_instructions>Test end 2 end application logic using testcontainers-scala.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Dec 29, 2025
Copilot AI and others added 3 commits December 29, 2025 12:57
Co-authored-by: akreit <64101884+akreit@users.noreply.github.com>
Co-authored-by: akreit <64101884+akreit@users.noreply.github.com>
Co-authored-by: akreit <64101884+akreit@users.noreply.github.com>
Copilot AI changed the title [WIP] Add integration tests using testcontainers Add integration tests using testcontainers-scala Dec 29, 2025
Copilot AI requested a review from akreit December 29, 2025 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add integration tests using testcontainers

2 participants