run wopi-validator tests localy (#2151)

This commit is contained in:
Viktor Scharf
2026-01-15 12:22:04 +01:00
committed by GitHub
parent 4b6e44d15c
commit e33ff722f7
4 changed files with 165 additions and 2 deletions
+3 -2
View File
@@ -24,6 +24,7 @@ OC_CI_NODEJS_ALPINE = "quay.io/opencloudeu/nodejs-alpine-ci:24"
OC_CI_PHP = "quay.io/opencloudeu/php-alpine-ci:%s"
OC_CI_WAIT_FOR = "quay.io/opencloudeu/wait-for-ci:latest"
OC_CS3_API_VALIDATOR = "opencloudeu/cs3api-validator:latest"
OC_CI_WOPI_VALIDATOR = "quay.io/opencloudeu/wopi-validator-ci:latest"
OC_LITMUS = "owncloudci/litmus:latest"
ONLYOFFICE_DOCUMENT_SERVER = "onlyoffice/documentserver:7.5.1"
PLUGINS_DOCKER_BUILDX = "woodpeckerci/plugin-docker-buildx:latest"
@@ -1137,7 +1138,7 @@ def wopiValidatorTests(ctx, storage, wopiServerType, accounts_hash_difficulty =
for testgroup in testgroups:
validatorTests.append({
"name": "wopiValidatorTests-%s" % testgroup,
"image": "owncloudci/wopi-validator",
"image": OC_CI_WOPI_VALIDATOR,
"commands": [
"export WOPI_TOKEN=$(cat accesstoken)",
"echo $WOPI_TOKEN",
@@ -1153,7 +1154,7 @@ def wopiValidatorTests(ctx, storage, wopiServerType, accounts_hash_difficulty =
for builtinOnlyGroup in builtinOnlyTestGroups:
validatorTests.append({
"name": "wopiValidatorTests-%s" % builtinOnlyGroup,
"image": "owncloudci/wopi-validator",
"image": OC_CI_WOPI_VALIDATOR,
"commands": [
"export WOPI_TOKEN=$(cat accesstoken)",
"echo $WOPI_TOKEN",
+31
View File
@@ -585,3 +585,34 @@ By default, the system uses `posix` storage. However, you can override this by s
```bash
STORAGE_DRIVER=posix ./tests/acceptance/run_api_tests.sh
```
## Running WOPI Validator Tests
### Available Test Groups
```text
BaseWopiViewing
CheckFileInfoSchema
EditFlows
Locks
AccessTokens
GetLock
ExtendedLockLength
FileVersion
Features
PutRelativeFile
RenameFileIfCreateChildFileIsNotSupported
```
### Run Test
```bash
TEST_GROUP=BaseWopiViewing docker compose -f tests/acceptance/docker/src/wopi-validator-test.yml up -d
```
### for macOS use arm image
```bash
WOPI_VALIDATOR_IMAGE=scharfvi/wopi-validator \
TEST_GROUP=BaseWopiViewing \
docker compose -f tests/acceptance/docker/src/wopi-validator-test.yml up -d
```
+45
View File
@@ -0,0 +1,45 @@
#!/bin/sh
set -xe
if [ -z "$TEST_GROUP" ]; then
echo "TEST_GROUP not set"
exit 1
fi
echo "Waiting for collaboration WOPI endpoint..."
until curl -s http://collaboration:9304 >/dev/null; do
echo "Waiting for collaboration WOPI endpoint..."
sleep 2
done
echo "Collaboration is up"
if [ -z "$OC_URL" ]; then
OC_URL="https://opencloud-server:9200"
fi
curl -vk -X DELETE "$OC_URL/remote.php/webdav/test.wopitest" -u admin:admin
curl -vk -X PUT "$OC_URL/remote.php/webdav/test.wopitest" -u admin:admin -D headers.txt
cat headers.txt
FILE_ID="$(cat headers.txt | sed -n -e 's/^.*oc-fileid: //Ip')"
export FILE_ID
URL="$OC_URL/app/open?app_name=FakeOffice&file_id=$FILE_ID"
URL="$(echo "$URL" | tr -d '[:cntrl:]')"
export URL
curl -vk -X POST "$URL" -u admin:admin > open.json
cat open.json
cat open.json | jq .form_parameters.access_token | tr -d '"' > accesstoken
cat open.json | jq .form_parameters.access_token_ttl | tr -d '"' > accesstokenttl
WOPI_FILE_ID="$(cat open.json | jq .app_url | sed -n -e 's/^.*files%2F//p' | tr -d '"')"
echo "http://collaboration:9300/wopi/files/$WOPI_FILE_ID" > wopisrc
WOPI_TOKEN=$(cat accesstoken)
export WOPI_TOKEN
WOPI_TTL=$(cat accesstokenttl)
export WOPI_TTL
WOPI_SRC=$(cat wopisrc)
export WOPI_SRC
/app/Microsoft.Office.WopiValidator -s -t "$WOPI_TOKEN" -w "$WOPI_SRC" -l "$WOPI_TTL" --testgroup $TEST_GROUP
@@ -0,0 +1,86 @@
services:
fakeoffice:
image: owncloudci/alpine:latest
entrypoint: /bin/sh
command:
[
"-c",
"while true; do echo -e \"HTTP/1.1 200 OK\n\n$(cat /hosting-discovery.xml)\" | nc -l -k -p 8080; done",
]
ports:
- 8080:8080
extra_hosts:
- opencloud.local:${DOCKER_HOST:-host-gateway}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080"]
volumes:
- ./../../../config/woodpecker/hosting-discovery.xml:/hosting-discovery.xml
opencloud:
image: opencloudeu/opencloud:dev
container_name: opencloud-server
ports:
- 9200:9200
entrypoint: /bin/sh
command: ["-c", "opencloud init || true; sleep 10; opencloud server"]
environment:
OC_URL: https://opencloud-server:9200
OC_CONFIG_DIR: /etc/opencloud
STORAGE_USERS_DRIVER: posix
PROXY_ENABLE_BASIC_AUTH: true
OC_LOG_LEVEL: error
OC_LOG_COLOR: false
OC_INSECURE: true
IDM_ADMIN_PASSWORD: admin
GATEWAY_GRPC_ADDR: 0.0.0.0:9142
NATS_NATS_HOST: 0.0.0.0
NATS_NATS_PORT: 9233
volumes:
- config:/etc/opencloud
depends_on:
fakeoffice:
condition: service_healthy
collaboration:
image: opencloudeu/opencloud:dev
restart: unless-stopped
ports:
- 9300:9300
entrypoint:
- /bin/sh
command: ["-c", "opencloud collaboration server"]
environment:
OC_CONFIG_DIR: /etc/opencloud
MICRO_REGISTRY: nats-js-kv
MICRO_REGISTRY_ADDRESS: opencloud: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
COLLABORATION_SERVICE_NAME: collaboration-fakeoffice
COLLABORATION_APP_NAME: FakeOffice
COLLABORATION_APP_PRODUCT: Microsoft
COLLABORATION_APP_ADDR: http://fakeoffice:8080
COLLABORATION_WOPI_SRC: http://collaboration:9300
volumes:
- config:/etc/opencloud
depends_on:
- opencloud
wopi-validator:
image: ${WOPI_VALIDATOR_IMAGE:-opencloudeu/wopi-validator-ci}
volumes:
- ./run-wopi-validator.sh:/app/run-wopi-validator.sh
environment:
TEST_GROUP: ${TEST_GROUP:-PutRelativeFile}
entrypoint: /app/run-wopi-validator.sh
depends_on:
- collaboration
restart: "on-failure"
volumes:
config: