mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-04 16:09:05 +00:00
### **PR Type**
Tests
___
### **Description**
- Add regression tests for substr subqueries
- Validate env flags causing Utf8View panic
- Add alternative query pattern coverage
- Verify data content and string functions
___
### Diagram Walkthrough
```mermaid
flowchart LR
A["Env flags set via monkeypatch"] -- "enable JOIN_MATCH_ONE, UTF8_VIEW" --> B["Execute queries against stream_pytest_data"]
B -- "substr + IN subquery" --> C["Assert 200, validate hits"]
B -- "alternative IN/JOIN/CONCAT/length" --> D["Cross-validate no Utf8View error"]
B -- "data verification" --> E["Inspect container names/prefixes"]
```
<details> <summary><h3> File Walkthrough</h3></summary>
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Tests</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>test_subquery_join_match.py</strong><dd><code>Add
regression and coverage tests for substr subqueries</code>
</dd></summary>
<hr>
tests/api-testing/tests/test_subquery_join_match.py
<ul><li>Add end-to-end regression tests reproducing Utf8View panic<br>
<li> Set env vars via monkeypatch for failing conditions<br> <li> Cover
substr IN, JOIN, CONCAT, and length() variants<br> <li> Add data
verification and structural assertions on hits</ul>
</details>
</td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8818/files#diff-facac795b55980509f22b59fec9090910a8eb2c8d442936114c4b11f11008152">+564/-0</a>
</td>
</tr>
</table></td></tr></tr></tbody></table>
</details>
___
160 lines
5.2 KiB
YAML
160 lines
5.2 KiB
YAML
name: API Integration Test
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "main"
|
|
paths-ignore:
|
|
- "**.md"
|
|
- "**.yml"
|
|
- "**.yaml"
|
|
pull_request:
|
|
branches:
|
|
- "*"
|
|
paths-ignore:
|
|
- "**.md"
|
|
- "**.yml"
|
|
- "**.yaml"
|
|
|
|
env:
|
|
COLUMNS: 150
|
|
ZO_ROOT_USER_EMAIL: root@example.com
|
|
ZO_ROOT_USER_PASSWORD: Complexpass#123
|
|
ZO_BASE_URL: http://localhost:5080/
|
|
ZO_BASE_URL_SC: http://localhost:5080/
|
|
WS_ZO_BASE_URL: ws://localhost:5080/
|
|
ZO_SMTP_ENABLED: true
|
|
ZO_CREATE_ORG_THROUGH_INGESTION: true
|
|
|
|
jobs:
|
|
api_integration_tests:
|
|
name: api_integration_tests
|
|
runs-on: ubicloud-standard-8
|
|
steps:
|
|
- name: Remove unused tools
|
|
run: |
|
|
sudo rm -rf /usr/share/dotnet
|
|
sudo rm -rf /opt/ghc
|
|
sudo rm -rf "/usr/local/share/boost"
|
|
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
|
|
|
|
- name: Checkout git repo
|
|
uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Check if API code has changes
|
|
id: check_changes
|
|
run: |
|
|
if [ -n "${{ github.event.before }}" ]; then
|
|
if git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -qE '^src/|^Cargo\.(toml|lock)$|^tests/'; then
|
|
echo "has_changes=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "has_changes=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
else
|
|
# For new branches or when before is unavailable, check against base branch
|
|
if git diff --name-only origin/${{ github.base_ref || 'main' }} ${{ github.sha }} | grep -qE '^src/|^Cargo\.(toml|lock)$|^tests/'; then
|
|
echo "has_changes=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "has_changes=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
fi
|
|
|
|
- name: Setup Rust Toolchain
|
|
if: steps.check_changes.outputs.has_changes == 'true'
|
|
uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: nightly-2025-07-20
|
|
|
|
- name: Setup Rust Cache
|
|
if: steps.check_changes.outputs.has_changes == 'true'
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
cache-on-failure: true
|
|
prefix-key: api-testing
|
|
|
|
- name: Install Protoc
|
|
if: steps.check_changes.outputs.has_changes == 'true'
|
|
uses: arduino/setup-protoc@v3
|
|
with:
|
|
version: "21.12"
|
|
|
|
- name: Build OpenObserve debug binary
|
|
if: steps.check_changes.outputs.has_changes == 'true'
|
|
run: cargo build --features mimalloc
|
|
|
|
- name: Setup Python
|
|
if: steps.check_changes.outputs.has_changes == 'true'
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.11.6"
|
|
|
|
- name: Setup rye
|
|
if: steps.check_changes.outputs.has_changes == 'true'
|
|
uses: eifinger/setup-rye@v4
|
|
with:
|
|
enable-cache: true
|
|
working-directory: "tests/api-testing/"
|
|
version: "0.27.0"
|
|
|
|
- name: Start OpenObserve
|
|
if: steps.check_changes.outputs.has_changes == 'true'
|
|
run: target/debug/openobserve &
|
|
|
|
- name: Wait for start
|
|
if: steps.check_changes.outputs.has_changes == 'true'
|
|
run: sleep 15
|
|
|
|
- name: Pin cpython
|
|
if: steps.check_changes.outputs.has_changes == 'true'
|
|
run: rye pin cpython@3.11.6
|
|
working-directory: tests/api-testing/
|
|
|
|
- name: Rye sync
|
|
if: steps.check_changes.outputs.has_changes == 'true'
|
|
run: rye sync
|
|
working-directory: tests/api-testing/
|
|
|
|
- name: Run tests
|
|
if: steps.check_changes.outputs.has_changes == 'true'
|
|
run: |
|
|
echo "=== Running regression tests with ZO_UTF8_VIEW_ENABLED=false ==="
|
|
ZO_FEATURE_JOIN_MATCH_ONE_ENABLED=true ZO_UTF8_VIEW_ENABLED=false target/debug/openobserve > o2_utf8_false.log 2>&1 &
|
|
SERVER_PID_FALSE=$!
|
|
echo "OpenObserve PID for UTF8_VIEW=false: $SERVER_PID_FALSE"
|
|
sleep 15
|
|
|
|
# Run regression tests with UTF8_VIEW=false
|
|
rye run pytest tests/test_subquery_join_match.py --force-sugar -v
|
|
|
|
# Kill the server
|
|
kill $SERVER_PID_FALSE || true
|
|
sleep 5
|
|
|
|
echo "=== Running regression tests with ZO_UTF8_VIEW_ENABLED=true ==="
|
|
ZO_FEATURE_JOIN_MATCH_ONE_ENABLED=true ZO_UTF8_VIEW_ENABLED=true target/debug/openobserve > o2_utf8_true.log 2>&1 &
|
|
SERVER_PID_TRUE=$!
|
|
echo "OpenObserve PID for UTF8_VIEW=true: $SERVER_PID_TRUE"
|
|
sleep 15
|
|
|
|
# Run regression tests with UTF8_VIEW=true
|
|
rye run pytest tests/test_subquery_join_match.py --force-sugar -v
|
|
|
|
# Kill the server
|
|
kill $SERVER_PID_TRUE || true
|
|
sleep 5
|
|
|
|
echo "=== Running all other API tests with default settings ==="
|
|
target/debug/openobserve > o2_default.log 2>&1 &
|
|
SERVER_PID_DEFAULT=$!
|
|
echo "OpenObserve PID for other tests: $SERVER_PID_DEFAULT"
|
|
sleep 15
|
|
|
|
# Run all other tests (excluding regression tests)
|
|
rye run pytest --ignore=tests/test_subquery_join_match.py --force-sugar
|
|
|
|
# Kill the server
|
|
kill $SERVER_PID_DEFAULT || true
|
|
working-directory: tests/api-testing/
|