diff --git a/docs/ocis/development/testing.md b/docs/ocis/development/testing.md index 9487066d25..3341f3a197 100644 --- a/docs/ocis/development/testing.md +++ b/docs/ocis/development/testing.md @@ -80,6 +80,17 @@ make -C tests/acceptance/docker test-ocis-feature-ocis-storage {{< /hint >}} +{{< hint info >}} +To run the tests that require tika service (tests tagged with `@tikaServiceNeeded`), you need to provide `START_TIKA=true` while running the tests. + +```bash +START_TIKA=true \ +BEHAT_FEATURE='tests/acceptance/features/apiSearch/contentSearch.feature' \ +make -C tests/acceptance/docker test-ocis-feature-ocis-storage +``` + +{{< /hint >}} + {{< hint info >}} To run the tests that require an antivirus service (tests tagged with `@antivirus`), you need to provide the following environment variables while running the tests. @@ -376,6 +387,48 @@ BEHAT_FEATURE="tests/acceptance/features/apiNotification/emailNotification.featu make test-acceptance-api ``` +## Running Test Suite With Tika Service (@tikaServiceNeeded) + +Test suites that are tagged with `@tikaServiceNeeded` require tika service. + +### Setup Tika Service + +Run the following docker command to setup tika service + +```bash +docker run -d -p 127.0.0.1:9998:9998 apache/tika +``` + +### Run oCIS + +Documentation related to the content based search and tika extractor can be found [here](https://doc.owncloud.com/ocis/next/deployment/services/s-list/search.html#content-extraction) + +```bash +# init oCIS +IDM_ADMIN_PASSWORD=admin \ +ocis/bin/ocis init --insecure true + +# run oCIS +PROXY_ENABLE_BASIC_AUTH=true \ +OCIS_INSECURE=true \ +SEARCH_EXTRACTOR_TYPE=tika \ +SEARCH_EXTRACTOR_TIKA_TIKA_URL=http://localhost:9998 \ +SEARCH_EXTRACTOR_CS3SOURCE_INSECURE=true \ +ocis/bin/ocis server +``` + +### Run the Acceptance Test + +Run the acceptance test with the following command: + +```bash +TEST_WITH_GRAPH_API=true \ +TEST_OCIS=true \ +TEST_SERVER_URL="https://localhost:9200" \ +BEHAT_FEATURE="tests/acceptance/features/apiSearch/contentSearch.feature" \ +make test-acceptance-api +``` + ## Running Tests for Parallel Deployment ### Setup the Parallel Deployment Environment @@ -450,7 +503,7 @@ The commands are ubuntu specific and may differ according to your system. You ca ##### Mac OS user Install ClamAV using [here](https://gist.github.com/mendozao/3ea393b91f23a813650baab9964425b9) -Start ClamAV daemon +Start ClamAV daemon ```bash /your/location/to/brew/Cellar/clamav/1.1.0/sbin/clamd ``` diff --git a/tests/acceptance/docker/Makefile b/tests/acceptance/docker/Makefile index 2303b5d4ec..8fa0430aac 100644 --- a/tests/acceptance/docker/Makefile +++ b/tests/acceptance/docker/Makefile @@ -30,6 +30,17 @@ OCIS_IMAGE_TAG ?= dev WITH_WRAPPER ?= true OCIS_WRAPPER := ../../ociswrapper/bin/ociswrapper +ifdef START_TIKA + ifeq ($(START_TIKA),true) + COMPOSE_FILE := $(COMPOSE_FILE):src/tika.yml + SEARCH_EXTRACTOR_TYPE := tika + else + SEARCH_EXTRACTOR_TYPE := basic + endif +else + SEARCH_EXTRACTOR_TYPE := basic +endif + # static DIVIDE_INTO_NUM_PARTS := 10 PARTS = 1 2 3 4 5 6 7 8 9 10 @@ -190,6 +201,11 @@ testSuite: $(OCIS_WRAPPER) build-dev-image clean-docker-container 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) \ @@ -199,6 +215,7 @@ testSuite: $(OCIS_WRAPPER) build-dev-image clean-docker-container OCIS_ASYNC_UPLOADS=$(OCIS_ASYNC_UPLOADS) \ OCIS_ADD_RUN_SERVICES=$(OCIS_ADD_RUN_SERVICES) \ POSTPROCESSING_STEPS=$(POSTPROCESSING_STEPS) \ + SEARCH_EXTRACTOR_TYPE=$(SEARCH_EXTRACTOR_TYPE) \ OCIS_IMAGE_TAG=$(OCIS_IMAGE_TAG) \ BEHAT_SUITE=$(BEHAT_SUITE) \ BEHAT_FEATURE=$(BEHAT_FEATURE) \ diff --git a/tests/acceptance/docker/src/ocis-base.yml b/tests/acceptance/docker/src/ocis-base.yml index e4d6b7e4c3..7c4f08930d 100644 --- a/tests/acceptance/docker/src/ocis-base.yml +++ b/tests/acceptance/docker/src/ocis-base.yml @@ -43,6 +43,11 @@ services: # postprocessing step POSTPROCESSING_STEPS: $POSTPROCESSING_STEPS + # tika + SEARCH_EXTRACTOR_TYPE: $SEARCH_EXTRACTOR_TYPE + SEARCH_EXTRACTOR_TIKA_TIKA_URL: "http://tika:9998" + SEARCH_EXTRACTOR_CS3SOURCE_INSECURE: "true" + # fonts map for txt thumbnails (including unicode support) THUMBNAILS_TXT_FONTMAP_FILE: "/drone/src/tests/config/drone/fontsMap.json" volumes: diff --git a/tests/acceptance/docker/src/tika.yml b/tests/acceptance/docker/src/tika.yml new file mode 100644 index 0000000000..77ab8f4718 --- /dev/null +++ b/tests/acceptance/docker/src/tika.yml @@ -0,0 +1,8 @@ +services: + tika-service: + image: dadarek/wait-for-dependencies + depends_on: + - tika + command: tika:9998 + tika: + image: apache/tika:2.8.0.0