test(ci): run test on k8s deployment

This commit is contained in:
Niraj Acharya committed 2026-06-18 10:02:32 +05:45
1 parent 8a11153149
commit ddeb1eac23
7 files changed
+814 -533

No files matched your search

+335 -296
View File
@@ -59,12 +59,12 @@ jobs:
go-version-file: go.mod
cache: true
# - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
# with:
# node-version: "24"
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "24"
# - name: Enable pnpm
# run: corepack enable && corepack prepare pnpm@10.28.1 --activate
- name: Enable pnpm
run: corepack enable && corepack prepare pnpm@10.28.1 --activate
- uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0
with:
@@ -72,75 +72,93 @@ jobs:
extensions: curl, xml, mbstring, zip, ldap, gd
tools: composer
# - name: Pre-checks and generate
# run: |
# # Phase 1 — I/O + light CPU, no contention between tasks.
# # wa (I/O wait) will spike during npm/pnpm downloads.
# # Expected avg load: ~50-60 % CPU on 2 vCPU.
# vmstat 2 > /tmp/vmstat-phase1.log & MONITOR_PID=$!
- name: Install libvips-dev for ENABLE_VIPS build
run: |
sudo apt-get update -qq
# NEEDRESTART_MODE=a: auto-restart services silently; without this, needrestart can fail with exit code 6
sudo NEEDRESTART_MODE=a apt-get install -y libvips-dev
# (make vendor-bin-codestyle && make vendor-bin-codesniffer && make test-php-style && make check-env-var-annotations) > /tmp/php-style.log 2>&1 & PIDS=($!)
# (npm install -g @gherlint/gherlint@1.1.0 && make test-gherkin-lint) > /tmp/gherkin.log 2>&1 & PIDS+=($!)
# bash tests/acceptance/check-deleted-suites-in-expected-failure.sh > /tmp/suites.log 2>&1 & PIDS+=($!)
# make govulncheck > /tmp/govulncheck.log 2>&1 & PIDS+=($!)
# make ci-node-generate > /tmp/node-gen.log 2>&1 & PIDS+=($!)
# make ci-go-generate > /tmp/go-gen.log 2>&1 & PIDS+=($!)
- name: Pre-checks and generate
run: |
# Phase 1 — I/O + light CPU, no contention between tasks.
# wa (I/O wait) will spike during npm/pnpm downloads.
# Expected avg load: ~50-60 % CPU on 2 vCPU.
vmstat 2 > /tmp/vmstat-phase1.log & MONITOR_PID=$!
# FAILED=0
# for PID in "${PIDS[@]}"; do wait "$PID" || FAILED=1; done
# kill $MONITOR_PID 2>/dev/null; wait $MONITOR_PID 2>/dev/null || true
(make vendor-bin-codestyle && make vendor-bin-codesniffer && make test-php-style && make check-env-var-annotations) > /tmp/php-style.log 2>&1 & PIDS=($!)
(npm install -g @gherlint/gherlint@1.1.0 && make test-gherkin-lint) > /tmp/gherkin.log 2>&1 & PIDS+=($!)
bash tests/acceptance/check-deleted-suites-in-expected-failure.sh > /tmp/suites.log 2>&1 & PIDS+=($!)
make govulncheck > /tmp/govulncheck.log 2>&1 & PIDS+=($!)
make ci-node-generate > /tmp/node-gen.log 2>&1 & PIDS+=($!)
make ci-go-generate > /tmp/go-gen.log 2>&1 & PIDS+=($!)
# # How to read the load line:
# # busy — % of time CPUs were doing work (100% = fully saturated)
# # runq — processes waiting for a CPU turn; runq >> nCPU means tasks
# # compete and each runs slower (runq 10 on 2 vCPU = ~5× slower)
# # wa — % waiting on disk/network; wa > 20% = I/O bound, not CPU bound
# # → high wa: add more parallel tasks; high runq: reduce them
# 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 "=== phase 1 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-phase1.log
FAILED=0
for PID in "${PIDS[@]}"; do wait "$PID" || FAILED=1; done
kill $MONITOR_PID 2>/dev/null; wait $MONITOR_PID 2>/dev/null || true
# echo "=== php-style ===" && cat /tmp/php-style.log
# echo "=== gherkin ===" && cat /tmp/gherkin.log
# echo "=== suites ===" && cat /tmp/suites.log
# echo "=== govulncheck ===" && cat /tmp/govulncheck.log
# echo "=== ci-node-generate ===" && cat /tmp/node-gen.log
# echo "=== ci-go-generate ===" && cat /tmp/go-gen.log
# How to read the load line:
# busy — % of time CPUs were doing work (100% = fully saturated)
# runq — processes waiting for a CPU turn; runq >> nCPU means tasks
# compete and each runs slower (runq 10 on 2 vCPU = ~5× slower)
# wa — % waiting on disk/network; wa > 20% = I/O bound, not CPU bound
# → high wa: add more parallel tasks; high runq: reduce them
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 "=== phase 1 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-phase1.log
# exit $FAILED
echo "=== php-style ===" && cat /tmp/php-style.log
echo "=== gherkin ===" && cat /tmp/gherkin.log
echo "=== suites ===" && cat /tmp/suites.log
echo "=== govulncheck ===" && cat /tmp/govulncheck.log
echo "=== ci-node-generate ===" && cat /tmp/node-gen.log
echo "=== ci-go-generate ===" && cat /tmp/go-gen.log
# - name: Build, lint and test
# run: |
# # Phase 2 — all three are CPU-bound Go compilation on 2 vCPU.
# # They compete for CPU (expect id < 10, load ~95 %) but share the
# # Go build cache within this runner, so make test reuses artifacts
# # from the ocis build. Critical path = ocis build (~300 s).
# vmstat 2 > /tmp/vmstat-phase2.log & MONITOR_PID=$!
exit $FAILED
# make ci-golangci-lint > /tmp/golangci-lint.log 2>&1 & PIDS=($!)
# make -C ocis build > /tmp/ocis-build.log 2>&1 & PIDS+=($!)
# make test > /tmp/unit-tests.log 2>&1 & PIDS+=($!)
- name: Build, lint and test
run: |
# Phase 2 — all three are CPU-bound Go compilation on 2 vCPU.
# They compete for CPU (expect id < 10, load ~95 %) but share the
# Go build cache within this runner, so make test reuses artifacts
# from the ocis build. Critical path = ocis build (~300 s).
vmstat 2 > /tmp/vmstat-phase2.log & MONITOR_PID=$!
# FAILED=0
# for PID in "${PIDS[@]}"; do wait "$PID" || FAILED=1; done
# kill $MONITOR_PID 2>/dev/null; wait $MONITOR_PID 2>/dev/null || true
make ci-golangci-lint > /tmp/golangci-lint.log 2>&1 & PIDS=($!)
ENABLE_VIPS=true make -C ocis build > /tmp/ocis-build.log 2>&1 & PIDS+=($!)
make test > /tmp/unit-tests.log 2>&1 & PIDS+=($!)
GOWORK=off make -C tests/ociswrapper build > /tmp/ociswrapper-build.log 2>&1 & PIDS+=($!)
# # Signal: busy=saturated runq>>2=tasks competing(slows each) wa>20%=I/O bound
# 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 "=== phase 2 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-phase2.log
FAILED=0
for PID in "${PIDS[@]}"; do wait "$PID" || FAILED=1; done
kill $MONITOR_PID 2>/dev/null; wait $MONITOR_PID 2>/dev/null || true
# echo "=== golangci-lint ==="&& cat /tmp/golangci-lint.log
# echo "=== ocis build ===" && cat /tmp/ocis-build.log
# echo "=== unit tests ===" && cat /tmp/unit-tests.log
# Signal: busy=saturated runq>>2=tasks competing(slows each) wa>20%=I/O bound
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 "=== phase 2 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-phase2.log
# exit $FAILED
echo "=== golangci-lint ===" && cat /tmp/golangci-lint.log
echo "=== ocis build ===" && cat /tmp/ocis-build.log
echo "=== ociswrapper build ===" && cat /tmp/ociswrapper-build.log
echo "=== unit tests ===" && cat /tmp/unit-tests.log
exit $FAILED
- name: Upload build artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ocis-build-artifacts
path: |
ocis/bin/ocis
tests/ociswrapper/bin/ociswrapper
retention-days: 1
if-no-files-found: error
local-api-tests:
name: ${{ matrix.suite }}
# needs: [build-and-test]
needs: [build-and-test]
runs-on: ubuntu-latest
strategy:
fail-fast: false
@@ -190,17 +208,6 @@ jobs:
- apiCollaboration
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
cache: true
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: "24"
- name: Enable pnpm
run: corepack enable && corepack prepare pnpm@10.28.1 --activate
- uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0
with:
@@ -249,48 +256,27 @@ jobs:
exit(1);
}
'
- name: Download k3d binary
run: |
K3D_VERSION="v5.8.3"
curl -L -o k3d https://github.com/k3d-io/k3d/releases/download/${K3D_VERSION}/k3d-linux-amd64
echo "dbaa79a76ace7f4ca230a1ff41dc7d8a5036a8ad0309e9c54f9bf3836dbe853e k3d" | sha256sum --check
chmod +x k3d
sudo mv k3d /usr/local/bin/
k3d version
- name: Set up kubectl
run: |
KUBECTL_VERSION=v1.36.0
curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl"
curl -LO "https://dl.k8s.io/${KUBECTL_VERSION}/bin/linux/amd64/kubectl.sha256"
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
kubectl version --client
- name: Install Helm
run: |
HELM_VERSION="v3.20.2"
curl -LO "https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz"
echo "258e830a9e613c8a7a302d6059b4bb3b9758f2f3e1bb8ea0d707ce10a9a72fea helm-${HELM_VERSION}-linux-amd64.tar.gz" | sha256sum --check
tar -zxvf helm-${HELM_VERSION}-linux-amd64.tar.gz
sudo mv linux-amd64/helm /usr/local/bin/helm
rm -rf linux-amd64 helm-${HELM_VERSION}-linux-amd64.tar.gz
helm version
- name: Prepare hosts entry
run: |
echo "127.0.0.1 ocis-server" | sudo tee -a /etc/hosts
- name: Download build artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: ocis-build-artifacts
- name: Restore binary permissions
run: chmod +x ocis/bin/ocis tests/ociswrapper/bin/ociswrapper
- name: Run ${{ matrix.suite }}
run: BEHAT_SUITES=${{ matrix.suite }} K8S=true python3 tests/acceptance/run-github.py
run: BEHAT_SUITES=${{ matrix.suite }} python3 tests/acceptance/run-github.py
cli-tests:
# needs: [build-and-test]
needs: [build-and-test]
name: ${{ matrix.suite }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
suite:
- cliCommands,apiServiceAvailability # grouped like drone; needs ClamAV + email
- cliCommands,apiServiceAvailability # grouped: both need ClamAV + email services
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -319,7 +305,7 @@ jobs:
core-api-tests:
name: ${{ matrix.suite }}
# needs: [build-and-test]
needs: [build-and-test]
runs-on: ubuntu-latest
strategy:
fail-fast: false
@@ -384,215 +370,268 @@ jobs:
exit(1);
}
'
- name: Download k3d binary
run: |
K3D_VERSION="v5.8.3"
curl -L -o k3d https://github.com/k3d-io/k3d/releases/download/${K3D_VERSION}/k3d-linux-amd64
echo "dbaa79a76ace7f4ca230a1ff41dc7d8a5036a8ad0309e9c54f9bf3836dbe853e k3d" | sha256sum --check
chmod +x k3d
sudo mv k3d /usr/local/bin/
k3d version
- name: Set up kubectl
run: |
KUBECTL_VERSION=v1.36.0
curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl"
curl -LO "https://dl.k8s.io/${KUBECTL_VERSION}/bin/linux/amd64/kubectl.sha256"
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
kubectl version --client
- name: Install Helm
run: |
HELM_VERSION="v3.20.2"
curl -LO "https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz"
echo "258e830a9e613c8a7a302d6059b4bb3b9758f2f3e1bb8ea0d707ce10a9a72fea helm-${HELM_VERSION}-linux-amd64.tar.gz" | sha256sum --check
tar -zxvf helm-${HELM_VERSION}-linux-amd64.tar.gz
sudo mv linux-amd64/helm /usr/local/bin/helm
rm -rf linux-amd64 helm-${HELM_VERSION}-linux-amd64.tar.gz
helm version
- name: Prepare hosts entry
run: |
echo "127.0.0.1 ocis-server" | sudo tee -a /etc/hosts
- name: Download build artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: ocis-build-artifacts
- name: Restore binary permissions
run: chmod +x ocis/bin/ocis tests/ociswrapper/bin/ociswrapper
- name: Run ${{ matrix.suite }}
run: >
BEHAT_SUITES="${{ matrix.suite }}"
ACCEPTANCE_TEST_TYPE=core-api
WITH_REMOTE_PHP=true
K8S=true
python3 tests/acceptance/run-github.py
# e2e-tests:
# name: e2e-${{ matrix.suite }}
# needs: [build-and-test]
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# include:
# - suite: part-1
# args: "--total-parts 4 --xsuites search,app-provider,ocm,keycloak --run-part 1"
# - suite: part-2
# args: "--total-parts 4 --xsuites search,app-provider,ocm,keycloak --run-part 2"
# - suite: part-3
# args: "--total-parts 4 --xsuites search,app-provider,ocm,keycloak --run-part 3"
# - suite: part-4
# args: "--total-parts 4 --xsuites search,app-provider,ocm,keycloak --run-part 4"
# - suite: search
# args: "--suites search"
# tika: true
# - suite: keycloak
# args: "--suites journeys,keycloak"
# keycloak: true
# steps:
# - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
# with:
# go-version-file: go.mod
# cache: true
# - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
# with:
# node-version: "24"
# - name: Enable pnpm
# run: corepack enable && corepack prepare pnpm@10.28.1 --activate
# - name: Generate code
# run: |
# pnpm config set store-dir ./.pnpm-store
# make ci-node-generate
# env:
# CHROMEDRIVER_SKIP_DOWNLOAD: "true"
e2e-tests:
name: e2e-${{ matrix.suite }}
needs: [build-and-test]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- suite: part-1
args: "--type playwright --total-parts 4 --xsuites search,app-provider,ocm,keycloak,mfa,oidc --run-part 1"
- suite: part-2
args: "--type playwright --total-parts 4 --xsuites search,app-provider,ocm,keycloak,mfa,oidc --run-part 2"
- suite: part-3
args: "--type playwright --total-parts 4 --xsuites search,app-provider,ocm,keycloak,mfa,oidc --run-part 3"
- suite: part-4
args: "--type playwright --total-parts 4 --xsuites search,app-provider,ocm,keycloak,mfa,oidc --run-part 4"
- suite: search
args: "--type playwright --suites search"
tika: true
- suite: keycloak
args: "--type playwright --suites journeys,keycloak"
keycloak: true
- suite: mfa
args: "--type playwright --suites mfa"
mfa: true
- suite: oidc
args: "--type playwright specs/oidc/refreshToken.spec.ts"
oidc: true
- suite: oidc-iframe
args: "--type playwright specs/oidc/iframeTokenRenewal.spec.ts"
oidc_iframe: true
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
# 24.16.0 breaks playwright install (yauzl zip extraction hangs); pin to last known good.
# https://github.com/microsoft/playwright/issues/40724
node-version: "24.15.0"
- name: Enable pnpm
run: |
corepack enable && corepack prepare pnpm@10.28.1 --activate
pnpm config set store-dir ./.pnpm-store
# - name: Cache Playwright Chromium
# uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
# with:
# path: ~/.cache/ms-playwright
# key: playwright-chromium-${{ hashFiles('.drone.env') }}
- name: Install libvips runtime
run: |
sudo apt-get update -qq
# NEEDRESTART_MODE=a: auto-restart services silently; without this, needrestart can fail with exit code 6
sudo NEEDRESTART_MODE=a apt-get install -y libvips42t64
# # --- Tika (search suite only) ---
# - name: Start Tika
# if: matrix.tika == true
# run: |
# docker run -d --name tika --network host apache/tika:3.2.2.0-full
# timeout 120 bash -c 'until curl -sf http://localhost:9998; do sleep 2; done'
# echo "tika ready."
- name: Download build artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: ocis-build-artifacts
# # --- Keycloak (keycloak suite only) ---
# - name: Generate Keycloak certs
# if: matrix.keycloak == true
# run: |
# mkdir -p keycloak-certs
# openssl req -x509 -newkey rsa:2048 \
# -keyout keycloak-certs/keycloakkey.pem \
# -out keycloak-certs/keycloakcrt.pem \
# -nodes -days 365 -subj '/CN=keycloak'
# chmod -R 777 keycloak-certs
- name: Restore binary permissions
run: chmod +x ocis/bin/ocis tests/ociswrapper/bin/ociswrapper
# - name: Start Postgres
# if: matrix.keycloak == true
# run: |
# docker run -d --name postgres --network host \
# -e POSTGRES_DB=keycloak \
# -e POSTGRES_USER=keycloak \
# -e POSTGRES_PASSWORD=keycloak \
# postgres:alpine3.18
# timeout 30 bash -c 'until docker exec postgres pg_isready -U keycloak; do sleep 1; done'
- name: Cache Playwright Chromium
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.cache/ms-playwright
key: playwright-chromium-${{ hashFiles('ci.env') }}
# - name: Start Keycloak
# if: matrix.keycloak == true
# run: |
# # Patch realm: replace Drone Docker hostname with localhost IP
# sed 's|https://ocis-server:9200|https://127.0.0.1:9200|g' \
# tests/config/drone/ocis-ci-realm.dist.json > /tmp/ocis-realm.json
# docker run -d --name keycloak --network host \
# -e OCIS_DOMAIN=https://127.0.0.1:9200 \
# -e KC_HOSTNAME=localhost \
# -e KC_PORT=8443 \
# -e KC_DB=postgres \
# -e "KC_DB_URL=jdbc:postgresql://localhost:5432/keycloak" \
# -e KC_DB_USERNAME=keycloak \
# -e KC_DB_PASSWORD=keycloak \
# -e KC_FEATURES=impersonation \
# -e KC_BOOTSTRAP_ADMIN_USERNAME=admin \
# -e KC_BOOTSTRAP_ADMIN_PASSWORD=admin \
# -e KC_HTTPS_CERTIFICATE_FILE=/keycloak-certs/keycloakcrt.pem \
# -e KC_HTTPS_CERTIFICATE_KEY_FILE=/keycloak-certs/keycloakkey.pem \
# -v "$(pwd)/keycloak-certs:/keycloak-certs:ro" \
# -v "/tmp/ocis-realm.json:/opt/keycloak/data/import/oCIS-realm.json:ro" \
# quay.io/keycloak/keycloak:26.2.5 \
# start-dev --proxy-headers xforwarded \
# --spi-connections-http-client-default-disable-trust-manager=true \
# --import-realm --health-enabled=true
# timeout 300 bash -c 'until curl -skf https://localhost:9000/health/ready; do sleep 3; done' \
# || (echo "=== keycloak logs ===" && docker logs keycloak --tail 80 && exit 1)
# echo "keycloak ready."
# --- Tika (search suite only) ---
- name: Start Tika
if: matrix.tika == true
run: |
docker run -d --name tika --network host apache/tika:3.2.2.0-full
timeout 120 bash -c 'until curl -sf http://localhost:9998; do sleep 2; done'
echo "tika ready."
# - name: Run e2e-${{ matrix.suite }}
# run: E2E_ARGS="${{ matrix.args }}" python3 tests/acceptance/run-e2e.py
# env:
# TIKA_NEEDED: ${{ matrix.tika == true && 'true' || 'false' }}
# KEYCLOAK_NEEDED: ${{ matrix.keycloak == true && 'true' || 'false' }}
# --- Keycloak (keycloak and mfa suites) ---
- name: Generate Keycloak certs
if: matrix.keycloak == true || matrix.mfa == true
run: |
mkdir -p keycloak-certs
openssl req -x509 -newkey rsa:2048 \
-keyout keycloak-certs/keycloakkey.pem \
-out keycloak-certs/keycloakcrt.pem \
-nodes -days 365 -subj '/CN=keycloak'
chmod -R 777 keycloak-certs
# litmus:
# name: litmus
# needs: [build-and-test]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
# with:
# go-version-file: go.mod
# cache: true
# - name: Run litmus
# run: python3 tests/acceptance/run-litmus.py
- name: Start Postgres
if: matrix.keycloak == true || matrix.mfa == true
run: |
docker run -d --name postgres --network host \
-e POSTGRES_DB=keycloak \
-e POSTGRES_USER=keycloak \
-e POSTGRES_PASSWORD=keycloak \
postgres:alpine3.18
timeout 30 bash -c 'until docker exec postgres pg_isready -U keycloak; do sleep 1; done'
# cs3api:
# name: cs3api
# needs: [build-and-test]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
# with:
# go-version-file: go.mod
# cache: true
# - name: Run cs3api validator
# run: python3 tests/acceptance/run-cs3api.py
- name: Start Keycloak
if: matrix.keycloak == true || matrix.mfa == true
run: |
# The mfa suite needs a different realm with TOTP MFA configured.
# ocis-ci-realm uses ocis-server:9200, ocis-mfa-ci-realm uses localhost:9200;
# ocis runs on 127.0.0.1:9200 so we rewrite both forms.
if [[ "${{ matrix.mfa }}" == "true" ]]; then
REALM_FILE=tests/config/ci/ocis-mfa-ci-realm.dist.json
else
REALM_FILE=tests/config/ci/ocis-ci-realm.dist.json
fi
sed -e 's|https://ocis-server:9200|https://127.0.0.1:9200|g' \
-e 's|https://localhost:9200|https://127.0.0.1:9200|g' \
"$REALM_FILE" > /tmp/ocis-realm.json
docker run -d --name keycloak --network host \
-e OCIS_DOMAIN=https://127.0.0.1:9200 \
-e KC_HOSTNAME=localhost \
-e KC_PORT=8443 \
-e KC_DB=postgres \
-e "KC_DB_URL=jdbc:postgresql://localhost:5432/keycloak" \
-e KC_DB_USERNAME=keycloak \
-e KC_DB_PASSWORD=keycloak \
-e KC_FEATURES=impersonation \
-e KC_BOOTSTRAP_ADMIN_USERNAME=admin \
-e KC_BOOTSTRAP_ADMIN_PASSWORD=admin \
-e KC_HTTPS_CERTIFICATE_FILE=/keycloak-certs/keycloakcrt.pem \
-e KC_HTTPS_CERTIFICATE_KEY_FILE=/keycloak-certs/keycloakkey.pem \
-v "$(pwd)/keycloak-certs:/keycloak-certs:ro" \
-v "/tmp/ocis-realm.json:/opt/keycloak/data/import/oCIS-realm.json:ro" \
quay.io/keycloak/keycloak:26.2.5 \
start-dev --proxy-headers xforwarded \
--spi-connections-http-client-default-disable-trust-manager=true \
--import-realm --health-enabled=true
timeout 300 bash -c 'until curl -skf https://localhost:9000/health/ready; do sleep 3; done' \
|| (echo "=== keycloak logs ===" && docker logs keycloak --tail 80 && exit 1)
echo "keycloak ready."
# wopi-builtin:
# name: wopi-builtin
# needs: [build-and-test]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
# with:
# go-version-file: go.mod
# cache: true
# - name: Run WOPI validator (builtin)
# run: python3 tests/acceptance/run-wopi.py --type builtin
- name: Run e2e-${{ matrix.suite }}
run: E2E_ARGS="${{ matrix.args }}" python3 tests/acceptance/run-e2e.py
env:
TIKA_NEEDED: ${{ matrix.tika == true && 'true' || 'false' }}
KEYCLOAK_NEEDED: ${{ matrix.keycloak == true && 'true' || 'false' }}
MFA_NEEDED: ${{ matrix.mfa == true && 'true' || 'false' }}
OIDC_NEEDED: ${{ matrix.oidc == true && 'true' || 'false' }}
OIDC_IFRAME_NEEDED: ${{ matrix.oidc_iframe == true && 'true' || 'false' }}
# wopi-cs3:
# name: wopi-cs3
# needs: [build-and-test]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
# with:
# go-version-file: go.mod
# cache: true
# - name: Run WOPI validator (cs3)
# run: python3 tests/acceptance/run-wopi.py --type cs3
litmus:
name: litmus
needs: [build-and-test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# all-acceptance-tests:
# needs: [local-api-tests, cli-tests, core-api-tests, litmus, cs3api, wopi-builtin, wopi-cs3, e2e-tests]
# runs-on: ubuntu-latest
# if: always()
# steps:
# - name: Check all jobs passed
# run: |
# if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
# exit 1
# fi
- name: Install libvips runtime
run: |
sudo apt-get update -qq
# NEEDRESTART_MODE=a: auto-restart services silently; without this, needrestart can fail with exit code 6
sudo NEEDRESTART_MODE=a apt-get install -y libvips42t64
- name: Download build artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: ocis-build-artifacts
- name: Restore binary permissions
run: chmod +x ocis/bin/ocis
- name: Run litmus
run: python3 tests/acceptance/run-litmus.py
cs3api:
name: cs3api
needs: [build-and-test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install libvips runtime
run: |
sudo apt-get update -qq
# NEEDRESTART_MODE=a: auto-restart services silently; without this, needrestart can fail with exit code 6
sudo NEEDRESTART_MODE=a apt-get install -y libvips42t64
- name: Download build artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: ocis-build-artifacts
- name: Restore binary permissions
run: chmod +x ocis/bin/ocis
- name: Run cs3api validator
run: python3 tests/acceptance/run-cs3api.py
wopi-builtin:
name: wopi-builtin
needs: [build-and-test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install libvips runtime
run: |
sudo apt-get update -qq
# NEEDRESTART_MODE=a: auto-restart services silently; without this, needrestart can fail with exit code 6
sudo NEEDRESTART_MODE=a apt-get install -y libvips42t64
- name: Download build artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: ocis-build-artifacts
- name: Restore binary permissions
run: chmod +x ocis/bin/ocis
- name: Run WOPI validator (builtin)
run: python3 tests/acceptance/run-wopi.py --type builtin
wopi-cs3:
name: wopi-cs3
needs: [build-and-test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install libvips runtime
run: |
sudo apt-get update -qq
# NEEDRESTART_MODE=a: auto-restart services silently; without this, needrestart can fail with exit code 6
sudo NEEDRESTART_MODE=a apt-get install -y libvips42t64
- name: Download build artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: ocis-build-artifacts
- name: Restore binary permissions
run: chmod +x ocis/bin/ocis
- name: Run WOPI validator (cs3)
run: python3 tests/acceptance/run-wopi.py --type cs3
all-acceptance-tests:
needs: [detect-changes, local-api-tests, cli-tests, core-api-tests, litmus, cs3api, wopi-builtin, wopi-cs3, e2e-tests]
runs-on: ubuntu-latest
if: always()
steps:
- name: Check all jobs passed
run: |
# If docs-only, all test jobs are expected to be skipped — that's a pass
if [[ "${{ needs.detect-changes.outputs.docs-only }}" == "true" ]]; then
echo "Docs-only change — skipping tests is expected."
exit 0
fi
if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
exit 1
fi
+385
View File
@@ -0,0 +1,385 @@
name: Acceptance Tests K8S
on:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 1 * * *'
jobs:
local-api-tests:
name: ${{ matrix.suite }}-k8s
runs-on: ubuntu-latest
if: >-
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' &&
contains(github.event.pull_request.title || '', 'k8s'))
strategy:
fail-fast: false
matrix:
suite:
# contract & locks
- apiContract
- apiLocks
# settings & notifications (needs email)
- apiSettings
- apiNotification
- apiCors
# graph
- apiGraphUser
- apiGraph
- apiGraphGroup
# spaces & dav
- apiSpaces
- apiSpacesShares
- apiSpacesDavOperation
- apiDownloads
- apiAsyncUpload
- apiDepthInfinity
- apiArchiver
- apiActivities
# search
- apiSearch1
- apiSearch2
- apiSearchContent # needs Tika
# sharing
- apiSharingNgShares
- apiReshare
- apiSharingNgPermissions
- apiSharingNgAdditionalShareRole
- apiSharingNgDriveInvitation
- apiSharingNgItemInvitation
- apiSharingNgDriveLinkShare
- apiSharingNgItemLinkShare
- apiSharingNgLinkShareManagement
# auth
- apiAuthApp
# antivirus (needs ClamAV)
- apiAntivirus
# federation (needs email + federation ocis)
- apiOcm
# collaboration (needs WOPI)
- apiCollaboration
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0
with:
php-version: "8.4"
extensions: curl, xml, mbstring, zip, ldap, gd
tools: composer
- name: Cache libcurl 8.12.0
id: cache-libcurl
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: /opt/libcurl
key: libcurl-8.12.0-${{ runner.os }}
- name: Install libcurl 8.12.0 build dependencies
run: |
sudo apt-get update -qq
sudo NEEDRESTART_MODE=a apt-get install -y libssl-dev libnghttp2-dev libpsl-dev libldap-dev libssh-dev zlib1g-dev libvips-dev
- name: Compile libcurl 8.12.0 from source
if: steps.cache-libcurl.outputs.cache-hit != 'true'
run: |
cd /tmp
curl -sLO https://curl.se/download/curl-8.12.0.tar.gz
tar xzf curl-8.12.0.tar.gz
cd curl-8.12.0
./configure --with-ssl --with-zlib --with-nghttp2 --prefix=/opt/libcurl --enable-versioned-symbols --silent
make -j$(nproc) --silent
sudo make install --silent
- name: Restore libcurl ldconfig
run: |
echo "/opt/libcurl/lib" | sudo tee /etc/ld.so.conf.d/libcurl-8.conf
sudo ldconfig
/opt/libcurl/bin/curl --version | head -1
php -r '
$v = curl_version()["version"];
echo "PHP curl: $v\n";
if (version_compare($v, "8.12.0", "<")) {
fwrite(STDERR, "FATAL: PHP sees libcurl $v, need >= 8.12.0\n");
exit(1);
}
'
- name: Download k3d binary
run: |
K3D_VERSION="v5.8.3"
curl -L -o k3d https://github.com/k3d-io/k3d/releases/download/${K3D_VERSION}/k3d-linux-amd64
echo "dbaa79a76ace7f4ca230a1ff41dc7d8a5036a8ad0309e9c54f9bf3836dbe853e k3d" | sha256sum --check
chmod +x k3d
sudo mv k3d /usr/local/bin/
k3d version
- name: Set up kubectl
run: |
KUBECTL_VERSION=v1.36.0
curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl"
curl -LO "https://dl.k8s.io/${KUBECTL_VERSION}/bin/linux/amd64/kubectl.sha256"
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
kubectl version --client
- name: Install Helm
run: |
HELM_VERSION="v3.18.4"
curl -LO "https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz"
echo "f8180838c23d7c7d797b208861fecb591d9ce1690d8704ed1e4cb8e2add966c1 helm-${HELM_VERSION}-linux-amd64.tar.gz" | sha256sum --check
tar -zxvf helm-${HELM_VERSION}-linux-amd64.tar.gz
sudo mv linux-amd64/helm /usr/local/bin/helm
rm -rf linux-amd64 helm-${HELM_VERSION}-linux-amd64.tar.gz
helm version
- name: Prepare hosts entry
run: |
echo "127.0.0.1 ocis-server clamav email collabora onlyoffice fakeoffice tika federation-ocis-server" | sudo tee -a /etc/hosts
- name: Spin up K3d Cluster
run: make -C tests/config/k8s create-cluster
- name: Prepare Helm Charts & Deploy oCIS
run: |
cd tests/config/k8s
# Map Matrix item requirement flags dynamically
export ENABLE_ANTIVIRUS=${{ matrix.suite == 'apiAntivirus' }}
export ENABLE_EMAIL=${{ matrix.suite == 'apiNotification' || matrix.suite == 'apiSettings' || matrix.suite == 'apiOcm' }}
export ENABLE_TIKA=${{ matrix.suite == 'apiSearchContent' }}
export ENABLE_WOPI=${{ matrix.suite == 'apiCollaboration' }}
export ENABLE_OCM=${{ matrix.suite == 'apiOcm' }}
export ENABLE_AUTH_APP=${{ matrix.suite == 'apiAuthApp' }}
# Prepare base charts and deploy
make prepare-charts
kubectl get pods -n ocis-server -Aw&
make deploy-ocis
# Deploy dynamic sidecar elements for OCM suite if required
if [[ "${{ matrix.suite }}" == "apiOcm" ]]; then
OCM=true make prepare-charts
OCM=true make deploy-ocis
fi
- name: Deploy Suite-Specific External Backends
run: |
if [[ "${{ matrix.suite }}" == "apiNotification" || "${{ matrix.suite }}" == "apiSettings" || "${{ matrix.suite }}" == "apiOcm" ]]; then
docker run -d -p 1025:1025 -p 8025:8025 --name mailpit axllent/mailpit:v1.22.3
bash tests/config/k8s/expose-external-svc.sh email:1025
fi
if [[ "${{ matrix.suite }}" == "apiAntivirus" ]]; then
docker run -d -p 3310:3310 --name clamav owncloudci/clamavd
bash tests/config/k8s/expose-external-svc.sh clamav:3310
sleep 30
fi
if [[ "${{ matrix.suite }}" == "apiSearchContent" ]]; then
docker run -d -p 9998:9998 --name tika apache/tika:3.2.2.0-full
bash tests/config/k8s/expose-external-svc.sh tika:9998
fi
- name: Build and Run ociswrapper
run: |
# 1. Build using the explicit Dockerfile path from the repo root context
make -C tests/ociswrapper/
tests/ociswrapper/bin/ociswrapper serve --url https://ocis-server --admin-username admin --admin-password admin --skip-ocis-run -n ocis-server &
- name: Run ${{ matrix.suite }}
env:
TEST_SERVER_URL: https://ocis-server
TEST_SERVER_FED_URL: https://federation-ocis-server
STORAGE_DRIVER: ocis
BEHAT_SUITES: ${{ matrix.suite }}
BEHAT_FILTER_TAGS: "~@skip&&~@skipOnGraph&&~@skipOnOcis-OCIS-Storage"
EXPECTED_FAILURES_FILE: tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md
OCIS_WRAPPER_URL: http://localhost:5200
COLLABORATION_SERVICE_URL: http://ocis-server:9304
K8S: "true"
run: |
make test-acceptance-api
- name: Cleanup Environment Setup
run: |
make -C tests/config/k8s cleanup || true
docker rm -vf $(docker ps -aq) || true
core-api-tests:
name: ${{ matrix.suite }}-k8s
runs-on: ubuntu-latest
if: >-
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' &&
contains(github.event.pull_request.title || '', 'k8s'))
strategy:
fail-fast: false
matrix:
suite:
- "coreApiAuth,coreApiCapabilities,coreApiFavorites,coreApiMain,coreApiVersions"
- "coreApiShareManagementBasicToShares,coreApiShareManagementToShares"
- "coreApiSharees"
- "coreApiSharePublicLink2"
- "coreApiShareOperationsToShares1,coreApiShareOperationsToShares2,coreApiSharePublicLink1,coreApiShareCreateSpecialToShares1,coreApiShareCreateSpecialToShares2,coreApiShareUpdateToShares"
- "coreApiTrashbin,coreApiTrashbinRestore,coreApiWebdavEtagPropagation1,coreApiWebdavEtagPropagation2"
- "coreApiWebdavDelete,coreApiWebdavOperations,coreApiWebdavMove2"
- "coreApiWebdavProperties"
- "coreApiWebdavMove1,coreApiWebdavPreviews,coreApiWebdavUpload,coreApiWebdavUploadTUS"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0
with:
php-version: "8.4"
extensions: curl, xml, mbstring, zip, ldap, gd
tools: composer
- name: Cache libcurl 8.12.0
id: cache-libcurl
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: /opt/libcurl
key: libcurl-8.12.0-${{ runner.os }}
- name: Install libcurl 8.12.0 build dependencies
run: |
sudo apt-get update -qq
sudo NEEDRESTART_MODE=a apt-get install -y libssl-dev libnghttp2-dev libpsl-dev libldap-dev libssh-dev zlib1g-dev libvips-dev
- name: Compile libcurl 8.12.0 from source
if: steps.cache-libcurl.outputs.cache-hit != 'true'
run: |
cd /tmp
curl -sLO https://curl.se/download/curl-8.12.0.tar.gz
tar xzf curl-8.12.0.tar.gz
cd curl-8.12.0
./configure --with-ssl --with-zlib --with-nghttp2 --prefix=/opt/libcurl --enable-versioned-symbols --silent
make -j$(nproc) --silent
sudo make install --silent
- name: Restore libcurl ldconfig
run: |
echo "/opt/libcurl/lib" | sudo tee /etc/ld.so.conf.d/libcurl-8.conf
sudo ldconfig
/opt/libcurl/bin/curl --version | head -1
php -r '
$v = curl_version()["version"];
echo "PHP curl: $v\n";
if (version_compare($v, "8.12.0", "<")) {
fwrite(STDERR, "FATAL: PHP sees libcurl $v, need >= 8.12.0\n");
exit(1);
}
'
- name: Download k3d binary
run: |
K3D_VERSION="v5.8.3"
curl -L -o k3d https://github.com/k3d-io/k3d/releases/download/${K3D_VERSION}/k3d-linux-amd64
echo "dbaa79a76ace7f4ca230a1ff41dc7d8a5036a8ad0309e9c54f9bf3836dbe853e k3d" | sha256sum --check
chmod +x k3d
sudo mv k3d /usr/local/bin/
k3d version
- name: Set up kubectl
run: |
KUBECTL_VERSION=v1.36.0
curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl"
curl -LO "https://dl.k8s.io/${KUBECTL_VERSION}/bin/linux/amd64/kubectl.sha256"
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
kubectl version --client
- name: Install Helm
run: |
HELM_VERSION="v3.18.4"
curl -LO "https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz"
echo "f8180838c23d7c7d797b208861fecb591d9ce1690d8704ed1e4cb8e2add966c1 helm-${HELM_VERSION}-linux-amd64.tar.gz" | sha256sum --check
tar -zxvf helm-${HELM_VERSION}-linux-amd64.tar.gz
sudo mv linux-amd64/helm /usr/local/bin/helm
rm -rf linux-amd64 helm-${HELM_VERSION}-linux-amd64.tar.gz
helm version
- name: Prepare hosts entry
run: |
echo "127.0.0.1 ocis-server clamav email collabora onlyoffice fakeoffice tika federation-ocis-server" | sudo tee -a /etc/hosts
- name: Spin up K3d Cluster
run: make -C tests/config/k8s create-cluster
- name: Prepare Helm Charts & Deploy oCIS
run: |
cd tests/config/k8s
# Map Matrix item requirement flags dynamically
export ENABLE_ANTIVIRUS=${{ matrix.suite == 'apiAntivirus' }}
export ENABLE_EMAIL=${{ matrix.suite == 'apiNotification' || matrix.suite == 'apiSettings' || matrix.suite == 'apiOcm' }}
export ENABLE_TIKA=${{ matrix.suite == 'apiSearchContent' }}
export ENABLE_WOPI=${{ matrix.suite == 'apiCollaboration' }}
export ENABLE_OCM=${{ matrix.suite == 'apiOcm' }}
export ENABLE_AUTH_APP=${{ matrix.suite == 'apiAuthApp' }}
# Prepare base charts and deploy
make prepare-charts
kubectl get pods -n ocis-server -Aw&
make deploy-ocis
# Deploy dynamic sidecar elements for OCM suite if required
if [[ "${{ matrix.suite }}" == "apiOcm" ]]; then
OCM=true make prepare-charts
OCM=true make deploy-ocis
fi
- name: Deploy Suite-Specific External Backends
run: |
if [[ "${{ matrix.suite }}" == "apiNotification" || "${{ matrix.suite }}" == "apiSettings" || "${{ matrix.suite }}" == "apiOcm" ]]; then
docker run -d -p 1025:1025 -p 8025:8025 --name mailpit axllent/mailpit:v1.22.3
bash tests/config/k8s/expose-external-svc.sh email:1025
fi
if [[ "${{ matrix.suite }}" == "apiAntivirus" ]]; then
docker run -d -p 3310:3310 --name clamav owncloudci/clamavd
bash tests/config/k8s/expose-external-svc.sh clamav:3310
fi
if [[ "${{ matrix.suite }}" == "apiSearchContent" ]]; then
docker run -d -p 9998:9998 --name tika apache/tika:3.2.2.0-full
bash tests/config/k8s/expose-external-svc.sh tika:9998
fi
- name: Build and Run ociswrapper
run: |
# 1. Build using the explicit Dockerfile path from the repo root context
make -C tests/ociswrapper/
tests/ociswrapper/bin/ociswrapper serve --url https://ocis-server --admin-username admin --admin-password admin --skip-ocis-run -n ocis-server &
- name: Run API tests ${{matrix.suite}}
env:
TEST_SERVER_URL: https://ocis-server
OCIS_REVA_DATA_ROOT: ""
STORAGE_DRIVER: ocis
BEHAT_FILTER_TAGS: "~@skip&&~@skipOnGraph&&~@skipOnOcis-OCIS-Storage"
BEHAT_SUITES: ${{ matrix.suite }}
ACCEPTANCE_TEST_TYPE: core-api
EXPECTED_FAILURES_FILE: tests/acceptance/expected-failures-API-on-OCIS-storage.md
UPLOAD_DELETE_WAIT_TIME: "0"
OCIS_WRAPPER_URL: http://localhost:5200
WITH_REMOTE_PHP: "false"
K8S: "true"
run: |
if [[ "$WITH_REMOTE_PHP" != "true" ]]; then
cat tests/acceptance/expected-failures-without-remotephp.md >> \
"$EXPECTED_FAILURES_FILE"
fi
make test-acceptance-api
- name: Cleanup Environment Setup
run: |
make -C tests/config/k8s cleanup || true
docker rm -vf $(docker ps -aq) || true
@@ -411,4 +411,4 @@ The expected failures in this file are from features in the owncloud/ocis repo.
Note: always have an empty line at the end of this file.
The bash script that processes this file requires that the last line has a newline on the end.
The bash script that processes this file requires that the last line has a newline on the end.
+81 -226
View File
@@ -2,7 +2,6 @@
"""
Run ocis acceptance tests locally and in GitHub Actions CI.
Config sourced from .drone.star localApiTests — single source of truth.
Usage: BEHAT_SUITES=apiGraph python3 tests/acceptance/run-github.py
"""
@@ -17,7 +16,7 @@ import shutil
from pathlib import Path
# ---------------------------------------------------------------------------
# Config sourced from .drone.star
# NOTE: EMAIL_SMTP_HOST is "email" (container name) in drone, "localhost" here
# ---------------------------------------------------------------------------
@@ -169,7 +168,7 @@ for _cfg in LOCAL_API_TESTS.values():
# Drone gives each service its own container → all can use 9300/9301/9304.
# Assign distinct ports here to avoid collisions.
_WOPI_PORTS = {
"collabora": {"grpc": 9301, "http": 9300, "debug": 9304},
"collabora": {"grpc": 9301, "http": 9300, "debug": 9304},
"onlyoffice": {"grpc": 9311, "http": 9310, "debug": 9314},
"fakeoffice": {"grpc": 9321, "http": 9320, "debug": 9324},
}
@@ -185,12 +184,11 @@ def merged_config(suites: list) -> dict:
"collaborationServiceNeeded": False,
"extraServerEnvironment": {},
"extraEnvironment": {},
"k8s": False,
}
for suite in suites:
cfg = _SUITE_TO_CONFIG.get(suite, {})
for flag in ("emailNeeded", "antivirusNeeded", "tikaNeeded",
"federationServer", "collaborationServiceNeeded","k8s"):
"federationServer", "collaborationServiceNeeded"):
if cfg.get(flag):
merged[flag] = True
merged["extraServerEnvironment"].update(cfg.get("extraServerEnvironment", {}))
@@ -217,8 +215,8 @@ def base_server_env(repo_root: Path, ocis_url: str, ocis_config_dir: str) -> dic
"OCIS_JWT_SECRET": "some-ocis-jwt-secret",
"EVENTHISTORY_STORE": "memory",
"OCIS_TRANSLATION_PATH": str(repo_root / "tests/config/translations"),
"WEB_UI_CONFIG_FILE": str(repo_root / "tests/config/drone/ocis-config.json"),
"THUMBNAILS_TXT_FONTMAP_FILE": str(repo_root / "tests/config/drone/fontsMap.json"),
"WEB_UI_CONFIG_FILE": str(repo_root / "tests/config/ci/ocis-config.json"),
"THUMBNAILS_TXT_FONTMAP_FILE": str(repo_root / "tests/config/ci/fontsMap.json"),
# default tika off (overridden by search2 extraServerEnvironment)
"SEARCH_EXTRACTOR_TYPE": "basic",
"FRONTEND_FULL_TEXT_SEARCH_ENABLED": "false",
@@ -305,15 +303,6 @@ def mailpit_healthy() -> bool:
capture_output=True,
).returncode == 0
def wrapper_healthy() -> bool:
return (
subprocess.run(
["curl", "-sf", "http://localhost:5200"],
capture_output=True,
).returncode
== 0
)
def tika_healthy() -> bool:
return subprocess.run(
@@ -356,147 +345,6 @@ def run(cmd: list, env: dict = None, check: bool = True):
return subprocess.run(cmd, env=e, check=check)
def run_k8s_ocis(repo_root: Path, suites: list, cfg: dict) -> int:
"""Run tests using k3d + helm (Drone K8s equivalent)."""
print("Starting K8s test environment...")
os.environ["KUBECONFIG"] = str(Path.home() / ".kube/config")
servers = []
env = {}
# print(cfg["extraServerEnvironment"]['OCIS_ADD_RUN_SERVICES'])
# enable_auth_app = "auth-app" in params["extraServerEnvironment"]["OCIS_ADD_RUN_SERVICES"]
# if cfg.get("antivirusNeeded"):
# env["ENABLE_ANTIVIRUS"]='true'
# servers.append("clamav:3310")
# print("Starting clamav...")
# run(["docker", "run", "-d", "--name", "clamav", "--network", "host",
# "owncloudci/clamavd"])
# wait_for(clamav_healthy, 300, "clamav")
# print("clamav ready.")
# if cfg.get("emailNeeded"):
# env["ENABLE_EMAIL"]='true'
# print("Starting mailpit...")
# run(["docker", "run", "-d", "--name", "mailpit", "--network", "host",
# "axllent/mailpit:v1.22.3"])
# wait_for(mailpit_healthy, 60, "mailpit")
# print("mailpit ready.")
# servers.append("mailpit:1025")
# servers.append("mailpit:1025")
# if cfg.get("tikaNeeded"):
# env["ENABLE_TIKA"]='true'
# print("Starting tika...")
# run(["docker", "run", "-d", "--name", "tika", "--network", "host",
# "apache/tika:3.2.2.0-full"])
# wait_for(tika_healthy, 120, "tika")
# print("tika ready.")
# servers.append("tika:9998")
# if cfg["collaborationServiceNeeded"]:
# procs += fakeOffice() + collaboraService() + onlyofficeService()
# # Wait for each app's /hosting/discovery to return 200 before starting its
# # collaboration service. GetAppURLs in server.go calls discovery synchronously
# # at startup — non-200 exits the process immediately, healthz never binds.
# wait_for(lambda: wopi_discovery_ready("http://localhost:8080"), 300, "fakeoffice discovery", container="fakeoffice")
# wait_for(lambda: wopi_discovery_ready("https://localhost:9980"), 300, "collabora discovery", container="collabora")
# wait_for(lambda: wopi_discovery_ready("https://localhost:443"), 300, "onlyoffice discovery", container="onlyoffice")
# procs += wopiCollaborationService("fakeoffice") + \
# wopiCollaborationService("collabora") + \
# wopiCollaborationService("onlyoffice")
# ocisHealthCheck("wopi", [
# f"localhost:{_WOPI_PORTS['collabora']['debug']}",
# f"localhost:{_WOPI_PORTS['onlyoffice']['debug']}",
# f"localhost:{_WOPI_PORTS['fakeoffice']['debug']}",
# ])
# env["ENABLE_WOPI"]='true'
# servers += ["localhost:9980", "localhost:8080", "localhost:443"]
# if cfg.get("federationServer"):
# env["ENABLE_OCM"]='true'
# if "OCIS_ADD_RUN_SERVICES" in cfg["extraServerEnvironment"] and cfg["extraServerEnvironment"]["OCIS_ADD_RUN_SERVICES"] == "auth-app":
# env["ENABLE_AUTH_APP"]='true'
run(["make", "-C", str(repo_root / "tests/config/k8s"), "create-cluster"])
run(["make", "-C", str(repo_root / "tests/config/k8s"), "prepare-charts"],env)
run(["make", "-C", str(repo_root / "tests/config/k8s"), "deploy-ocis"])
if servers:
run(
[
"bash",
str(repo_root / "tests/config/k8s/expose-external-svc.sh"),
"-n",
"ocis-server",
",".join(servers),
]
)
def run_test(
repo_root: Path,
suites: list,
cfg: dict,
ocis_url: str,
ocis_fed_url: str,
acceptance_test_type: str,
) -> int:
wait_for(lambda: ocis_healthy(ocis_url), 300, "ocis")
print("ocis ready.")
if cfg["federationServer"]:
wait_for(lambda: ocis_healthy(ocis_fed_url), 300, "federation ocis")
print("federation ocis ready.")
# expected failures file
if acceptance_test_type == "core-api":
filter_tags = "~@skipOnGraph&&~@skipOnOcis-OCIS-Storage"
base_failures = (
repo_root / "tests/acceptance/expected-failures-API-on-OCIS-storage.md"
)
else:
filter_tags = "~@skip&&~@skipOnGraph&&~@skipOnOcis-OCIS-Storage"
base_failures = (
repo_root / "tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md"
)
ef_override = os.environ.get("EXPECTED_FAILURES_FILE")
if ef_override:
p = Path(ef_override)
base_failures = p if p.is_absolute() else repo_root / p
filter_tags = "~@skipOnGraph&&~@skipOnOcis-OCIS-Storage"
base_failures = (
repo_root / "tests/acceptance/expected-failures-API-on-OCIS-storage.md"
)
tmp = tempfile.NamedTemporaryFile(mode="w", suffix=".md", delete=False)
tmp.write(base_failures.read_text())
if os.environ.get("WITH_REMOTE_PHP", "false").lower() != "true":
without_rphp = repo_root / "tests/acceptance/expected-failures-without-remotephp.md"
if without_rphp.exists():
tmp.write("\n")
tmp.write(without_rphp.read_text())
tmp.close()
behat_env = {
**os.environ,
"TEST_SERVER_URL": ocis_url,
"TEST_SERVER_FED_URL": ocis_fed_url,
"OCIS_WRAPPER_URL": "http://localhost:5200",
"BEHAT_SUITES": ",".join(suites),
"ACCEPTANCE_TEST_TYPE": "core-api",
"BEHAT_FILTER_TAGS": filter_tags,
"EXPECTED_FAILURES_FILE": tmp.name,
"STORAGE_DRIVER": "ocis",
"UPLOAD_DELETE_WAIT_TIME": "0",
"EMAIL_HOST": "localhost",
"EMAIL_PORT": EMAIL_PORT,
"COLLABORATION_SERVICE_URL": f"http://localhost:{_WOPI_PORTS['fakeoffice']['http']}",
}
behat_env.update(cfg["extraEnvironment"])
print(f"Running suites: {suites} (type: core-api)")
result = subprocess.run(
["make", "-C", str(repo_root), "test-acceptance-api"],
env=behat_env,
)
return result.returncode
def main() -> int:
behat_suites_raw = os.environ.get("BEHAT_SUITES", "").strip()
if not behat_suites_raw:
@@ -505,7 +353,6 @@ def main() -> int:
suites = [s.strip() for s in behat_suites_raw.split(",") if s.strip()]
acceptance_test_type = os.environ.get("ACCEPTANCE_TEST_TYPE", "api")
k8s = os.environ.get("K8S", "false")
repo_root = Path(__file__).resolve().parents[2]
ocis_bin = repo_root / "ocis/bin/ocis"
@@ -515,23 +362,7 @@ def main() -> int:
ocis_fed_url = "https://localhost:10200"
# 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(
mode="w", suffix=".json", prefix="fontsMap-", delete=False)
json.dump({"defaultFont": font_path}, fontmap_tmp)
fontmap_tmp.close()
# assemble ocis server env
cfg = merged_config(suites)
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"])
# optional services
procs = []
run(["make", "-C", str(repo_root / "tests/ociswrapper"), "build"],
env={"GOWORK": "off"})
print(f"Suites: {suites}")
print(f"Services: email={cfg['emailNeeded']} tika={cfg['tikaNeeded']} "
f"antivirus={cfg['antivirusNeeded']} federation={cfg['federationServer']} "
@@ -586,7 +417,7 @@ def main() -> int:
# OCM federation: rewrite providers.json with localhost URLs
if cfg["federationServer"]:
providers_src = repo_root / "tests/config/drone/providers.json"
providers_src = repo_root / "tests/config/ci/providers.json"
providers = json.loads(providers_src.read_text())
for p in providers:
# replace container DNS names with localhost
@@ -604,56 +435,26 @@ def main() -> int:
providers_tmp.close()
cfg["extraServerEnvironment"]["OCM_OCM_PROVIDER_AUTHORIZER_PROVIDERS_FILE"] = providers_tmp.name
if k8s == "true":
ocis_url = "https://ocis-server"
ocis_fed_url = "https://federation-ocis-server"
wrapper_proc = subprocess.Popen(
[
str(wrapper_bin),
"serve",
"--url",
ocis_url,
"--skip-ocis-run",
"-n",
"ocis-server",
"--admin-username",
"admin",
"--admin-password",
"admin",
],
env=server_env,
)
run_k8s_ocis(repo_root,suites,cfg)
run_test(repo_root, suites, cfg, ocis_url, ocis_fed_url,acceptance_test_type)
return wrapper_proc.terminate()
# php deps
run(["composer", "install", "--no-progress"],
env={"COMPOSER_NO_INTERACTION": "1", "COMPOSER_NO_AUDIT": "1"})
run(["composer", "bin", "behat", "install", "--no-progress"],
env={"COMPOSER_NO_INTERACTION": "1", "COMPOSER_NO_AUDIT": "1"})
# generate IDP web assets (required for IDP service to start; matches drone ci-node-generate)
run(["make", "-C", str(repo_root / "services/idp"), "ci-node-generate"])
# download web UI assets (required for robots.txt and other static assets; no pnpm needed)
run(["make", "-C", str(repo_root / "services/web"), "ci-node-generate"])
# build (ENABLE_VIPS=true when libvips-dev is installed, matching drone)
build_env = {}
if subprocess.run(["pkg-config", "--exists", "vips"],
capture_output=True).returncode == 0:
build_env["ENABLE_VIPS"] = "true"
run(["make", "-C", str(repo_root / "ocis"), "build"], env=build_env)
# init ocis
run([str(ocis_bin), "init", "--insecure", "true"])
shutil.copy(
repo_root / "tests/config/drone/app-registry.yaml",
repo_root / "tests/config/ci/app-registry.yaml",
ocis_config_dir / "app-registry.yaml",
)
# generate fontsMap.json with the correct absolute font path for this runner
font_path = str(repo_root / "tests/config/ci/NotoSans.ttf")
fontmap_tmp = tempfile.NamedTemporaryFile(
mode="w", suffix=".json", prefix="fontsMap-", delete=False)
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"])
# start ociswrapper (primary ocis)
print("Starting ocis...")
wrapper_proc = subprocess.Popen(
@@ -690,7 +491,7 @@ def main() -> int:
run([str(ocis_bin), "init", "--insecure", "true",
"--config-path", str(fed_config_dir)])
shutil.copy(
repo_root / "tests/config/drone/app-registry.yaml",
repo_root / "tests/config/ci/app-registry.yaml",
fed_config_dir / "app-registry.yaml",
)
@@ -712,11 +513,11 @@ def main() -> int:
# → healthz never binds → 300s timeout. Use Python's built-in HTTP server
# instead; it handles concurrent connections without gaps.
run(["docker", "run", "-d", "--name", "fakeoffice", "--network", "host",
"-v", f"{repo_root}:/drone/src:ro",
"-v", f"{repo_root}:/ocis:ro",
"python:3-alpine",
"python3", "-c",
"import http.server, pathlib\n"
"body = pathlib.Path('/drone/src/tests/config/drone/hosting-discovery.xml').read_bytes()\n"
"body = pathlib.Path('/ocis/tests/config/ci/hosting-discovery.xml').read_bytes()\n"
"class H(http.server.BaseHTTPRequestHandler):\n"
" def do_GET(self):\n"
" self.send_response(200)\n"
@@ -732,8 +533,8 @@ def main() -> int:
# drone commands copy-pasted verbatim
run(["docker", "run", "-d", "--name", "collabora", "--network", "host",
"-e", "DONT_GEN_SSL_CERT=set",
"-e", "extra_params=--o:ssl.enable=true --o:ssl.termination=true "
"--o:welcome.enable=false --o:net.frame_ancestors=https://localhost:9200",
"-e", f"extra_params=--o:ssl.enable=true --o:ssl.termination=true "
f"--o:welcome.enable=false --o:net.frame_ancestors=https://localhost:9200",
"--entrypoint", "/bin/sh",
"collabora/code:24.04.5.1.1",
"-c", "\n".join([
@@ -751,7 +552,7 @@ def main() -> int:
# Drone avoids this because each service has its own network namespace.
subprocess.run(["sudo", "systemctl", "stop", "postgresql"],
capture_output=True)
only_office_json = repo_root / "tests/config/drone/only-office.json"
only_office_json = repo_root / "tests/config/ci/only-office.json"
run(["docker", "run", "-d", "--name", "onlyoffice", "--network", "host",
"-e", "WOPI_ENABLED=true",
"-e", "USE_UNAUTHORIZED_STORAGE=true",
@@ -858,7 +659,61 @@ def main() -> int:
signal.signal(signal.SIGINT, cleanup)
try:
run_test(repo_root, suites, cfg, ocis_url, ocis_fed_url,acceptance_test_type)
wait_for(lambda: ocis_healthy(ocis_url), 300, "ocis")
print("ocis ready.")
if cfg["federationServer"]:
wait_for(lambda: ocis_healthy(ocis_fed_url), 300, "federation ocis")
print("federation ocis ready.")
# expected failures file
if acceptance_test_type == "core-api":
filter_tags = "~@skipOnGraph&&~@skipOnOcis-OCIS-Storage"
base_failures = repo_root / "tests/acceptance/expected-failures-API-on-OCIS-storage.md"
else:
filter_tags = "~@skip&&~@skipOnGraph&&~@skipOnOcis-OCIS-Storage"
base_failures = repo_root / "tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md"
ef_override = os.environ.get("EXPECTED_FAILURES_FILE")
if ef_override:
p = Path(ef_override)
base_failures = p if p.is_absolute() else repo_root / p
# merge expected-failures-without-remotephp.md only when not using remote.php
# (mirrors drone.star: "" if run_with_remote_php else "cat ...without-remotephp.md >> ...")
tmp = tempfile.NamedTemporaryFile(mode="w", suffix=".md", delete=False)
tmp.write(base_failures.read_text())
if os.environ.get("WITH_REMOTE_PHP", "false").lower() != "true":
without_rphp = repo_root / "tests/acceptance/expected-failures-without-remotephp.md"
if without_rphp.exists():
tmp.write("\n")
tmp.write(without_rphp.read_text())
tmp.close()
# run tests
behat_env = {
**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,
"STORAGE_DRIVER": "ocis",
"UPLOAD_DELETE_WAIT_TIME": "0",
"EMAIL_HOST": "localhost",
"EMAIL_PORT": EMAIL_PORT,
"COLLABORATION_SERVICE_URL": f"http://localhost:{_WOPI_PORTS['fakeoffice']['http']}",
}
behat_env.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
finally:
cleanup()
+4 -2
View File
@@ -5,8 +5,10 @@ HOST_IP := $(shell ip route get 1 | awk '{print $$7}')
OCM ?= false
DOMAIN := ocis-server
CLUSTER := local-ocis
ifeq ($(OCM), true)
DOMAIN := federation-ocis-server
CLUSTER := local-ocis-fed
endif
.PHONY: create-cluster
@@ -14,7 +16,7 @@ create-cluster:
@echo $(LOGS_DIR)
@mkdir -p $(LOGS_DIR)
@chmod 777 $(LOGS_DIR)
k3d cluster create local-ocis \
k3d cluster create $(CLUSTER) \
-p '80:80@loadbalancer' -p '443:443@loadbalancer' -p '9100-9399:30100-30399@loadbalancer' \
--k3s-arg '--tls-san=k3d@server:*' --k3s-arg '--disable=metrics-server@server:*' \
--host-alias $(HOST_IP):ocis-server --host-alias $(HOST_IP):federation-ocis-server \
@@ -40,6 +42,6 @@ show-logs:
.PHONY: cleanup
cleanup:
k3d cluster delete local-ocis
k3d cluster delete $(CLUSTER)
rm -rf $(LOGS_DIR)
rm -rf $(CHART_REPO)
+7 -7
View File
@@ -1,7 +1,7 @@
---
image:
repository: owncloud/ocis-rolling
tag: 8.0.2-rc.1
repository: owncloud/ocis
tag: master
ingress:
enabled: true
ingressClassName: traefik
@@ -17,7 +17,7 @@ features:
authapp:
enabled: false
emailNotifications:
enabled: true
enabled: false
smtp:
host: email
port: 1025
@@ -27,7 +27,7 @@ features:
branding:
enabled: false
virusscan:
enabled: true
enabled: false
infectedFileHandling: delete
policies:
enabled: false
@@ -166,12 +166,12 @@ services:
concurrency: 10
search:
extractor:
type: tika
type: basic
tika:
url: http://localhost:9998
url: http://tika:9998
persistence:
enabled: true
accessModes:
- ReadWriteOnce
secretRefs:
notificationsSmtpSecretRef: notifications-smtp-secret
notificationsSmtpSecretRef: notifications-smtp-secret
+1 -1
View File
@@ -87,4 +87,4 @@ func Rollback() (bool, string) {
}
}
return true, "ok"
}
}