From 5e4b9baa1c942efcced1bf559dd9cfb096145fb7 Mon Sep 17 00:00:00 2001 From: Sawjan Gurung Date: Wed, 2 Aug 2023 17:14:30 +0545 Subject: [PATCH] [tests-only][full-ci] Update local test docker-compose setup to allow unicode preview tests (#6940) * update local test docker-compose setup to allow unicode preview tests * update docs --- docs/ocis/development/testing.md | 17 +++++++++++++++++ tests/acceptance/docker/Makefile | 10 +++++++++- tests/acceptance/docker/src/ocis-base.yml | 3 +++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/docs/ocis/development/testing.md b/docs/ocis/development/testing.md index da4eb1f3ab..9487066d25 100644 --- a/docs/ocis/development/testing.md +++ b/docs/ocis/development/testing.md @@ -499,3 +499,20 @@ TEST_SERVER_URL="https://localhost:9200" \ BEHAT_FEATURE="tests/acceptance/features/apiAntivirus/antivirus.feature" \ make test-acceptance-api ``` + +## Running Text Preview Tests Containing Unicode Characters + +There are some tests that check the text preview of files containing Unicode characters. The oCIS server by default cannot generate the thumbnail of such files correctly but it provides an environment variable to allow the use of custom fonts that support Unicode characters. So to run such tests successfully, we have to run the oCIS server with this environment variable. + +```bash +... +THUMBNAILS_TXT_FONTMAP_FILE="/path/to/fontsMap.json" +ocis/bin/ocis server +``` + +The sample `fontsMap.json` file is located in `tests/config/drone/fontsMap.json`. +```json +{ + "defaultFont": "/path/to/ocis/tests/config/drone/NotoSans.ttf" +} +``` diff --git a/tests/acceptance/docker/Makefile b/tests/acceptance/docker/Makefile index 2303b5d4ec..2f12167cb0 100644 --- a/tests/acceptance/docker/Makefile +++ b/tests/acceptance/docker/Makefile @@ -175,7 +175,7 @@ $(targets): $(MAKE) --no-print-directory testSuite .PHONY: testSuite -testSuite: $(OCIS_WRAPPER) build-dev-image clean-docker-container +testSuite: $(OCIS_WRAPPER) build-dev-image clean-docker-container ../../../vendor-bin/behat/composer.lock ../../../composer.lock @if [ -n "${START_CEPH}" ]; then \ COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \ COMPOSE_FILE=src/ceph.yml \ @@ -257,3 +257,11 @@ clean-files: .PHONY: clean clean: clean-docker-container clean-docker-volumes clean-dev-docker-image clean-files ## clean all + +../../../vendor-bin/behat/composer.lock: ../../../vendor-bin/behat/composer.json + @echo behat composer.lock is not up to date. + @composer update --no-progress -d ../../../vendor-bin/behat + +../../../composer.lock: ../../../composer.json + @echo composer.lock is not up to date. + @composer update --no-progress -d ../../../ \ No newline at end of file diff --git a/tests/acceptance/docker/src/ocis-base.yml b/tests/acceptance/docker/src/ocis-base.yml index 8924ca5c46..8a8d519372 100644 --- a/tests/acceptance/docker/src/ocis-base.yml +++ b/tests/acceptance/docker/src/ocis-base.yml @@ -42,6 +42,9 @@ services: # postprocessing step POSTPROCESSING_STEPS: $POSTPROCESSING_STEPS + + # fonts map for txt thumbnails (including unicode support) + THUMBNAILS_TXT_FONTMAP_FILE: "/drone/src/tests/config/drone/fontsMap.json" volumes: - ../../../config:/drone/src/tests/config - ../../../ociswrapper/bin/ociswrapper:/usr/bin/ociswrapper