Skip to content
Merged
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 .woodpecker.star
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
28 changes: 23 additions & 5 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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-posix-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').
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -611,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 \
Expand Down
61 changes: 37 additions & 24 deletions tests/acceptance/docker/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.ONESHELL:
SHELL := bash

# define standard colors
Expand All @@ -24,7 +25,7 @@ endif

## user input
BEHAT_FEATURE ?=

TEST_SOURCE ?= opencloud

ifdef OC_IMAGE_TAG
BUILD_DEV_IMAGE := 0
Expand Down Expand Up @@ -224,28 +225,31 @@ $(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; \
@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 [ "${START_EMAIL}" == "true" ]; then \
COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \
COMPOSE_FILE=src/email.yml \
docker compose run start_email; \
if [ "${ENABLE_WOPI}" = "true" ]; then \
COMPOSE_FILE_VAR="$${COMPOSE_FILE_VAR}:src/wopi.yml"; \
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) \
COMPOSE_FILE=$${COMPOSE_FILE_VAR} \
STORAGE_DRIVER=$(STORAGE_DRIVER) \
TEST_SOURCE=$(TEST_SOURCE) \
WITH_WRAPPER=$(WITH_WRAPPER) \
Expand All @@ -263,13 +267,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):
Expand All @@ -285,7 +287,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
Expand Down Expand Up @@ -328,6 +330,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
10 changes: 10 additions & 0 deletions tests/acceptance/docker/src/onlyoffice-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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
9 changes: 4 additions & 5 deletions tests/acceptance/docker/src/opencloud-base.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
105 changes: 105 additions & 0 deletions tests/acceptance/docker/src/wopi.yml
Original file line number Diff line number Diff line change
@@ -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: