diff --git a/e2e-test/qa/search/Makefile b/e2e-test/qa/Makefile similarity index 84% rename from e2e-test/qa/search/Makefile rename to e2e-test/qa/Makefile index 2a48a03f3..9ab1a4ef1 100644 --- a/e2e-test/qa/search/Makefile +++ b/e2e-test/qa/Makefile @@ -4,13 +4,12 @@ UNAME := $(shell uname) SHELL := /bin/bash export COMPOSE_INTERACTIVE_NO_CLI=1 -# CURRENT_DIR is the current location of this script: qa/search +# CURRENT_DIR is the folder where this Makefile is saved CURRENT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) -# ROOT_DIR is the location of 'qa' folder + +# the root dir where E2E maven project resides ROOT_DIR:=$(shell dirname $(CURRENT_DIR)) -# TEST_DIR is the location of POM -POM_DIR:=$(shell dirname $(ROOT_DIR)) help: ## main: output this help @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) @@ -60,4 +59,8 @@ standard: ## main: start with standard docker-compose.yml file make clean && $(dc) config && $(dc) up -d && make wait run-mvn-tests: ## run e2e maven suite: $make run-mvn-tests suiteXmlFile=src/path-to-suite.xml - cd $(POM_DIR) && $(mvn) test -DsuiteXmlFile=$(suiteXmlFile) \ No newline at end of file +ifndef suiteXmlFile + @echo suiteXmlFile not specified! Usage: make run-mvn-tests suiteXmlFile=src/path-to-suite.xml + exit 1 +endif + cd $(ROOT_DIR) && $(mvn) test -DsuiteXmlFile=$(suiteXmlFile) diff --git a/e2e-test/qa/README.md b/e2e-test/qa/README.md index 044628f87..fcdfac26a 100644 --- a/e2e-test/qa/README.md +++ b/e2e-test/qa/README.md @@ -6,19 +6,31 @@ This folder contains code for provisioning ACS with SearchServices or InsightEng ```ruby . -├── README.md # this readme file -└── search # code related to search product - ├── Makefile # main Makefile (with common tasks) - ├── backup # related to backup testing of Search Service - │ ├── Makefile # start here if you want to test backup - │ ├── README.md # how you can use it - │ └── docker-compose.backup.yml # overrides standard docker-compose.yml with backup data - └── docker-compose.yml # standard docker-compose.yml for Search Service - ├── sharding # related to Sharding +├── README.md +├── insight # INSIGHT ENGINE +│ ├── docker-compose.yml +│ └── upgrade +│ └── Makefile +└── search # SEARCH SERVICES + ├── Makefile # main Makefile - inherited by all Makefiles bellow + ├── backup + │ ├── Makefile + │ ├── README.md # start here if you want to test the backup + │ └── docker-compose.backup.yml + ├── custom + │ ├── Dockerfile + │ ├── Makefile + │ ├── README.md # start here if you want to built/test a custom image + │ ├── docker-compose.custom.yml + │ └── spellcheck + │ └── enable-spellcheck.sh + ├── docker-compose.yml + ├── sharding │ ├── Makefile │ ├── README.md │ └── docker-compose.sharding.yml └── upgrade - ├── Makefile # start here if you want to test the upgrade + ├── Makefile + ├── README.md └── docker-compose.upgrade.yml ``` diff --git a/e2e-test/qa/search/backup/Makefile b/e2e-test/qa/search/backup/Makefile index ba3955a65..c338aaea1 100644 --- a/e2e-test/qa/search/backup/Makefile +++ b/e2e-test/qa/search/backup/Makefile @@ -1,11 +1,13 @@ -include ../Makefile +include ../../Makefile include .env # the suffix of the backup taken in time. It can be overriden on runtime: make SUFIX=T1 backup-perform SUFIX ?=T0 +# CURRENT_DIR is the folder where this Makefile is saved +CURRENT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) # this is used also in compose yml files -export HOST_BACKUP_LOCATION:=$(CURRENT_DIR)/backup/host-bkp +export HOST_BACKUP_LOCATION:=$(CURRENT_DIR)/host-bkp ifeq ($(dc-backup),) dc-backup:=$(dc) -f ../docker-compose.yml -f docker-compose.backup.yml diff --git a/e2e-test/qa/search/custom/.env b/e2e-test/qa/search/custom/.env new file mode 100644 index 000000000..4b81b609b --- /dev/null +++ b/e2e-test/qa/search/custom/.env @@ -0,0 +1,11 @@ +# docker-compose related environments +ALFRESCO_IMAGE=alfresco/alfresco-content-repository +ALFRESCO_TAG=6.1.0-EA3 +SHARE_IMAGE=alfresco/alfresco-share +SHARE_TAG=6.0 +POSTGRES_IMAGE=postgres +POSTGRES_TAG=10.1 +SEARCH_IMAGE=quay.io/alfresco/search-services +SEARCH_TAG=latest +ACTIVEMQ_IMAGE=alfresco/alfresco-activemq +ACTIVEMQ_TAG=5.15.6 \ No newline at end of file diff --git a/e2e-test/qa/search/custom/Dockerfile b/e2e-test/qa/search/custom/Dockerfile new file mode 100644 index 000000000..b37b029ff --- /dev/null +++ b/e2e-test/qa/search/custom/Dockerfile @@ -0,0 +1,16 @@ +ARG SEARCH_TAG=latest +FROM quay.io/alfresco/search-services:$SEARCH_TAG +LABEL creator="Paul Brodner" maintainer="Alfresco Search Services Team" + +ARG SCRIPTS_FOLDER= + +USER root +RUN echo " &" >> $DIST_DIR/solr/bin/search_config_setup.sh && \ + echo "bash -c \"find $DIST_DIR/scripts/ -maxdepth 1 -type f -executable -name '*.sh' -exec {} \\;\"" >> $DIST_DIR/solr/bin/search_config_setup.sh && \ + echo "bash -c \"tail -f $DIST_DIR/logs/solr.log\"" >> $DIST_DIR/solr/bin/search_config_setup.sh + +USER solr +COPY ${SCRIPTS_FOLDER}/* ${DIST_DIR}/scripts/ + +# we need this, because we tail on it in the search_config_setup.sh (see above) +RUN touch ./logs/solr.log \ No newline at end of file diff --git a/e2e-test/qa/search/custom/Makefile b/e2e-test/qa/search/custom/Makefile new file mode 100644 index 000000000..17fe711b6 --- /dev/null +++ b/e2e-test/qa/search/custom/Makefile @@ -0,0 +1,21 @@ +include ../../Makefile +include .env + +# CURRENT_DIR is the folder where this Makefile is saved +CURRENT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) + +ifeq ($(dc-custom),) + dc-custom:=$(dc) -f ../docker-compose.yml -f docker-compose.custom.yml +endif + + +## ---- CUSTOM +build: ## 1 - build a custom image: $ make SCRIPTS_FOLDER=spellcheck custom-build +ifndef SCRIPTS_FOLDER + @echo SCRIPTS_FOLDER not defined "Usage: make SCRIPTS_FOLDER=spellcheck custom-build" + exit 1 +endif + $(dc-custom) build --force-rm --no-cache --pull --build-arg SCRIPTS_FOLDER=$(SCRIPTS_FOLDER) + +start: ## 2 - starts the custom image built: $ make start + $(dc-custom) up -d && make wait diff --git a/e2e-test/qa/search/custom/README.md b/e2e-test/qa/search/custom/README.md new file mode 100644 index 000000000..082a1eb01 --- /dev/null +++ b/e2e-test/qa/search/custom/README.md @@ -0,0 +1,25 @@ +# About + +Start Search Service with a custom configuration + +# Steps + +* **a)** under `custom` folder create a new folder that will hold all settings +>checkout [spellcheck](.spellcheck) folder for example + +>add here any shell scripts that will enable/disable a particular setting + +* **b)** build the new image setting SCRIPTS_FOLDER to you folder already created +```shel +make SCRIPTS_FOLDER=spellcheck build +``` +>notice that out [docker-compose.custom.yml](.custom/docker-compose.custom.yml) file is using a [Dockerfile](.custom/Dockerfile) to built you new image. +> at runtime, all shell scripts from your folder are executed and the settings are applied. + +* **c)** the image is built locally, now start it up +```shel +make start +``` + +# Environment Settings +Pay attention at the values that exist in [.env](.env) file. These settings will be picked up in custom docker-compose.*.yml file(s) diff --git a/e2e-test/qa/search/custom/docker-compose.custom.yml b/e2e-test/qa/search/custom/docker-compose.custom.yml new file mode 100644 index 000000000..bba4ea17c --- /dev/null +++ b/e2e-test/qa/search/custom/docker-compose.custom.yml @@ -0,0 +1,9 @@ +version: '3' +services: + search: + build: + context: ./custom + dockerfile: Dockerfile + image: quay.io/alfresco/search-services-custom:${SEARCH_TAG} + volumes: + - .:/backup diff --git a/e2e-test/qa/search/custom/spellcheck/enable-spellcheck.sh b/e2e-test/qa/search/custom/spellcheck/enable-spellcheck.sh new file mode 100755 index 000000000..d241ed55d --- /dev/null +++ b/e2e-test/qa/search/custom/spellcheck/enable-spellcheck.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -ex + +echo "Enabling SpellCheck" +cat <> /opt/alfresco-search-services/solrhome/conf/shared.properties + +# Enabling SpellCheck +# configuration: +# * http://docs.alfresco.com/6.0/concepts/solr-shared-properties.html +# * https://docs.alfresco.com/5.2/tasks/solr6-install-withoutSSL.html +# test it: http://docs.alfresco.com/6.0/concepts/search-api-spellcheck.html + +# Suggestable Properties +alfresco.suggestable.property.0={http://www.alfresco.org/model/content/1.0}name +alfresco.suggestable.property.1={http://www.alfresco.org/model/content/1.0}title +alfresco.suggestable.property.2={http://www.alfresco.org/model/content/1.0}description +alfresco.suggestable.property.3={http://www.alfresco.org/model/content/1.0}content + +EOF \ No newline at end of file diff --git a/e2e-test/qa/search/sharding/Makefile b/e2e-test/qa/search/sharding/Makefile index a884f7206..d4c9a338a 100644 --- a/e2e-test/qa/search/sharding/Makefile +++ b/e2e-test/qa/search/sharding/Makefile @@ -1,6 +1,9 @@ -include ../Makefile +include ../../Makefile include .env +# CURRENT_DIR is the folder where this Makefile is saved +CURRENT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) + ifeq ($(sharding),) sharding:=$(dc) -f ../docker-compose.yml -f docker-compose.sharding.yml endif diff --git a/e2e-test/qa/search/upgrade/Makefile b/e2e-test/qa/search/upgrade/Makefile index bbb600236..f4cf4dad8 100644 --- a/e2e-test/qa/search/upgrade/Makefile +++ b/e2e-test/qa/search/upgrade/Makefile @@ -1,6 +1,9 @@ -include ../Makefile +include ../../Makefile include .env +# CURRENT_DIR is the folder where this Makefile is saved +CURRENT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) + ifeq ($(dc-upgrade),) dc-upgrade:=$(dc) -f ../docker-compose.yml -f docker-compose.upgrade.yml endif