From 2e493be2d20a6ae03ec9e3bc6364e8cd3f28fe40 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Wed, 14 Jan 2026 17:58:54 +0545 Subject: [PATCH 1/6] test: setup for running wopi API tests locally Signed-off-by: Saw-jan --- .woodpecker.star | 2 +- tests/acceptance/docker/Makefile | 64 ++++++----- .../docker/src/onlyoffice-entrypoint.sh | 10 ++ .../acceptance/docker/src/opencloud-base.yml | 9 +- tests/acceptance/docker/src/wopi.yml | 105 ++++++++++++++++++ 5 files changed, 157 insertions(+), 33 deletions(-) create mode 100644 tests/acceptance/docker/src/onlyoffice-entrypoint.sh create mode 100644 tests/acceptance/docker/src/wopi.yml diff --git a/.woodpecker.star b/.woodpecker.star index 7fa2e17f18..19b099345c 100644 --- a/.woodpecker.star +++ b/.woodpecker.star @@ -3293,7 +3293,7 @@ def wopiCollaborationService(name): environment["COLLABORATION_APP_ADDR"] = "https://onlyoffice" environment["COLLABORATION_APP_ICON"] = "https://onlyoffice/web-apps/apps/documenteditor/main/resources/img/favicon.ico" elif name == "fakeoffice": - environment["COLLABORATION_SERVICE_NAME"] = "collboration-fakeoficce" + environment["COLLABORATION_SERVICE_NAME"] = "collaboration-fakeoffice" environment["COLLABORATION_APP_NAME"] = "FakeOffice" environment["COLLABORATION_APP_PRODUCT"] = "Microsoft" environment["COLLABORATION_APP_ADDR"] = "http://fakeoffice:8080" diff --git a/tests/acceptance/docker/Makefile b/tests/acceptance/docker/Makefile index dbc839d5ba..8332628626 100644 --- a/tests/acceptance/docker/Makefile +++ b/tests/acceptance/docker/Makefile @@ -1,3 +1,4 @@ +.ONESHELL: SHELL := bash # define standard colors @@ -24,7 +25,7 @@ endif ## user input BEHAT_FEATURE ?= - +TEST_SOURCE ?= opencloud ifdef OC_IMAGE_TAG BUILD_DEV_IMAGE := 0 @@ -224,28 +225,25 @@ $(targets): .PHONY: testSuite testSuite: $(OC_WRAPPER) build-dev-image clean-docker-container - @if [ -n "${START_CEPH}" ]; then \ - COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \ - COMPOSE_FILE=src/ceph.yml \ - docker compose run start_ceph; \ - fi; \ - if [ "${START_EMAIL}" == "true" ]; then \ - COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \ - COMPOSE_FILE=src/email.yml \ - docker compose run start_email; \ - fi; \ - if [ "${START_ANTIVIRUS}" == "true" ]; then \ - COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \ - COMPOSE_FILE=src/antivirus.yml \ - docker compose run start_antivirus; \ - fi; \ - if [ "${START_TIKA}" == "true" ]; then \ - COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \ - COMPOSE_FILE=src/tika.yml \ - docker compose run tika-service; \ - fi; \ - COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \ - COMPOSE_FILE=$(COMPOSE_FILE) \ + @export COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) + COMPOSE_FILE=$(COMPOSE_FILE) + if [ "${STORAGE_DRIVER}" = "decomposeds3" ]; then + docker compose -f src/ceph.yml run start_ceph + fi + if [ "${START_EMAIL}" = "true" ]; then + docker compose -f src/email.yml run start_email + fi + if [ "${START_ANTIVIRUS}" = "true" ]; then + docker compose -f src/antivirus.yml run start_antivirus + fi + if [ "${START_TIKA}" = "true" ]; then + docker compose -f src/tika.yml run tika-service + fi + if [ "${ENABLE_WOPI}" = "true" ]; then + COMPOSE_FILE=${COMPOSE_FILE}:src/wopi.yml + fi + + COMPOSE_FILE=$$COMPOSE_FILE \ STORAGE_DRIVER=$(STORAGE_DRIVER) \ TEST_SOURCE=$(TEST_SOURCE) \ WITH_WRAPPER=$(WITH_WRAPPER) \ @@ -263,13 +261,11 @@ testSuite: $(OC_WRAPPER) build-dev-image clean-docker-container .PHONY: show-test-logs show-test-logs: ## show logs of test @COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \ - COMPOSE_FILE=$(COMPOSE_FILE) \ docker compose logs --no-log-prefix -f acceptance-tests | less .PHONY: ps ps: ## show docker status @COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \ - COMPOSE_FILE=$(COMPOSE_FILE) \ docker compose ps $(OC_WRAPPER): @@ -285,7 +281,7 @@ build-dev-image: .PHONY: clean-dev-docker-image clean-dev-docker-image: ## clean docker image built during acceptance tests - @docker image rm opencloud-eu/opencloud:dev || true + @docker image rm opencloudeu/opencloud:dev || true .PHONY: clean-docker-container clean-docker-container: ## clean docker containers created during acceptance tests @@ -315,6 +311,9 @@ clean-docker-volumes: ## clean docker volumes created during acceptance tests clean-files: @$(MAKE) --no-print-directory -C ../../../. clean-tests +.PHONY: clean +clean-compose: clean-docker-container clean-docker-volumes clean-files + .PHONY: clean clean: clean-docker-container clean-docker-volumes clean-dev-docker-image clean-files ## clean all @@ -328,6 +327,17 @@ start-server: $(OC_WRAPPER) ## build and start server TEST_SOURCE=opencloud \ STORAGE_DRIVER=$(STORAGE_DRIVER) \ OC_ASYNC_UPLOADS=true \ - SEARCH_EXTRACTOR_TYPE=tika \ + SEARCH_EXTRACTOR_TYPE=$(SEARCH_EXTRACTOR_TYPE) \ OC_ADD_RUN_SERVICES=notifications \ docker compose up -d --build --force-recreate + +.PHONY: run-test +run-test: + COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \ + STORAGE_DRIVER=$(STORAGE_DRIVER) \ + TEST_SOURCE=$(TEST_SOURCE) \ + BEHAT_SUITE=$(BEHAT_SUITE) \ + BEHAT_FEATURE=$(BEHAT_FEATURE) \ + DIVIDE_INTO_NUM_PARTS=$(DIVIDE_INTO_NUM_PARTS) \ + RUN_PART=$(RUN_PART) \ + docker compose -f src/acceptance.yml up diff --git a/tests/acceptance/docker/src/onlyoffice-entrypoint.sh b/tests/acceptance/docker/src/onlyoffice-entrypoint.sh new file mode 100644 index 0000000000..c65968745c --- /dev/null +++ b/tests/acceptance/docker/src/onlyoffice-entrypoint.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e + +mkdir -p /var/www/onlyoffice/Data/certs +cd /var/www/onlyoffice/Data/certs +openssl req -x509 -newkey rsa:4096 -keyout onlyoffice.key -out onlyoffice.crt -sha256 -days 365 -batch -nodes +chmod 400 /var/www/onlyoffice/Data/certs/onlyoffice.key + +/app/ds/run-document-server.sh diff --git a/tests/acceptance/docker/src/opencloud-base.yml b/tests/acceptance/docker/src/opencloud-base.yml index c7d487f872..b08e977dc9 100644 --- a/tests/acceptance/docker/src/opencloud-base.yml +++ b/tests/acceptance/docker/src/opencloud-base.yml @@ -1,7 +1,7 @@ services: opencloud-server: image: opencloudeu/opencloud:dev - entrypoint: [ "/bin/sh", "/usr/bin/serve-opencloud.sh" ] + entrypoint: ["/bin/sh", "/usr/bin/serve-opencloud.sh"] user: root environment: WITH_WRAPPER: $WITH_WRAPPER @@ -22,7 +22,6 @@ services: OC_ASYNC_UPLOADS: $OC_ASYNC_UPLOADS OC_ADD_RUN_SERVICES: $OC_ADD_RUN_SERVICES PROXY_HTTP_ADDR: "0.0.0.0:9200" - OC_JWT_SECRET: "some-random-jwt-secret" # decomposeds3 specific settings STORAGE_USERS_DECOMPOSEDS3_ENDPOINT: http://ceph:8080 @@ -52,9 +51,9 @@ services: # fonts map for txt thumbnails (including unicode support) THUMBNAILS_TXT_FONTMAP_FILE: "/woodpecker/src/github.com/opencloud-eu/opencloud/tests/config/drone/fontsMap.json" ports: - - '9200:9200' - - '5200:5200' ## ocwrapper - - '9174:9174' ## notifications debug + - "9200:9200" + - "5200:5200" ## ocwrapper + - "9174:9174" ## notifications debug volumes: - ../../../config:/woodpecker/src/github.com/opencloud-eu/opencloud/tests/config - ../../../ocwrapper/bin/ocwrapper:/usr/bin/ocwrapper diff --git a/tests/acceptance/docker/src/wopi.yml b/tests/acceptance/docker/src/wopi.yml new file mode 100644 index 0000000000..c848f1d3c6 --- /dev/null +++ b/tests/acceptance/docker/src/wopi.yml @@ -0,0 +1,105 @@ +x-common_config: &common_config + image: opencloudeu/opencloud:dev + restart: unless-stopped + entrypoint: /bin/sh + command: ["-c", "opencloud collaboration server"] + user: root + +x-common_env: &common_env + OC_CONFIG_DIR: /etc/opencloud + MICRO_REGISTRY: nats-js-kv + MICRO_REGISTRY_ADDRESS: opencloud-server:9233 + COLLABORATION_LOG_LEVEL: info + COLLABORATION_GRPC_ADDR: 0.0.0.0:9301 + COLLABORATION_HTTP_ADDR: 0.0.0.0:9300 + COLLABORATION_DEBUG_ADDR: 0.0.0.0:9304 + COLLABORATION_APP_PROOF_DISABLE: true + COLLABORATION_APP_INSECURE: true + COLLABORATION_CS3API_DATAGATEWAY_INSECURE: true + COLLABORATION_WOPI_SECRET: some-wopi-secret + +x-config_volume: &config_volume + - config:/etc/opencloud + +x-depends_on: &depends_on + - opencloud-server + +services: + opencloud-server: + environment: + OC_CONFIG_DIR: /etc/opencloud + GATEWAY_GRPC_ADDR: 0.0.0.0:9142 + NATS_NATS_HOST: 0.0.0.0 + NATS_NATS_PORT: 9233 + volumes: *config_volume + + fakeoffice: + image: alpine:latest + entrypoint: /bin/sh + command: + [ + "-c", + "while true; do echo -e \"HTTP/1.1 200 OK\n\n$(cat /fakeoffice-discovery.xml)\" | nc -l -k -p 8080; done", + ] + healthcheck: + test: ["CMD", "curl", "-f", "http://fakeoffice:8080"] + volumes: + - ./../../../config/woodpecker/hosting-discovery.xml:/fakeoffice-discovery.xml + + collabora: + image: collabora/code:24.04.5.1.1 + environment: + DONT_GEN_SSL_CERT: set + extra_params: --o:ssl.enable=true --o:ssl.termination=true --o:welcome.enable=false --o:net.frame_ancestors=https://opencloud-server:9200 + entrypoint: /bin/sh + command: ["-c", "coolconfig generate-proof-key; /start-collabora-online.sh"] + + onlyoffice: + image: onlyoffice/documentserver:7.5.1 + environment: + WOPI_ENABLED: true + USE_UNAUTHORIZED_STORAGE: true + entrypoint: bash /entrypoint.sh + volumes: + - ./onlyoffice-entrypoint.sh:/entrypoint.sh + + collaboration-fakeoffice: + <<: *common_config + environment: + <<: *common_env + COLLABORATION_SERVICE_NAME: collaboration-fakeoffice + COLLABORATION_APP_NAME: FakeOffice + COLLABORATION_APP_PRODUCT: Microsoft + COLLABORATION_APP_ADDR: http://fakeoffice:8080 + COLLABORATION_WOPI_SRC: http://collaboration-fakeoffice:9300 + volumes: *config_volume + depends_on: *depends_on + + collaboration-collabora: + <<: *common_config + environment: + <<: *common_env + COLLABORATION_SERVICE_NAME: collaboration-collabora + COLLABORATION_APP_NAME: Collabora + COLLABORATION_APP_PRODUCT: Collabora + COLLABORATION_APP_ADDR: https://collabora:9980 + COLLABORATION_APP_ICON: https://collabora:9980/favicon.ico + COLLABORATION_WOPI_SRC: http://collaboration-collabora:9300 + volumes: *config_volume + depends_on: *depends_on + + collaboration-onlyoffice: + <<: *common_config + environment: + <<: *common_env + COLLABORATION_SERVICE_NAME: collaboration-onlyoffice + COLLABORATION_APP_NAME: OnlyOffice + COLLABORATION_APP_PRODUCT: OnlyOffice + COLLABORATION_APP_ADDR: https://onlyoffice + COLLABORATION_APP_ICON: https://onlyoffice/web-apps/apps/documenteditor/main/resources/img/favicon.ico + COLLABORATION_WOPI_SRC: http://collaboration-onlyoffice:9300 + volumes: *config_volume + depends_on: *depends_on + +volumes: + config: From f0e5c23a76af7320be16ed412cab4712f84f230e Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Thu, 15 Jan 2026 16:57:20 +0545 Subject: [PATCH 2/6] docs: add docs to run wopi API tests Signed-off-by: Saw-jan --- tests/README.md | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/tests/README.md b/tests/README.md index 84576233d3..e7b9742334 100644 --- a/tests/README.md +++ b/tests/README.md @@ -19,7 +19,7 @@ Basically we have two sources for feature tests and test suites: At the moment, both can be applied to OpenCloud. -As a storage backend, we support the OpenCloud native storage, also called `decomposed`. This stores files directly on disk. Along with that we also provide `decomposeds3`, `posix` storage drivers. +As a storage backend, we support the OpenCloud native storage, also called `decomposed`. This stores files directly on disk. Along with that we also provide `decomposeds3`, `posix` storage drivers. You can invoke two types of test suite runs: @@ -154,6 +154,23 @@ make -C tests/acceptance/docker test-core-feature-decomposed-storage Note: The test suites transferred from core have `coreApi` prefixed +### Running Collaboration API Tests Locally + +Running collaboration API tests requires extra services. You can enable the required services by providing the environment variable `ENABLE_WOPI=true` while running the tests. + +```bash +ENABLE_WOPI=true \ +BEHAT_FEATURE='tests/acceptance/features/apiCollaboration/checkFileInfo.feature' \ +make -C tests/acceptance/docker test-opencloud-feature-decomposed-storage +``` + +If the tests fail due to the servers not being ready, you can re-run the tests using the following command: + +```bash +BEHAT_FEATURE='tests/acceptance/features/apiCollaboration/checkFileInfo.feature' \ +make -C tests/acceptance/docker run-test +``` + ### OpenCloud Image to Be Tested (Skip Local Image Build) By default, the tests will be run against the docker image built from your current working state of the OpenCloud repository. For some purposes it might also be handy to use an OpenCloud image from Docker Hub. Therefore, you can provide the optional flag `OC_IMAGE_TAG=...` which must contain an available docker tag of the [opencloud-eu/opencloud registry on Docker Hub](https://hub.docker.com/r/opencloud-eu/opencloud) (e.g. 'latest'). @@ -573,17 +590,17 @@ The sample `fontsMap.json` file is located in `tests/config/drone/fontsMap.json` ### Build dev docker ```bash -make -C opencloud dev-docker +make -C opencloud dev-docker ``` ### Choose STORAGE_DRIVER -By default, the system uses `posix` storage. However, you can override this by setting the `STORAGE_DRIVER` environment variable. +By default, the system uses `posix` storage. However, you can override this by setting the `STORAGE_DRIVER` environment variable. -### Run a script that starts the openCloud server in the docker and runs the API tests locally (for debugging purposes) +### Run a script that starts the openCloud server in the docker and runs the API tests locally (for debugging purposes) ```bash -STORAGE_DRIVER=posix ./tests/acceptance/run_api_tests.sh +STORAGE_DRIVER=posix ./tests/acceptance/run_api_tests.sh ``` ## Running WOPI Validator Tests From 6b828dec2a3daf566dbf65fee7d5c41754324b3f Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Thu, 15 Jan 2026 17:02:46 +0545 Subject: [PATCH 3/6] chore: remove unnecessary target Signed-off-by: Saw-jan --- tests/acceptance/docker/Makefile | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/acceptance/docker/Makefile b/tests/acceptance/docker/Makefile index 8332628626..d7084f9b17 100644 --- a/tests/acceptance/docker/Makefile +++ b/tests/acceptance/docker/Makefile @@ -311,9 +311,6 @@ clean-docker-volumes: ## clean docker volumes created during acceptance tests clean-files: @$(MAKE) --no-print-directory -C ../../../. clean-tests -.PHONY: clean -clean-compose: clean-docker-container clean-docker-volumes clean-files - .PHONY: clean clean: clean-docker-container clean-docker-volumes clean-dev-docker-image clean-files ## clean all From 65252a50186dc47fc4922b4fa8585f9f51f17469 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Fri, 16 Jan 2026 11:05:51 +0545 Subject: [PATCH 4/6] test: export compose file env Signed-off-by: Saw-jan --- tests/acceptance/docker/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/acceptance/docker/Makefile b/tests/acceptance/docker/Makefile index d7084f9b17..1386489a67 100644 --- a/tests/acceptance/docker/Makefile +++ b/tests/acceptance/docker/Makefile @@ -225,8 +225,9 @@ $(targets): .PHONY: testSuite testSuite: $(OC_WRAPPER) build-dev-image clean-docker-container - @export COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) - COMPOSE_FILE=$(COMPOSE_FILE) + @export COMPOSE_PROJECT_NAME="$(COMPOSE_PROJECT_NAME)" + export COMPOSE_FILE="$(COMPOSE_FILE)" + if [ "${STORAGE_DRIVER}" = "decomposeds3" ]; then docker compose -f src/ceph.yml run start_ceph fi @@ -243,7 +244,6 @@ testSuite: $(OC_WRAPPER) build-dev-image clean-docker-container COMPOSE_FILE=${COMPOSE_FILE}:src/wopi.yml fi - COMPOSE_FILE=$$COMPOSE_FILE \ STORAGE_DRIVER=$(STORAGE_DRIVER) \ TEST_SOURCE=$(TEST_SOURCE) \ WITH_WRAPPER=$(WITH_WRAPPER) \ From 99020a4605b3559b5a31fa50d8cd9fb2bf73c5aa Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Fri, 16 Jan 2026 11:08:09 +0545 Subject: [PATCH 5/6] docs(test): use posix examples Signed-off-by: Saw-jan --- tests/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/README.md b/tests/README.md index e7b9742334..7eed0f72c9 100644 --- a/tests/README.md +++ b/tests/README.md @@ -161,7 +161,7 @@ Running collaboration API tests requires extra services. You can enable the requ ```bash ENABLE_WOPI=true \ BEHAT_FEATURE='tests/acceptance/features/apiCollaboration/checkFileInfo.feature' \ -make -C tests/acceptance/docker test-opencloud-feature-decomposed-storage +make -C tests/acceptance/docker test-opencloud-feature-posix-storage ``` If the tests fail due to the servers not being ready, you can re-run the tests using the following command: @@ -628,6 +628,7 @@ TEST_GROUP=BaseWopiViewing docker compose -f tests/acceptance/docker/src/wopi-va ``` ### for macOS use arm image + ```bash WOPI_VALIDATOR_IMAGE=scharfvi/wopi-validator \ TEST_GROUP=BaseWopiViewing \ From 0c55b6dfa61570f6a056f697af6a06ced0df9b47 Mon Sep 17 00:00:00 2001 From: Viktor Scharf Date: Fri, 16 Jan 2026 12:11:58 +0100 Subject: [PATCH 6/6] adapt for macos --- tests/acceptance/docker/Makefile | 44 ++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/tests/acceptance/docker/Makefile b/tests/acceptance/docker/Makefile index 1386489a67..01d6729308 100644 --- a/tests/acceptance/docker/Makefile +++ b/tests/acceptance/docker/Makefile @@ -225,25 +225,31 @@ $(targets): .PHONY: testSuite testSuite: $(OC_WRAPPER) build-dev-image clean-docker-container - @export COMPOSE_PROJECT_NAME="$(COMPOSE_PROJECT_NAME)" - export COMPOSE_FILE="$(COMPOSE_FILE)" - - if [ "${STORAGE_DRIVER}" = "decomposeds3" ]; then - docker compose -f src/ceph.yml run start_ceph - fi - if [ "${START_EMAIL}" = "true" ]; then - docker compose -f src/email.yml run start_email - fi - if [ "${START_ANTIVIRUS}" = "true" ]; then - docker compose -f src/antivirus.yml run start_antivirus - fi - if [ "${START_TIKA}" = "true" ]; then - docker compose -f src/tika.yml run tika-service - fi - if [ "${ENABLE_WOPI}" = "true" ]; then - COMPOSE_FILE=${COMPOSE_FILE}:src/wopi.yml - fi - + @COMPOSE_FILE_VAR="$(COMPOSE_FILE)"; \ + \ + if [ "${STORAGE_DRIVER}" = "decomposeds3" ]; then \ + COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \ + docker compose -f src/ceph.yml run start_ceph; \ + fi; \ + if [ "${START_EMAIL}" = "true" ]; then \ + COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \ + docker compose -f src/email.yml run start_email; \ + fi; \ + if [ "${START_ANTIVIRUS}" = "true" ]; then \ + COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \ + docker compose -f src/antivirus.yml run start_antivirus; \ + fi; \ + if [ "${START_TIKA}" = "true" ]; then \ + COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \ + docker compose -f src/tika.yml run tika-service; \ + fi; \ + if [ "${ENABLE_WOPI}" = "true" ]; then \ + COMPOSE_FILE_VAR="$${COMPOSE_FILE_VAR}:src/wopi.yml"; \ + fi; \ + \ + + COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \ + COMPOSE_FILE=$${COMPOSE_FILE_VAR} \ STORAGE_DRIVER=$(STORAGE_DRIVER) \ TEST_SOURCE=$(TEST_SOURCE) \ WITH_WRAPPER=$(WITH_WRAPPER) \