mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-04 16:09:05 +00:00
## Summary
Companion PR to o2-enterprise PR 1841 (api-testing follow-ups). All
ENT-side test/CI work lands there; this OSS PR carries the two changes
that must live on the OSS side because they touch shared code.
Both PRs live on the same-named branch (`test/api-test-followups`) so
ENT CI's cp-merge picks up this branch and sees both changes together.
## What's in this PR
### 1 — Add `pytest-xdist` dependency
Adds `pytest-xdist>=3.0` to `tests/api-testing/pyproject.toml`. Needed
by the ENT api-testing CI's `api_integration / ent_rbac` shard to run
RBAC tests in parallel (`-n 4`).
CI-verified speedup: **~70 s → 21.7 s (~69% reduction)** on the ENT RBAC
shard's 280+ tests, with zero failures.
Foundation only — no test code in this repo uses xdist yet. Available
for any future shard that wants it.
### 2 — Standardize automated-test user display name to "Automation
TestUser"
Two helper files in `tests/api-testing/helpers/workflow/pages/` had a
personal name (`"Shyam P"` / `"Shyam Panjiyar"`) hardcoded in their user
/ service-account create payloads. Those helpers are consumed by the
workflow chain (`helpers/workflow/create_objects.py` +
`edit_objects.py`), which doesn't reliably clean up its created users —
so the names persisted in the IAM users page and looked confusingly like
real teammates' accounts.
Files changed:
- `tests/api-testing/helpers/workflow/pages/user_page.py`
- `tests/api-testing/helpers/workflow/pages/serviceaccount_page.py`
Both now use:
```
first_name: "Automation"
last_name: "TestUser"
```
Convention going forward: any account named `Automation TestUser` in the
IAM users page is automatically identifiable as test-created and safe to
clean up. Email addresses still use random suffixes
(`d4m21_{random_int}`) so uniqueness isn't affected — only the display
name standardizes.
## Test plan
- [ ] CI green on this branch
- [ ] Companion ENT PR 1841 (which depends on the `pytest-xdist` dep
added here) stays green
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
88 lines
2.8 KiB
TOML
88 lines
2.8 KiB
TOML
[project]
|
|
name = "pytest-openobserve"
|
|
version = "0.1.0"
|
|
authors = [
|
|
{ name="OpenObserve", email="info@openobserve.ai" },
|
|
]
|
|
description = "A pytest plugin for OpenObserve"
|
|
readme = "README.md"
|
|
requires-python = ">=3.8"
|
|
classifiers = [
|
|
"Programming Language :: Python :: 3",
|
|
"License :: OSI Approved :: MIT License",
|
|
"Operating System :: OS Independent",
|
|
]
|
|
dependencies = [
|
|
"pytest>=7.0",
|
|
"pytest-order>=1.1.1",
|
|
"pytest-sugar>=1.0.1",
|
|
"pytest-pretty>=1.2.0",
|
|
# pytest-xdist enables `-n <N>` parallel execution. Used by the ENT
|
|
# RBAC shard to halve wall time on its ~280-test serial run. Requires
|
|
# tests to use unique resource names (uuid4 suffixes, not just
|
|
# int(time.time())) — the rbac helper was updated accordingly.
|
|
"pytest-xdist>=3.0",
|
|
"requests>=2.31.0",
|
|
"ruff>=0.1.8",
|
|
"tink>=1.10.0",
|
|
"protobuf",
|
|
# Phase 5: schemathesis runs OpenAPI-spec-driven fuzz tests in its own
|
|
# CI job (api_fuzz_tests). Looks for 5xx panics across the 150 endpoints
|
|
# OO exposes at /api-doc/openapi.json.
|
|
"schemathesis>=3.27",
|
|
]
|
|
|
|
[build-system]
|
|
requires = ["hatchling"]
|
|
build-backend = "hatchling.build"
|
|
|
|
[tool.rye]
|
|
managed = true
|
|
dev-dependencies = [
|
|
"ruff>=0.1.8",
|
|
]
|
|
|
|
[tool.hatch.metadata]
|
|
allow-direct-references = true
|
|
|
|
[tool.hatch.build.targets.wheel]
|
|
packages = ["src/main"]
|
|
|
|
[project.urls]
|
|
"Homepage" = "https://github.com/openobserve/openobserve"
|
|
"Bug Tracker" = "https://github.com/openobserve/openobserve/issues"
|
|
|
|
[tool.pytest.ini_options]
|
|
pythonpath = ["."]
|
|
markers = [
|
|
"order: mark test to run in a specific order",
|
|
"framework: self-tests for the support/ framework (Phase 2)",
|
|
]
|
|
|
|
[tool.ruff]
|
|
line-length = 120
|
|
target-version = "py311"
|
|
|
|
[tool.ruff.lint]
|
|
# Phase 2 baseline: prevent the patterns the rework set out to kill.
|
|
# We are intentionally aggressive only in NEW code paths (support/, new tests/).
|
|
# Legacy tests still violate these — enforce on changed files in CI, not all-at-once.
|
|
select = [
|
|
"E", "F", "W", # pyflakes + pycodestyle baseline
|
|
"T20", # T201: no `print()`; T203: no `pprint`
|
|
"PT", # pytest-style
|
|
"B", # bugbear (common bug patterns)
|
|
"UP", # pyupgrade (modern syntax)
|
|
]
|
|
ignore = [
|
|
"E501", # line length handled by formatter
|
|
"E402", # module-level imports not at top (some test files structure their code this way)
|
|
"B008", # function-call-in-default-argument (some factories use it intentionally)
|
|
]
|
|
|
|
[tool.ruff.lint.per-file-ignores]
|
|
# helpers/workflow/ is legacy code waiting for Phase 4 rewrite — keep ruff quiet there.
|
|
"helpers/workflow/**/*.py" = ["T201", "F401", "F841", "E712", "B"]
|
|
# Existing tests are noisy with print(); Phase 3 will sweep. Until then, only WARN.
|
|
"tests/test_*.py" = ["T201"]
|