|
45 | 45 | - 'packages/opencode/src/altimate/native/connections/**' |
46 | 46 | - 'packages/opencode/test/altimate/drivers-e2e.test.ts' |
47 | 47 | - 'packages/opencode/test/altimate/drivers-docker-e2e.test.ts' |
| 48 | + - 'packages/opencode/test/altimate/drivers-mongodb-e2e.test.ts' |
48 | 49 | - 'packages/opencode/test/altimate/connections.test.ts' |
49 | 50 | dbt-tools: |
50 | 51 | - 'packages/dbt-tools/**' |
@@ -83,13 +84,45 @@ jobs: |
83 | 84 | run: bun install |
84 | 85 |
|
85 | 86 | - name: Run tests |
86 | | - run: bun test --timeout 30000 |
87 | 87 | working-directory: packages/opencode |
88 | 88 | # Cloud E2E tests (Snowflake, BigQuery, Databricks) auto-skip when |
89 | 89 | # ALTIMATE_CODE_CONN_* env vars are not set. Docker E2E tests auto-skip |
90 | 90 | # when Docker is not available. No exclusion needed — skipIf handles it. |
91 | 91 | # --timeout 30000: matches package.json "test" script; prevents 5s default |
92 | 92 | # from cutting off tests that run bun install or bootstrap git instances. |
| 93 | + # |
| 94 | + # Bun 1.3.x has a known segfault during process cleanup after all tests |
| 95 | + # pass (exit code 143/SIGTERM or 134/SIGABRT). We capture test output and |
| 96 | + # check for real failures vs Bun crashes to avoid false CI failures. |
| 97 | + shell: bash |
| 98 | + run: | |
| 99 | + # Redirect bun output to file, then cat it for CI visibility. |
| 100 | + # This avoids tee/pipe issues where SIGTERM kills tee before flush. |
| 101 | + bun test --timeout 30000 > /tmp/test-output.txt 2>&1 || true |
| 102 | + cat /tmp/test-output.txt |
| 103 | +
|
| 104 | + # Extract pass/fail counts from Bun test summary (e.g., " 5362 pass") |
| 105 | + PASS_COUNT=$(awk '/^ *[0-9]+ pass$/{print $1}' /tmp/test-output.txt || true) |
| 106 | + FAIL_COUNT=$(awk '/^ *[0-9]+ fail$/{print $1}' /tmp/test-output.txt || true) |
| 107 | +
|
| 108 | + echo "" |
| 109 | + echo "--- Test Summary ---" |
| 110 | + echo "pass=${PASS_COUNT:-none} fail=${FAIL_COUNT:-none}" |
| 111 | +
|
| 112 | + # Real test failures — always fail CI |
| 113 | + if [ -n "$FAIL_COUNT" ] && [ "$FAIL_COUNT" != "0" ]; then |
| 114 | + echo "::error::$FAIL_COUNT test(s) failed" |
| 115 | + exit 1 |
| 116 | + fi |
| 117 | +
|
| 118 | + # Tests passed (we have a pass count and zero/no failures) |
| 119 | + if [ -n "$PASS_COUNT" ] && [ "$PASS_COUNT" -gt 0 ] 2>/dev/null; then |
| 120 | + exit 0 |
| 121 | + fi |
| 122 | +
|
| 123 | + # No test summary at all — Bun crashed before running tests |
| 124 | + echo "::error::No test results found in output — Bun may have crashed before running tests" |
| 125 | + exit 1 |
93 | 126 |
|
94 | 127 | # --------------------------------------------------------------------------- |
95 | 128 | # Driver E2E tests — only when driver code changes. |
@@ -155,6 +188,16 @@ jobs: |
155 | 188 | --health-timeout 5s |
156 | 189 | --health-retries 10 |
157 | 190 |
|
| 191 | + mongodb: |
| 192 | + image: mongo:7.0 |
| 193 | + ports: |
| 194 | + - 27017:27017 |
| 195 | + options: >- |
| 196 | + --health-cmd "mongosh --eval 'db.runCommand({ping:1})' --quiet" |
| 197 | + --health-interval 5s |
| 198 | + --health-timeout 5s |
| 199 | + --health-retries 10 |
| 200 | +
|
158 | 201 | steps: |
159 | 202 | - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
160 | 203 |
|
@@ -195,6 +238,13 @@ jobs: |
195 | 238 | TEST_REDSHIFT_PORT: "15439" |
196 | 239 | TEST_REDSHIFT_PASSWORD: testpass123 |
197 | 240 |
|
| 241 | + - name: Run MongoDB driver E2E |
| 242 | + run: bun test test/altimate/drivers-mongodb-e2e.test.ts |
| 243 | + working-directory: packages/opencode |
| 244 | + env: |
| 245 | + TEST_MONGODB_HOST: 127.0.0.1 |
| 246 | + TEST_MONGODB_PORT: "27017" |
| 247 | + |
198 | 248 | # Cloud tests NOT included — they require real credentials |
199 | 249 | # Run locally with: |
200 | 250 | # ALTIMATE_CODE_CONN_SNOWFLAKE_TEST='...' bun test test/altimate/drivers-snowflake-e2e.test.ts |
|
0 commit comments