Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Acceptance Tests

on:
pull_request:
# pull_request:
workflow_dispatch:

jobs:
Expand Down
102 changes: 90 additions & 12 deletions .github/workflows/k8s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ env:
PHP_VERSION: "8.4"
K3D_VERSION: "v5.8.3"
HELM_VERSION: "v3.18.4"
TEST_SERVER_DOMAIN: ocis-server
FED_SERVER_DOMAIN: federation-ocis-server
TEST_SERVER_URL: https://ocis-server
FED_SERVER_URL: https://federation-ocis-server
STORAGE_DRIVER: ocis
OCIS_WRAPPER_URL: http://localhost:5200
K8S: true
Expand Down Expand Up @@ -62,7 +65,7 @@ jobs:
- suite: apiAuthApp
- suite: apiAntivirus
- suite: apiOcm
# - suite: apiCollaboration
- suite: apiCollaboration
- suite: apiVault
- suite: "coreApiAuth,coreApiCapabilities,coreApiFavorites,coreApiMain,coreApiVersions"
- suite: "coreApiShareManagementBasicToShares,coreApiShareManagementToShares"
Expand Down Expand Up @@ -105,7 +108,7 @@ jobs:

- name: Prepare hosts
run: |
echo "127.0.0.1 ocis-server clamav email collabora onlyoffice fakeoffice tika federation-ocis-server keycloak" \
echo "127.0.0.1 $TEST_SERVER_DOMAIN clamav email collabora onlyoffice fakeoffice tika $FED_SERVER_DOMAIN keycloak" \
| sudo tee -a /etc/hosts

- name: Spin up K3d Cluster
Expand Down Expand Up @@ -181,11 +184,11 @@ jobs:

# patch the realm so the "web" client's redirect/origin URLs match
# the k8s ingress domain instead of the non-k8s "localhost:9200" one
sed 's|https://localhost:9200|https://ocis-server|g' \
sed 's|https://localhost:9200|${TEST_SERVER_URL}|g' \
tests/config/ci/ocis-mfa-ci-realm.dist.json > /tmp/ocis-realm.json

docker run -d --name keycloak --network host \
-e OCIS_DOMAIN=https://ocis-server \
-e OCIS_DOMAIN="$TEST_SERVER_URL" \
-e KC_HOSTNAME=keycloak \
-e KC_PORT=8443 \
-e KC_DB=postgres \
Expand Down Expand Up @@ -213,34 +216,109 @@ jobs:
bash tests/config/k8s/expose-external-svc.sh keycloak:8443
fi

if [[ "${{ matrix.suite }}" == "apiCollaboration" ]]; then
# Start Collabora
docker run -d \
--name collabora \
--network host \
--entrypoint bash \
-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://127.0.0.1:9200" \
collabora/code:25.04.7.3.1 \
-c "coolconfig generate-proof-key && bash /start-collabora-online.sh"
timeout 150 bash -c 'until curl -kfsSL https://localhost:9980/hosting/discovery > /dev/null; do sleep 5; done'
echo "collabora ready."

# Start OnlyOffice
echo "${{ github.workspace }}"
echo "$(pwd)"
sudo systemctl stop postgresql || true
docker run -d \
--name onlyoffice \
-p 8443:443 \
-e WOPI_ENABLED=true \
-e USE_UNAUTHORIZED_STORAGE=true \
-v "$(pwd)/tests/config/ci/only-office.json:/tmp/local.json:ro" \
--entrypoint /bin/sh \
onlyoffice/documentserver:9.2.1 \
-c "set -e
cp /tmp/local.json /etc/onlyoffice/documentserver/local.json
openssl req -x509 -newkey rsa:4096 -keyout onlyoffice.key -out onlyoffice.crt -sha256 -days 365 -batch -nodes
mkdir -p /var/www/onlyoffice/Data/certs
cp onlyoffice.key /var/www/onlyoffice/Data/certs/
cp onlyoffice.crt /var/www/onlyoffice/Data/certs/
chmod 400 /var/www/onlyoffice/Data/certs/onlyoffice.key
/app/ds/run-document-server.sh"
timeout 150 bash -c 'until curl -kfsSL https://localhost:8443/hosting/discovery > /dev/null; do sleep 5; done'
echo "onlyoffice ready."

#Start FakeOffice
docker run -d --name fakeoffice --network host \
-v "$(pwd):/ocis:ro" \
python:3-alpine \
python3 -c "
import http.server, pathlib
body = pathlib.Path('/ocis/tests/config/ci/hosting-discovery.xml').read_bytes()
class H(http.server.BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-Type', 'text/xml')
self.end_headers()
self.wfile.write(body)
def log_message(self, *a): pass
http.server.HTTPServer(('', 8080), H).serve_forever()
"
timeout 60 bash -c 'until curl -fsSL http://localhost:8080/hosting/discovery > /dev/null; do sleep 5; done'
echo "fakeoffice ready."

bash tests/config/k8s/expose-external-svc.sh -n "$TEST_SERVER_DOMAIN" collabora:9980
bash tests/config/k8s/expose-external-svc.sh -n "$TEST_SERVER_DOMAIN" onlyoffice:8443
bash tests/config/k8s/expose-external-svc.sh -n "$TEST_SERVER_DOMAIN" fakeoffice:8080
fi

- name: Deploy oCIS
run: |
cd tests/config/k8s
kubectl get pods -n ocis-server -Aw &
kubectl get pods -n "$TEST_SERVER_DOMAIN" -Aw &
make deploy-ocis
if [[ "${{ matrix.suite }}" == "apiOcm" ]]; then
OCM=true make deploy-ocis
fi

- name: Post Deployment
if: ${{ matrix.suite == 'apiCollaboration' }}
run: |
kubectl -n "$TEST_SERVER_DOMAIN" expose deployment collaboration-collabora --type=NodePort --port=9300 --name=collaboration-collabora-30300-np
kubectl -n "$TEST_SERVER_DOMAIN" patch svc collaboration-collabora-30300-np -p '{"spec":{"ports":[{"port":9300,"nodePort":30300}]}}'

kubectl -n "$TEST_SERVER_DOMAIN" expose deployment collaboration-fakeoffice --type=NodePort --port=9300 --name=collaboration-fakeoffice-30301-np
kubectl -n "$TEST_SERVER_DOMAIN" patch svc collaboration-fakeoffice-30301-np -p '{"spec":{"ports":[{"port":9300,"nodePort":30301}]}}'

kubectl -n "$TEST_SERVER_DOMAIN" expose deployment collaboration-onlyoffice --type=NodePort --port=9300 --name=collaboration-onlyoffice-30302-np
kubectl -n "$TEST_SERVER_DOMAIN" patch svc collaboration-onlyoffice-30302-np -p '{"spec":{"ports":[{"port":9300,"nodePort":30302}]}}'

kubectl -n "$TEST_SERVER_DOMAIN" expose deployment collaboration-fakeoffice --type=NodePort --port=9304 --name=collaboration-fakeoffice-30304-np
kubectl -n "$TEST_SERVER_DOMAIN" patch svc collaboration-fakeoffice-30304-np -p '{"spec":{"ports":[{"port":9304,"nodePort":30304}]}}'

- name: Wait for oCIS to be ready
env:
FILE_URL: ${{ env.TEST_SERVER_URL }}/remote.php/dav/files/admin/hello1.txt
run: |
kubectl wait \
--namespace ocis-server \
--namespace "$TEST_SERVER_DOMAIN" \
--for=condition=Available \
deployment \
--all \
--timeout=10m

kubectl wait \
--namespace ocis-server \
--namespace "$TEST_SERVER_DOMAIN" \
--for=condition=Ready \
pod \
--all \
--timeout=10m

kubectl get pods -n ocis-server
kubectl get pods -n "$TEST_SERVER_DOMAIN"

retry() {
local label=$1
Expand All @@ -264,7 +342,7 @@ jobs:
# reached via port-forward since it isn't exposed by any Service.
# local port 19205 (not 9205): 9100-9399 is already bound on the
# host by the k3d loadbalancer's NodePort range, see create-cluster.
kubectl -n ocis-server port-forward deployment/proxy 19205:9205 &
kubectl -n "$TEST_SERVER_DOMAIN" port-forward deployment/proxy 19205:9205 &
PORT_FORWARD_PID=$!
trap 'kill $PORT_FORWARD_PID 2>/dev/null' EXIT

Expand Down Expand Up @@ -316,7 +394,7 @@ jobs:
run: |
(
while true; do
kubectl -n ocis-server port-forward deployment/proxy 19205:9205 >> /tmp/proxy-readyz-portforward.log 2>&1
kubectl -n "$TEST_SERVER_DOMAIN" port-forward deployment/proxy 19205:9205 >> /tmp/proxy-readyz-portforward.log 2>&1
sleep 1
done
) &
Expand All @@ -331,7 +409,7 @@ jobs:
--admin-username admin \
--admin-password admin \
--skip-ocis-run \
-n ocis-server &
-n "$TEST_SERVER_DOMAIN" &

- name: Prepare expected failures
if: startsWith( matrix.suite, 'core' )
Expand All @@ -348,7 +426,7 @@ jobs:
if: startsWith( matrix.suite, 'api' )
env:
TEST_SERVER_URL: ${{ env.TEST_SERVER_URL }}
TEST_SERVER_FED_URL: https://federation-ocis-server
TEST_SERVER_FED_URL: ${{ env.FED_SERVER_URL }}
STORAGE_DRIVER: ${{ env.STORAGE_DRIVER }}
BEHAT_SUITES: ${{ matrix.suite }}
BEHAT_FILTER_TAGS: "~@skip&&~@skipOnGraph&&~@skipOnOcis-OCIS-Storage"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/web-tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Web Tests

on:
pull_request:
# pull_request:
push:
branches: [master, stable-*]

Expand Down
5 changes: 5 additions & 0 deletions tests/config/k8s/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ if [[ "$ENABLE_WOPI" == "true" ]]; then
# patch collaboration service
# - allow dynamic wopi src
sed -i -E "s|value: http://.*:9300|value: {{ \$officeSuite.wopiSrc }}|" $TPL_DIR/collaboration/deployment.yaml
sed -i \
-e 's/{{- include "ocis.extraEnvs" \. | nindent 12 }}/{{- include "ocis.extraEnvs" $ | nindent 12 }}/' \
-e 's/{{- include "ocis.extraVolMounts" \. | nindent 12 }}/{{- include "ocis.extraVolMounts" $ | nindent 12 }}/' \
-e 's/{{- include "ocis.extraVolumes" \. | nindent 8 }}/{{- include "ocis.extraVolumes" $ | nindent 8 }}/' \
$TPL_DIR/collaboration/deployment.yaml
fi

if [[ "$ENABLE_OCM" == "true" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion tests/config/k8s/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ features:
ingress:
enabled: false
- name: 'OnlyOffice'
uri: 'https://onlyoffice'
uri: 'https://onlyoffice:8443'
wopiSrc: 'http://ocis-server:9302'
product: 'OnlyOffice'
enabled: true
Expand Down
Loading