Compare commits

...

3 Commits

Author SHA1 Message Date
Saw-jan
0834201d5f chore: remove unnecessary target
Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com>
2026-01-15 17:02:46 +05:45
Saw-jan
bb19789c3e docs: add docs to run wopi API tests
Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com>
2026-01-15 16:57:20 +05:45
Saw-jan
c940d05869 test: setup for running wopi API tests locally
Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com>
2026-01-15 16:44:49 +05:45
6 changed files with 176 additions and 38 deletions

View File

@@ -3287,7 +3287,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"

View File

@@ -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,15 +590,15 @@ 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.
### 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
```

View File

@@ -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
@@ -328,6 +324,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

View File

@@ -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

View File

@@ -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

View File

@@ -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: