Skip to content

feat: add StarRocks as a compatibility-tested database#317

Open
driessamyn wants to merge 1 commit into
mainfrom
feature/add-starrocks-compat
Open

feat: add StarRocks as a compatibility-tested database#317
driessamyn wants to merge 1 commit into
mainfrom
feature/add-starrocks-compat

Conversation

@driessamyn
Copy link
Copy Markdown
Owner

@driessamyn driessamyn commented Mar 23, 2026

Summary

  • Adds StarRocks compatibility testing (MySQL wire-compatible, analytical DB)
  • Uses GenericContainer with starrocks/allin1-ubuntu:latest, polls for backend readiness
  • Custom CREATE TABLE syntax with PRIMARY KEY and DISTRIBUTED BY HASH
  • Skips rollback and types tests (upsert semantics, limited SQL type support)
  • Added to nightly compatibility-test CI matrix

Test plan

  • Integration tests pass locally with -Ddb=STARROCKS
  • CI compatibility-test job runs successfully

Summary by CodeRabbit

  • New Features

    • Added StarRocks support with container-based integration testing and DB flavor detection.
  • Tests

    • Extended compatibility matrix to run integration tests against StarRocks.
    • Skipped or adjusted specific tests and setup when running on StarRocks due to platform-specific DDL/behavior.
  • Documentation

    • Updated supported databases list to include a StarRocks badge.

@sonarqubecloud
Copy link
Copy Markdown

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 23, 2026

📝 Walkthrough

Walkthrough

Adds StarRocks support: expands CI compatibility matrix, adds StarRocks testcontainer and DB-specific table DDL, updates DB flavour detection to treat StarRocks as MySQL, and conditionally skips tests incompatible with StarRocks upsert/PRIMARY KEY semantics.

Changes

Cohort / File(s) Summary
CI & Documentation
.github/workflows/build-and-test.yml, README.md
Expanded compatibility-test matrix to include STARROCKS and added a StarRocks badge to README. Artifact upload and test check names now run per DB matrix entry.
Test Infrastructure Setup
core/src/integrationTest/kotlin/net/samyn/kapper/AbstractDbTests.kt
Added a lazily-started StarRocks GenericContainer (starrocks/allin1-ubuntu:latest, port 9030), wait/poll logic (SHOW BACKENDS) until a backend is alive, create test database, and updated setupDatabase(connection, dbKey) to emit StarRocks-specific CREATE TABLE (DISTRIBUTED BY HASH(id) BUCKETS 1) when dbKey == "STARROCKS".
Conditional Test Skips
core/src/integrationTest/kotlin/net/samyn/kapper/ExecuteDtoTests.kt, core/src/integrationTest/kotlin/net/samyn/kapper/ExecuteTests.kt, core/src/integrationTest/kotlin/net/samyn/kapper/TypesTest.kt
Added assumeFalse guards to skip tests that rely on PRIMARY KEY/upsert semantics under StarRocks. Adjusted TypesTest.setupDatabase signature to accept dbKey and return early for StarRocks.
Database Detection & Tests
core/src/main/kotlin/net/samyn/kapper/internal/DbFlavourFunc.kt, core/src/test/kotlin/net/samyn/kapper/internal/DbFlavourTest.kt
getDbFlavour() now treats product names containing "starrocks" as DbFlavour.MYSQL. Added "StarRocks" to parameterized test inputs.

Sequence Diagram(s)

sequenceDiagram
    participant GH as GitHub Actions (matrix job)
    participant TC as Test Runner (Gradle/integrationTest)
    participant C as Testcontainers Manager
    participant SR as StarRocks Container
    participant JDBC as JDBC Connection
    GH->>TC: run ./gradlew integrationTest -Ddb=STARROCKS
    TC->>C: start StarRocks GenericContainer
    C->>SR: launch container (port 9030)
    C->>SR: execute "SHOW BACKENDS" (poll)
    SR-->>C: backend status (Alive)
    C->>JDBC: create database `test`
    TC->>JDBC: open JDBC connection to `test` db
    TC->>JDBC: run integration tests (DDL, queries)
    TC->>GH: upload artifact (STARROCKS-compat-test-results)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

run-compat-tests

Poem

🐰 A rocky star now hops in sight,
I start a container through the night,
I poll the backends till one says "live",
Create a test DB, watch queries thrive,
Hooray—new DB joins our test flight!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main objective: adding StarRocks as a compatibility-tested database. It is specific, concise, and clearly reflects the primary change across the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/add-starrocks-compat

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 23, 2026

Unit Tests

0 files   -  61  0 suites   - 61   0s ⏱️ - 3m 2s
0 tests  - 517  0 ✅  - 517  0 💤 ±0  0 ❌ ±0 
0 runs   - 533  0 ✅  - 533  0 💤 ±0  0 ❌ ±0 

Results for commit 4d7ef5d. ± Comparison against base commit c431fe4.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown

Code Coverage

File Coverage [100.00%]
core/src/main/kotlin/net/samyn/kapper/internal/DbFlavourFunc.kt 100.00%
Total Project Coverage 98.17%

@github-actions
Copy link
Copy Markdown

SQLITE Integration Tests

10 files  ±0  10 suites  ±0   25s ⏱️ -3s
46 tests ±0  46 ✅ ±0  0 💤 ±0  0 ❌ ±0 
76 runs  ±0  76 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit b5bfb1b. ± Comparison against base commit c431fe4.

@github-actions
Copy link
Copy Markdown

DUCKDB Integration Tests

10 files  ±0  10 suites  ±0   27s ⏱️ +3s
46 tests ±0  46 ✅ ±0  0 💤 ±0  0 ❌ ±0 
76 runs  ±0  76 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit b5bfb1b. ± Comparison against base commit c431fe4.

@github-actions
Copy link
Copy Markdown

POSTGRESQL Integration Tests

10 files  ±0  10 suites  ±0   28s ⏱️ -1s
46 tests ±0  46 ✅ ±0  0 💤 ±0  0 ❌ ±0 
76 runs  ±0  76 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit b5bfb1b. ± Comparison against base commit c431fe4.

@github-actions
Copy link
Copy Markdown

MSSQLSERVER Integration Tests

10 files  ±0  10 suites  ±0   44s ⏱️ -1s
46 tests ±0  46 ✅ ±0  0 💤 ±0  0 ❌ ±0 
76 runs  ±0  76 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit b5bfb1b. ± Comparison against base commit c431fe4.

@github-actions
Copy link
Copy Markdown

MYSQL Integration Tests

10 files  ±0  10 suites  ±0   46s ⏱️ -1s
46 tests ±0  46 ✅ ±0  0 💤 ±0  0 ❌ ±0 
76 runs  ±0  76 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit b5bfb1b. ± Comparison against base commit c431fe4.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
core/src/integrationTest/kotlin/net/samyn/kapper/AbstractDbTests.kt (1)

62-62: Consider pinning the StarRocks container image version.

Using starrocks/allin1-ubuntu:latest makes builds non-reproducible. A breaking change in a new StarRocks release could cause CI failures that are difficult to diagnose. Consider pinning to a specific version (e.g., starrocks/allin1-ubuntu:3.2.4) similar to how other containers in this file use explicit versions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@core/src/integrationTest/kotlin/net/samyn/kapper/AbstractDbTests.kt` at line
62, Replace the floating StarRocks image tag used in the GenericContainer
constructor to a pinned version to make integration tests reproducible; locate
the GenericContainer("starrocks/allin1-ubuntu:latest") instantiation and change
the image string to a specific release (for example
"starrocks/allin1-ubuntu:3.2.4" or another tested version) so the container
image is versioned consistently with other containers in this test suite.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@core/src/integrationTest/kotlin/net/samyn/kapper/AbstractDbTests.kt`:
- Around line 98-119: The polling loop in AbstractDbTests.kt leaks a ResultSet
from stmt.executeQuery("SHOW BACKENDS") inside the STARROCKS block; ensure the
ResultSet is closed by using its closeable semantics (e.g., call use on the
ResultSet returned by executeQuery or explicitly close it in a finally) within
the existing bootstrapConn.createStatement().use { ... } so the ResultSet is
closed each iteration after checking rs.next() and rs.getBoolean("Alive").

In `@README.md`:
- Line 25: Update the README badge markdown: remove the nonexistent logo
parameter from the StarRocks shields.io badge URL in the image line (the
markdown starting with
"![StarRocks](https://img.shields.io/badge/starrocks-5C2D91.svg?style=for-the-badge&logo=starrocks&logoColor=white)")
by deleting "&logo=starrocks" so the URL becomes the badge without the logo
parameter (leaving "&logoColor=white" if desired).

---

Nitpick comments:
In `@core/src/integrationTest/kotlin/net/samyn/kapper/AbstractDbTests.kt`:
- Line 62: Replace the floating StarRocks image tag used in the GenericContainer
constructor to a pinned version to make integration tests reproducible; locate
the GenericContainer("starrocks/allin1-ubuntu:latest") instantiation and change
the image string to a specific release (for example
"starrocks/allin1-ubuntu:3.2.4" or another tested version) so the container
image is versioned consistently with other containers in this test suite.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8d60ddcd-0945-40fb-8517-bdb71dd99375

📥 Commits

Reviewing files that changed from the base of the PR and between c431fe4 and b5bfb1b.

📒 Files selected for processing (8)
  • .github/workflows/build-and-test.yml
  • README.md
  • core/src/integrationTest/kotlin/net/samyn/kapper/AbstractDbTests.kt
  • core/src/integrationTest/kotlin/net/samyn/kapper/ExecuteDtoTests.kt
  • core/src/integrationTest/kotlin/net/samyn/kapper/ExecuteTests.kt
  • core/src/integrationTest/kotlin/net/samyn/kapper/TypesTest.kt
  • core/src/main/kotlin/net/samyn/kapper/internal/DbFlavourFunc.kt
  • core/src/test/kotlin/net/samyn/kapper/internal/DbFlavourTest.kt

Comment thread core/src/integrationTest/kotlin/net/samyn/kapper/AbstractDbTests.kt
Comment thread README.md Outdated
@github-actions
Copy link
Copy Markdown

ORACLE Integration Tests

10 files  ±0  10 suites  ±0   1m 19s ⏱️ -2s
46 tests ±0  46 ✅ ±0  0 💤 ±0  0 ❌ ±0 
76 runs  ±0  76 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit b5bfb1b. ± Comparison against base commit c431fe4.

@driessamyn driessamyn force-pushed the feature/add-starrocks-compat branch from b5bfb1b to 4d7ef5d Compare March 24, 2026 07:34
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
core/src/integrationTest/kotlin/net/samyn/kapper/TypesTest.kt (1)

59-62: Consider extracting the StarRocks check to a reusable helper.

The System.getProperty("db", "").trim().uppercase() == "STARROCKS" pattern is duplicated across multiple test files. Extracting this to a shared utility (e.g., isStarRocks() in AbstractDbTests) would improve maintainability and reduce repetition.

♻️ Suggested helper in AbstractDbTests
protected fun isStarRocks(): Boolean =
    System.getProperty("db", "").trim().uppercase() == "STARROCKS"

Then in tests:

-assumeFalse(
-    System.getProperty("db", "").trim().uppercase() == "STARROCKS",
-    "StarRocks does not support all SQL types tested here",
-)
+assumeFalse(isStarRocks(), "StarRocks does not support all SQL types tested here")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@core/src/integrationTest/kotlin/net/samyn/kapper/TypesTest.kt` around lines
59 - 62, Extract the repeated StarRocks check into a protected helper on
AbstractDbTests and replace inline usages in tests (like the assumeFalse call in
TypesTest) with that helper; add a method named isStarRocks() on AbstractDbTests
that returns the boolean from System.getProperty("db", "").trim().uppercase() ==
"STARROCKS", then change the assumeFalse call in TypesTest (and other tests) to
assumeFalse(isStarRocks(), "StarRocks does not support all SQL types tested
here").
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@core/src/integrationTest/kotlin/net/samyn/kapper/TypesTest.kt`:
- Around line 59-62: Extract the repeated StarRocks check into a protected
helper on AbstractDbTests and replace inline usages in tests (like the
assumeFalse call in TypesTest) with that helper; add a method named
isStarRocks() on AbstractDbTests that returns the boolean from
System.getProperty("db", "").trim().uppercase() == "STARROCKS", then change the
assumeFalse call in TypesTest (and other tests) to assumeFalse(isStarRocks(),
"StarRocks does not support all SQL types tested here").

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 94b6a54b-d363-4a08-8bcd-22f255d2dc16

📥 Commits

Reviewing files that changed from the base of the PR and between b5bfb1b and 4d7ef5d.

📒 Files selected for processing (8)
  • .github/workflows/build-and-test.yml
  • README.md
  • core/src/integrationTest/kotlin/net/samyn/kapper/AbstractDbTests.kt
  • core/src/integrationTest/kotlin/net/samyn/kapper/ExecuteDtoTests.kt
  • core/src/integrationTest/kotlin/net/samyn/kapper/ExecuteTests.kt
  • core/src/integrationTest/kotlin/net/samyn/kapper/TypesTest.kt
  • core/src/main/kotlin/net/samyn/kapper/internal/DbFlavourFunc.kt
  • core/src/test/kotlin/net/samyn/kapper/internal/DbFlavourTest.kt
✅ Files skipped from review due to trivial changes (1)
  • README.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • core/src/main/kotlin/net/samyn/kapper/internal/DbFlavourFunc.kt
  • core/src/test/kotlin/net/samyn/kapper/internal/DbFlavourTest.kt
  • .github/workflows/build-and-test.yml
  • core/src/integrationTest/kotlin/net/samyn/kapper/AbstractDbTests.kt

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.

1 participant