Compare commits

...
3 changed files with 319 additions and 104 deletions

No files matched your search

+83 -15
View File
@@ -105,9 +105,8 @@ jobs:
fail-fast: false
matrix:
suite:
# contract & locks
- apiContract
- apiLocks
# contractAndLock — parallel: 2 isolated OCIS instances (slot 0 :9200, slot 1 :9500)
- "apiContract,apiLocks"
# settings & notifications (needs email)
- apiSettings
- apiNotification
@@ -216,7 +215,16 @@ jobs:
composer --version
- name: Run ${{ matrix.suite }}
run: BEHAT_SUITES=${{ matrix.suite }} python3 tests/acceptance/run-github.py
run: |
vmstat 2 > /tmp/vmstat.log & MONITOR_PID=$!
BEHAT_SUITES="${{ matrix.suite }}" python3 tests/acceptance/run-github.py
EXIT=$?
kill $MONITOR_PID 2>/dev/null; wait $MONITOR_PID 2>/dev/null || true
awk '/^[ ]*[0-9]/ { busy=100-$15; sum_b+=busy; if(busy>pk_b)pk_b=busy;
sum_r+=$1; if($1>pk_r) pk_r=$1; sum_wa+=$16; n++ }
END { printf "=== load (2 vCPU): avg busy %d%% peak %d%% | avg runq %.0f peak %d | avg wa %d%%\n",
sum_b/n, pk_b, sum_r/n, pk_r, sum_wa/n }' /tmp/vmstat.log
exit $EXIT
cli-tests:
needs: [build-and-test]
@@ -252,7 +260,16 @@ jobs:
composer --version
- name: Run ${{ matrix.suite }}
run: BEHAT_SUITES="${{ matrix.suite }}" python3 tests/acceptance/run-github.py
run: |
vmstat 2 > /tmp/vmstat.log & MONITOR_PID=$!
BEHAT_SUITES="${{ matrix.suite }}" python3 tests/acceptance/run-github.py
EXIT=$?
kill $MONITOR_PID 2>/dev/null; wait $MONITOR_PID 2>/dev/null || true
awk '/^[ ]*[0-9]/ { busy=100-$15; sum_b+=busy; if(busy>pk_b)pk_b=busy;
sum_r+=$1; if($1>pk_r) pk_r=$1; sum_wa+=$16; n++ }
END { printf "=== load (2 vCPU): avg busy %d%% peak %d%% | avg runq %.0f peak %d | avg wa %d%%\n",
sum_b/n, pk_b, sum_r/n, pk_r, sum_wa/n }' /tmp/vmstat.log
exit $EXIT
core-api-tests:
name: ${{ matrix.suite }}
@@ -338,11 +355,17 @@ jobs:
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- name: Run ${{ matrix.suite }}
run: >
BEHAT_SUITES="${{ matrix.suite }}"
ACCEPTANCE_TEST_TYPE=core-api
WITH_REMOTE_PHP=true
python3 tests/acceptance/run-github.py
run: |
vmstat 2 > /tmp/vmstat.log & MONITOR_PID=$!
BEHAT_SUITES="${{ matrix.suite }}" ACCEPTANCE_TEST_TYPE=core-api WITH_REMOTE_PHP=true \
python3 tests/acceptance/run-github.py
EXIT=$?
kill $MONITOR_PID 2>/dev/null; wait $MONITOR_PID 2>/dev/null || true
awk '/^[ ]*[0-9]/ { busy=100-$15; sum_b+=busy; if(busy>pk_b)pk_b=busy;
sum_r+=$1; if($1>pk_r) pk_r=$1; sum_wa+=$16; n++ }
END { printf "=== load (2 vCPU): avg busy %d%% peak %d%% | avg runq %.0f peak %d | avg wa %d%%\n",
sum_b/n, pk_b, sum_r/n, pk_r, sum_wa/n }' /tmp/vmstat.log
exit $EXIT
e2e-tests:
name: e2e-${{ matrix.suite }}
@@ -449,7 +472,16 @@ jobs:
echo "keycloak ready."
- name: Run e2e-${{ matrix.suite }}
run: E2E_ARGS="${{ matrix.args }}" python3 tests/acceptance/run-e2e.py
run: |
vmstat 2 > /tmp/vmstat.log & MONITOR_PID=$!
E2E_ARGS="${{ matrix.args }}" python3 tests/acceptance/run-e2e.py
EXIT=$?
kill $MONITOR_PID 2>/dev/null; wait $MONITOR_PID 2>/dev/null || true
awk '/^[ ]*[0-9]/ { busy=100-$15; sum_b+=busy; if(busy>pk_b)pk_b=busy;
sum_r+=$1; if($1>pk_r) pk_r=$1; sum_wa+=$16; n++ }
END { printf "=== load (2 vCPU): avg busy %d%% peak %d%% | avg runq %.0f peak %d | avg wa %d%%\n",
sum_b/n, pk_b, sum_r/n, pk_r, sum_wa/n }' /tmp/vmstat.log
exit $EXIT
env:
TIKA_NEEDED: ${{ matrix.tika == true && 'true' || 'false' }}
KEYCLOAK_NEEDED: ${{ matrix.keycloak == true && 'true' || 'false' }}
@@ -465,7 +497,16 @@ jobs:
go-version-file: go.mod
cache: true
- name: Run litmus
run: python3 tests/acceptance/run-litmus.py
run: |
vmstat 2 > /tmp/vmstat.log & MONITOR_PID=$!
python3 tests/acceptance/run-litmus.py
EXIT=$?
kill $MONITOR_PID 2>/dev/null; wait $MONITOR_PID 2>/dev/null || true
awk '/^[ ]*[0-9]/ { busy=100-$15; sum_b+=busy; if(busy>pk_b)pk_b=busy;
sum_r+=$1; if($1>pk_r) pk_r=$1; sum_wa+=$16; n++ }
END { printf "=== load (2 vCPU): avg busy %d%% peak %d%% | avg runq %.0f peak %d | avg wa %d%%\n",
sum_b/n, pk_b, sum_r/n, pk_r, sum_wa/n }' /tmp/vmstat.log
exit $EXIT
cs3api:
name: cs3api
@@ -478,7 +519,16 @@ jobs:
go-version-file: go.mod
cache: true
- name: Run cs3api validator
run: python3 tests/acceptance/run-cs3api.py
run: |
vmstat 2 > /tmp/vmstat.log & MONITOR_PID=$!
python3 tests/acceptance/run-cs3api.py
EXIT=$?
kill $MONITOR_PID 2>/dev/null; wait $MONITOR_PID 2>/dev/null || true
awk '/^[ ]*[0-9]/ { busy=100-$15; sum_b+=busy; if(busy>pk_b)pk_b=busy;
sum_r+=$1; if($1>pk_r) pk_r=$1; sum_wa+=$16; n++ }
END { printf "=== load (2 vCPU): avg busy %d%% peak %d%% | avg runq %.0f peak %d | avg wa %d%%\n",
sum_b/n, pk_b, sum_r/n, pk_r, sum_wa/n }' /tmp/vmstat.log
exit $EXIT
wopi-builtin:
name: wopi-builtin
@@ -491,7 +541,16 @@ jobs:
go-version-file: go.mod
cache: true
- name: Run WOPI validator (builtin)
run: python3 tests/acceptance/run-wopi.py --type builtin
run: |
vmstat 2 > /tmp/vmstat.log & MONITOR_PID=$!
python3 tests/acceptance/run-wopi.py --type builtin
EXIT=$?
kill $MONITOR_PID 2>/dev/null; wait $MONITOR_PID 2>/dev/null || true
awk '/^[ ]*[0-9]/ { busy=100-$15; sum_b+=busy; if(busy>pk_b)pk_b=busy;
sum_r+=$1; if($1>pk_r) pk_r=$1; sum_wa+=$16; n++ }
END { printf "=== load (2 vCPU): avg busy %d%% peak %d%% | avg runq %.0f peak %d | avg wa %d%%\n",
sum_b/n, pk_b, sum_r/n, pk_r, sum_wa/n }' /tmp/vmstat.log
exit $EXIT
wopi-cs3:
name: wopi-cs3
@@ -504,7 +563,16 @@ jobs:
go-version-file: go.mod
cache: true
- name: Run WOPI validator (cs3)
run: python3 tests/acceptance/run-wopi.py --type cs3
run: |
vmstat 2 > /tmp/vmstat.log & MONITOR_PID=$!
python3 tests/acceptance/run-wopi.py --type cs3
EXIT=$?
kill $MONITOR_PID 2>/dev/null; wait $MONITOR_PID 2>/dev/null || true
awk '/^[ ]*[0-9]/ { busy=100-$15; sum_b+=busy; if(busy>pk_b)pk_b=busy;
sum_r+=$1; if($1>pk_r) pk_r=$1; sum_wa+=$16; n++ }
END { printf "=== load (2 vCPU): avg busy %d%% peak %d%% | avg runq %.0f peak %d | avg wa %d%%\n",
sum_b/n, pk_b, sum_r/n, pk_r, sum_wa/n }' /tmp/vmstat.log
exit $EXIT
all-acceptance-tests:
needs: [local-api-tests, cli-tests, core-api-tests, litmus, cs3api, wopi-builtin, wopi-cs3, e2e-tests]
+17 -12
View File
@@ -24,19 +24,24 @@ import json
import sys
def parse_json_stream(path):
with open(path) as f:
content = f.read()
decoder = json.JSONDecoder()
idx = 0
"""Parse a stream of JSON objects, skipping any non-JSON lines.
govulncheck -format json writes one JSON object per line, but stderr is
redirected into the same file (> TMPFILE 2>&1), so diagnostic messages
(e.g. "Running govulncheck...", error text) may appear between objects.
Skip those lines rather than crashing.
"""
objects = []
while idx < len(content):
while idx < len(content) and content[idx] in ' \t\n\r':
idx += 1
if idx >= len(content):
break
obj, end_idx = decoder.raw_decode(content, idx)
idx = end_idx
objects.append(obj)
with open(path) as f:
for line in f:
line = line.strip()
if not line:
continue
try:
objects.append(json.loads(line))
except json.JSONDecodeError:
# non-JSON diagnostic line — print for visibility, then ignore
print(f"[govulncheck non-JSON]: {line}", file=sys.stderr)
return objects
objects = parse_json_stream(sys.argv[1])
+219 -77
View File
@@ -8,12 +8,14 @@ Usage: BEHAT_SUITES=apiGraph python3 tests/acceptance/run-github.py
import json
import os
import re
import sys
import subprocess
import signal
import time
import tempfile
import shutil
from concurrent.futures import ThreadPoolExecutor, as_completed
from pathlib import Path
# ---------------------------------------------------------------------------
@@ -197,8 +199,35 @@ def merged_config(suites: list) -> dict:
return merged
def base_server_env(repo_root: Path, ocis_url: str, ocis_config_dir: str) -> dict:
def _apply_port_offset(env: dict, offset: int) -> dict:
"""Offset OCIS service ports (9100–9399) embedded in env values like '0.0.0.0:9174'."""
if offset == 0:
return env
result = {}
for k, v in env.items():
m = re.match(r'^(.*:)(\d{4,5})$', str(v))
if m:
port = int(m.group(2))
if 9100 <= port < 9500: # covers all OCIS ports incl. store (9460/9464)
v = m.group(1) + str(port + offset)
result[k] = v
return result
def _ocis_slot_dirs(slot: int):
"""Return (config_dir, data_dir) for the given isolation slot."""
if slot == 0:
return Path.home() / ".ocis" / "config", Path.home() / ".ocis"
return (Path.home() / f".ocis-slot-{slot}" / "config",
Path.home() / f".ocis-slot-{slot}")
def base_server_env(repo_root: Path, ocis_url: str, ocis_config_dir: str,
port_offset: int = 0) -> dict:
"""Base ocis server environment matching drone ocisServer() function."""
def p(base: int) -> str:
return str(base + port_offset)
return {
"OCIS_URL": ocis_url,
"OCIS_CONFIG_DIR": ocis_config_dir,
@@ -211,8 +240,9 @@ def base_server_env(repo_root: Path, ocis_url: str, ocis_config_dir: str) -> dic
"OCIS_ASYNC_UPLOADS": "true",
"OCIS_EVENTS_ENABLE_TLS": "false",
"NATS_NATS_HOST": "0.0.0.0",
"NATS_NATS_PORT": "9233",
"MICRO_REGISTRY_ADDRESS": "127.0.0.1:9233",
"NATS_NATS_PORT": p(9233),
"MICRO_REGISTRY_ADDRESS": f"127.0.0.1:{p(9233)}",
"OCIS_RUNTIME_PORT": p(9250),
"OCIS_JWT_SECRET": "some-ocis-jwt-secret",
"EVENTHISTORY_STORE": "memory",
"OCIS_TRANSLATION_PATH": str(repo_root / "tests/config/translations"),
@@ -221,42 +251,91 @@ def base_server_env(repo_root: Path, ocis_url: str, ocis_config_dir: str) -> dic
# default tika off (overridden by search2 extraServerEnvironment)
"SEARCH_EXTRACTOR_TYPE": "basic",
"FRONTEND_FULL_TEXT_SEARCH_ENABLED": "false",
# OCIS events endpoint (NATS) — each slot needs its own NATS port
"OCIS_EVENTS_ENDPOINT": f"127.0.0.1:{p(9233)}",
# LDAP (IDM) — each slot needs its own LDAP listener
"OCIS_LDAP_URI": f"ldaps://localhost:{p(9235)}",
"IDM_LDAPS_ADDR": f"0.0.0.0:{p(9235)}",
# proxy HTTP — must be set explicitly so each slot binds to its own port
"PROXY_HTTP_ADDR": f"0.0.0.0:{p(9200)}",
# gRPC listen addresses — ALL services; same port-block reasoning as debug addrs
"APP_PROVIDER_GRPC_ADDR": f"0.0.0.0:{p(9164)}",
"APP_REGISTRY_GRPC_ADDR": f"0.0.0.0:{p(9242)}",
"AUTH_BASIC_GRPC_ADDR": f"0.0.0.0:{p(9146)}",
"AUTH_MACHINE_GRPC_ADDR": f"0.0.0.0:{p(9166)}",
"AUTH_SERVICE_GRPC_ADDR": f"0.0.0.0:{p(9199)}",
"EVENTHISTORY_GRPC_ADDR": f"0.0.0.0:{p(9274)}",
"GATEWAY_GRPC_ADDR": f"0.0.0.0:{p(9142)}",
"GROUPS_GRPC_ADDR": f"0.0.0.0:{p(9160)}",
"SEARCH_GRPC_ADDR": f"0.0.0.0:{p(9220)}",
"SETTINGS_GRPC_ADDR": f"0.0.0.0:{p(9185)}",
"SHARING_GRPC_ADDR": f"0.0.0.0:{p(9150)}",
"STORAGE_PUBLICLINK_GRPC_ADDR": f"0.0.0.0:{p(9178)}",
"STORAGE_SHARES_GRPC_ADDR": f"0.0.0.0:{p(9154)}",
"STORAGE_SYSTEM_GRPC_ADDR": f"0.0.0.0:{p(9215)}",
"STORAGE_USERS_GRPC_ADDR": f"0.0.0.0:{p(9157)}",
"THUMBNAILS_GRPC_ADDR": f"0.0.0.0:{p(9191)}",
"USERS_GRPC_ADDR": f"0.0.0.0:{p(9144)}",
"STORE_GRPC_ADDR": f"0.0.0.0:{p(9460)}",
# HTTP listen addresses
"ACTIVITYLOG_HTTP_ADDR": f"0.0.0.0:{p(9195)}",
"FRONTEND_HTTP_ADDR": f"0.0.0.0:{p(9140)}",
"GRAPH_HTTP_ADDR": f"0.0.0.0:{p(9120)}",
"IDP_HTTP_ADDR": f"0.0.0.0:{p(9130)}",
"OCDAV_HTTP_ADDR": f"0.0.0.0:{p(9162)}",
"OCS_HTTP_ADDR": f"0.0.0.0:{p(9110)}",
"SETTINGS_HTTP_ADDR": f"0.0.0.0:{p(9186)}",
"SSE_HTTP_ADDR": f"0.0.0.0:{p(9132)}",
"STORAGE_SYSTEM_HTTP_ADDR": f"0.0.0.0:{p(9216)}",
"STORAGE_USERS_HTTP_ADDR": f"0.0.0.0:{p(9158)}",
"THUMBNAILS_HTTP_ADDR": f"0.0.0.0:{p(9190)}",
"USERLOG_HTTP_ADDR": f"0.0.0.0:{p(9211)}",
"WEB_HTTP_ADDR": f"0.0.0.0:{p(9100)}",
"WEBDAV_HTTP_ADDR": f"0.0.0.0:{p(9115)}",
"WEBFINGER_HTTP_ADDR": f"0.0.0.0:{p(9275)}",
# data server URLs — must reference the slot-specific HTTP port
"STORAGE_USERS_DATA_SERVER_URL": f"http://localhost:{p(9158)}/data",
"STORAGE_SYSTEM_DATA_SERVER_URL": f"http://localhost:{p(9216)}/data",
"THUMBNAILS_DATA_ENDPOINT": f"http://127.0.0.1:{p(9190)}/thumbnails/data",
# debug addresses
"ACTIVITYLOG_DEBUG_ADDR": "0.0.0.0:9197",
"APP_PROVIDER_DEBUG_ADDR": "0.0.0.0:9165",
"APP_REGISTRY_DEBUG_ADDR": "0.0.0.0:9243",
"AUTH_BASIC_DEBUG_ADDR": "0.0.0.0:9147",
"AUTH_MACHINE_DEBUG_ADDR": "0.0.0.0:9167",
"AUTH_SERVICE_DEBUG_ADDR": "0.0.0.0:9198",
"CLIENTLOG_DEBUG_ADDR": "0.0.0.0:9260",
"EVENTHISTORY_DEBUG_ADDR": "0.0.0.0:9270",
"FRONTEND_DEBUG_ADDR": "0.0.0.0:9141",
"GATEWAY_DEBUG_ADDR": "0.0.0.0:9143",
"GRAPH_DEBUG_ADDR": "0.0.0.0:9124",
"GROUPS_DEBUG_ADDR": "0.0.0.0:9161",
"IDM_DEBUG_ADDR": "0.0.0.0:9239",
"IDP_DEBUG_ADDR": "0.0.0.0:9134",
"INVITATIONS_DEBUG_ADDR": "0.0.0.0:9269",
"NATS_DEBUG_ADDR": "0.0.0.0:9234",
"OCDAV_DEBUG_ADDR": "0.0.0.0:9163",
"OCM_DEBUG_ADDR": "0.0.0.0:9281",
"OCS_DEBUG_ADDR": "0.0.0.0:9114",
"POSTPROCESSING_DEBUG_ADDR": "0.0.0.0:9255",
"PROXY_DEBUG_ADDR": "0.0.0.0:9205",
"SEARCH_DEBUG_ADDR": "0.0.0.0:9224",
"SETTINGS_DEBUG_ADDR": "0.0.0.0:9194",
"SHARING_DEBUG_ADDR": "0.0.0.0:9151",
"SSE_DEBUG_ADDR": "0.0.0.0:9139",
"STORAGE_PUBLICLINK_DEBUG_ADDR": "0.0.0.0:9179",
"STORAGE_SHARES_DEBUG_ADDR": "0.0.0.0:9156",
"STORAGE_SYSTEM_DEBUG_ADDR": "0.0.0.0:9217",
"STORAGE_USERS_DEBUG_ADDR": "0.0.0.0:9159",
"THUMBNAILS_DEBUG_ADDR": "0.0.0.0:9189",
"USERLOG_DEBUG_ADDR": "0.0.0.0:9214",
"USERS_DEBUG_ADDR": "0.0.0.0:9145",
"WEB_DEBUG_ADDR": "0.0.0.0:9104",
"WEBDAV_DEBUG_ADDR": "0.0.0.0:9119",
"WEBFINGER_DEBUG_ADDR": "0.0.0.0:9279",
"ACTIVITYLOG_DEBUG_ADDR": f"0.0.0.0:{p(9197)}",
"APP_PROVIDER_DEBUG_ADDR": f"0.0.0.0:{p(9165)}",
"APP_REGISTRY_DEBUG_ADDR": f"0.0.0.0:{p(9243)}",
"AUTH_BASIC_DEBUG_ADDR": f"0.0.0.0:{p(9147)}",
"AUTH_MACHINE_DEBUG_ADDR": f"0.0.0.0:{p(9167)}",
"AUTH_SERVICE_DEBUG_ADDR": f"0.0.0.0:{p(9198)}",
"CLIENTLOG_DEBUG_ADDR": f"0.0.0.0:{p(9260)}",
"EVENTHISTORY_DEBUG_ADDR": f"0.0.0.0:{p(9270)}",
"FRONTEND_DEBUG_ADDR": f"0.0.0.0:{p(9141)}",
"GATEWAY_DEBUG_ADDR": f"0.0.0.0:{p(9143)}",
"GRAPH_DEBUG_ADDR": f"0.0.0.0:{p(9124)}",
"GROUPS_DEBUG_ADDR": f"0.0.0.0:{p(9161)}",
"IDM_DEBUG_ADDR": f"0.0.0.0:{p(9239)}",
"IDP_DEBUG_ADDR": f"0.0.0.0:{p(9134)}",
"INVITATIONS_DEBUG_ADDR": f"0.0.0.0:{p(9269)}",
"NATS_DEBUG_ADDR": f"0.0.0.0:{p(9234)}",
"OCDAV_DEBUG_ADDR": f"0.0.0.0:{p(9163)}",
"OCM_GRPC_ADDR": f"0.0.0.0:{p(9282)}",
"OCM_HTTP_ADDR": f"0.0.0.0:{p(9280)}",
"OCM_DEBUG_ADDR": f"0.0.0.0:{p(9281)}",
"OCS_DEBUG_ADDR": f"0.0.0.0:{p(9114)}",
"POSTPROCESSING_DEBUG_ADDR": f"0.0.0.0:{p(9255)}",
"PROXY_DEBUG_ADDR": f"0.0.0.0:{p(9205)}",
"SEARCH_DEBUG_ADDR": f"0.0.0.0:{p(9224)}",
"SETTINGS_DEBUG_ADDR": f"0.0.0.0:{p(9194)}",
"SHARING_DEBUG_ADDR": f"0.0.0.0:{p(9151)}",
"SSE_DEBUG_ADDR": f"0.0.0.0:{p(9139)}",
"STORAGE_PUBLICLINK_DEBUG_ADDR": f"0.0.0.0:{p(9179)}",
"STORAGE_SHARES_DEBUG_ADDR": f"0.0.0.0:{p(9156)}",
"STORAGE_SYSTEM_DEBUG_ADDR": f"0.0.0.0:{p(9217)}",
"STORAGE_USERS_DEBUG_ADDR": f"0.0.0.0:{p(9159)}",
"STORE_DEBUG_ADDR": f"0.0.0.0:{p(9464)}",
"THUMBNAILS_DEBUG_ADDR": f"0.0.0.0:{p(9189)}",
"USERLOG_DEBUG_ADDR": f"0.0.0.0:{p(9214)}",
"USERS_DEBUG_ADDR": f"0.0.0.0:{p(9145)}",
"WEB_DEBUG_ADDR": f"0.0.0.0:{p(9104)}",
"WEBDAV_DEBUG_ADDR": f"0.0.0.0:{p(9119)}",
"WEBFINGER_DEBUG_ADDR": f"0.0.0.0:{p(9279)}",
}
@@ -359,8 +438,6 @@ def main() -> int:
ocis_bin = repo_root / "ocis/bin/ocis"
wrapper_bin = repo_root / "tests/ociswrapper/bin/ociswrapper"
ocis_url = "https://localhost:9200"
ocis_config_dir = Path.home() / ".ocis/config"
ocis_fed_url = "https://localhost:10200"
cfg = merged_config(suites)
@@ -435,13 +512,6 @@ def main() -> int:
providers_tmp.close()
cfg["extraServerEnvironment"]["OCM_OCM_PROVIDER_AUTHORIZER_PROVIDERS_FILE"] = providers_tmp.name
# init ocis
run([str(ocis_bin), "init", "--insecure", "true"])
shutil.copy(
repo_root / "tests/config/drone/app-registry.yaml",
ocis_config_dir / "app-registry.yaml",
)
# generate fontsMap.json with correct font path (drone hardcodes /drone/src/...)
font_path = str(repo_root / "tests/config/drone/NotoSans.ttf")
fontmap_tmp = tempfile.NamedTemporaryFile(
@@ -449,25 +519,53 @@ def main() -> int:
json.dump({"defaultFont": font_path}, fontmap_tmp)
fontmap_tmp.close()
# assemble ocis server env
server_env = {**os.environ}
server_env.update(base_server_env(repo_root, ocis_url, str(ocis_config_dir)))
server_env["THUMBNAILS_TXT_FONTMAP_FILE"] = fontmap_tmp.name
server_env.update(cfg["extraServerEnvironment"])
# Per-slot startup: each suite gets its own isolated OCIS instance.
# slot 0 uses ~/.ocis (default path, backward compat); slot N uses ~/.ocis-slot-N.
# Port offset = slot × 300; OCIS debug ports span 9104–9281 (width 177) so offset
# 300 gives clean separation: slot 0→9100-9399, slot 1→9400-9699, slot 2→9700-9999.
slot_info = [] # list of (suite, ocis_url, wrapper_url, server_env)
for slot, suite in enumerate(suites):
offset = slot * 300
config_dir, data_dir = _ocis_slot_dirs(slot)
config_dir.mkdir(parents=True, exist_ok=True)
suite_ocis_url = f"https://localhost:{9200 + offset}"
suite_wrapper_url = f"http://localhost:{5200 + offset}"
# start ociswrapper (primary ocis)
print("Starting ocis...")
wrapper_proc = subprocess.Popen(
[str(wrapper_bin), "serve",
"--bin", str(ocis_bin),
"--url", ocis_url,
"--admin-username", "admin",
"--admin-password", "admin"],
env=server_env,
)
procs.append(wrapper_proc)
s_env = {**os.environ}
s_env.update(base_server_env(repo_root, suite_ocis_url, str(config_dir),
port_offset=offset))
# Each slot needs its own data directory; without this all slots share the
# default ~/.ocis data path, causing IDM/LDAP data conflicts and auth failures.
s_env["OCIS_BASE_DATA_PATH"] = str(data_dir)
s_env["THUMBNAILS_TXT_FONTMAP_FILE"] = fontmap_tmp.name
s_env.update(_apply_port_offset(cfg["extraServerEnvironment"], offset))
# init (idempotent — safe to re-run if config dir already exists)
run([str(ocis_bin), "init", "--insecure", "true"], env=s_env)
shutil.copy(
repo_root / "tests/config/drone/app-registry.yaml",
config_dir / "app-registry.yaml",
)
print(f"Starting ocis slot {slot} (suite: {suite}, port: {9200 + offset}, "
f"wrapper: {5200 + offset})...")
wrapper_proc = subprocess.Popen(
[str(wrapper_bin), "serve",
"--bin", str(ocis_bin),
"--url", suite_ocis_url,
"--admin-username", "admin",
"--admin-password", "admin",
"--port", str(5200 + offset)],
env=s_env,
)
procs.append(wrapper_proc)
slot_info.append((suite, suite_ocis_url, suite_wrapper_url, s_env))
# convenience: for single-suite callers, keep the old names pointing at slot 0
ocis_url = slot_info[0][1]
# start federation ocis server (second instance on port 10200)
# only used by ocm group (single suite) — always slot 0, no offset conflict
if cfg["federationServer"]:
fed_config_dir = Path.home() / ".ocis-federation/config"
fed_config_dir.mkdir(parents=True, exist_ok=True)
@@ -645,8 +743,9 @@ def main() -> int:
signal.signal(signal.SIGINT, cleanup)
try:
wait_for(lambda: ocis_healthy(ocis_url), 300, "ocis")
print("ocis ready.")
for suite, suite_ocis_url, _, _ in slot_info:
wait_for(lambda u=suite_ocis_url: ocis_healthy(u), 300, f"ocis ({suite})")
print(f"ocis ready for suite: {suite}.")
if cfg["federationServer"]:
wait_for(lambda: ocis_healthy(ocis_fed_url), 300, "federation ocis")
@@ -676,13 +775,10 @@ def main() -> int:
tmp.write(without_rphp.read_text())
tmp.close()
# run tests
behat_env = {
# base behat env (suite-specific TEST_SERVER_URL / OCIS_WRAPPER_URL added per slot)
behat_env_base = {
**os.environ,
"TEST_SERVER_URL": ocis_url,
"TEST_SERVER_FED_URL": ocis_fed_url,
"OCIS_WRAPPER_URL": "http://localhost:5200",
"BEHAT_SUITES": behat_suites_raw,
"ACCEPTANCE_TEST_TYPE": acceptance_test_type,
"BEHAT_FILTER_TAGS": filter_tags,
"EXPECTED_FAILURES_FILE": tmp.name,
@@ -692,14 +788,60 @@ def main() -> int:
"EMAIL_PORT": EMAIL_PORT,
"COLLABORATION_SERVICE_URL": f"http://localhost:{_WOPI_PORTS['fakeoffice']['http']}",
}
behat_env.update(cfg["extraEnvironment"])
behat_env_base.update(cfg["extraEnvironment"])
print(f"Running suites: {behat_suites_raw} (type: {acceptance_test_type})")
result = subprocess.run(
["make", "-C", str(repo_root), "test-acceptance-api"],
env=behat_env,
)
return result.returncode
def _run_suite(suite: str, suite_ocis_url: str, suite_wrapper_url: str) -> tuple:
"""Run behat for one suite; capture output to file; return (suite, rc, log_path)."""
log_path = Path(f"/tmp/behat-{suite}.log")
env = {
**behat_env_base,
"TEST_SERVER_URL": suite_ocis_url,
"OCIS_WRAPPER_URL": suite_wrapper_url,
"BEHAT_SUITES": suite,
}
with open(log_path, "w") as lf:
rc = subprocess.run(
["make", "-C", str(repo_root), "test-acceptance-api"],
env=env, stdout=lf, stderr=subprocess.STDOUT,
).returncode
return suite, rc, log_path
if len(slot_info) == 1:
# single suite — stream output directly (unchanged behaviour)
suite, suite_ocis_url, suite_wrapper_url, _ = slot_info[0]
print(f"Running suite: {suite} (type: {acceptance_test_type})")
env = {
**behat_env_base,
"TEST_SERVER_URL": suite_ocis_url,
"OCIS_WRAPPER_URL": suite_wrapper_url,
"BEHAT_SUITES": suite,
}
return subprocess.run(
["make", "-C", str(repo_root), "test-acceptance-api"], env=env,
).returncode
# multiple suites — run in parallel, print logs serially after all finish
print(f"Running {len(slot_info)} suites in parallel (type: {acceptance_test_type}): "
f"{[s for s, *_ in slot_info]}")
failed = []
with ThreadPoolExecutor(max_workers=len(slot_info)) as ex:
futures = {
ex.submit(_run_suite, suite, suite_ocis_url, suite_wrapper_url): suite
for suite, suite_ocis_url, suite_wrapper_url, _ in slot_info
}
for fut in as_completed(futures):
suite, rc, log_path = fut.result()
print(f"\n{'='*60}\n=== Suite: {suite} (rc={rc}) ===\n{'='*60}")
sys.stdout.write(log_path.read_text())
sys.stdout.flush()
if rc != 0:
failed.append(suite)
if failed:
print(f"\nFailed suites: {', '.join(failed)}", file=sys.stderr)
return 1
print(f"\nAll {len(slot_info)} suites passed.")
return 0
finally:
cleanup()