[full-ci] test: use single command to run the containers and the API tests (#2169)
* test: setup for running wopi API tests locally Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com> * chore: remove unnecessary target Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com> * test: merge test run commands Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com> * test: merge local and core expected failures Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com> * test: remove unnecessary commands and files Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com> * test: add help command Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com> * docs(test): update testing docs as per the new changes Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com> * test: remove duplicate expected failure list Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com> * tset: fix term colors in run script Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com> * docs(test): update readme docs Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com> * test: beautify logs Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com> * change run-test.sh * test: expose more test envs Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com> * docs(test): update docs Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com> --------- Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com> Co-authored-by: Viktor Scharf <v.scharf@opencloud.eu>
This commit is contained in:
co-authored by
Viktor Scharf
parent
87ef2d97fa
commit
601ebc0f0f
+100
-281
@@ -6,47 +6,43 @@ BLACK := $(shell tput -Txterm setaf 0)
|
||||
RED := $(shell tput -Txterm setaf 1)
|
||||
GREEN := $(shell tput -Txterm setaf 2)
|
||||
YELLOW := $(shell tput -Txterm setaf 3)
|
||||
LIGHTPURPLE := $(shell tput -Txterm setaf 4)
|
||||
BLUE := $(shell tput -Txterm setaf 4)
|
||||
PURPLE := $(shell tput -Txterm setaf 5)
|
||||
BLUE := $(shell tput -Txterm setaf 6)
|
||||
CYAN := $(shell tput -Txterm setaf 6)
|
||||
WHITE := $(shell tput -Txterm setaf 7)
|
||||
|
||||
RESET := $(shell tput -Txterm sgr0)
|
||||
|
||||
## default values only for sub-make calls
|
||||
ifeq ($(LOCAL_TEST),true)
|
||||
COMPOSE_FILE ?= src/opencloud-base.yml:src/tika.yml
|
||||
ifeq ($(START_EMAIL),true)
|
||||
COMPOSE_FILE := $(COMPOSE_FILE):src/email.yml
|
||||
endif
|
||||
else
|
||||
COMPOSE_FILE ?= src/redis.yml:src/opencloud-base.yml:src/acceptance.yml
|
||||
endif
|
||||
|
||||
## user input
|
||||
BEHAT_FEATURE ?=
|
||||
TEST_SOURCE ?= opencloud
|
||||
|
||||
ifdef OC_IMAGE_TAG
|
||||
BUILD_DEV_IMAGE := 0
|
||||
else
|
||||
BUILD_DEV_IMAGE := 1
|
||||
endif
|
||||
OC_IMAGE_TAG ?= dev
|
||||
COMPOSE_FILE := src/opencloud-base.yml
|
||||
|
||||
# run tests with ocwrapper by default
|
||||
WITH_WRAPPER ?= true
|
||||
OC_WRAPPER := ../../ocwrapper/bin/ocwrapper
|
||||
|
||||
ifdef START_TIKA
|
||||
ifeq ($(START_TIKA),true)
|
||||
COMPOSE_FILE := $(COMPOSE_FILE):src/tika.yml
|
||||
SEARCH_EXTRACTOR_TYPE := tika
|
||||
else
|
||||
SEARCH_EXTRACTOR_TYPE := basic
|
||||
endif
|
||||
# enable tika for full text extraction
|
||||
ifeq ($(START_TIKA),true)
|
||||
COMPOSE_FILE := src/tika.yml:$(COMPOSE_FILE)
|
||||
export SEARCH_EXTRACTOR_TYPE := tika
|
||||
else
|
||||
SEARCH_EXTRACTOR_TYPE := basic
|
||||
export SEARCH_EXTRACTOR_TYPE := basic
|
||||
endif
|
||||
|
||||
# enable email server
|
||||
ifeq ($(START_EMAIL),true)
|
||||
COMPOSE_FILE := src/email.yml:$(COMPOSE_FILE)
|
||||
export OC_ADD_RUN_SERVICES := notifications
|
||||
endif
|
||||
|
||||
# enable antivirus
|
||||
ifeq ($(START_ANTIVIRUS),true)
|
||||
COMPOSE_FILE := src/antivirus.yml:$(COMPOSE_FILE)
|
||||
export OC_ADD_RUN_SERVICES := $(OC_ADD_RUN_SERVICES) antivirus
|
||||
export POSTPROCESSING_STEPS := virusscan
|
||||
endif
|
||||
|
||||
# enable wopi services
|
||||
ifeq ($(ENABLE_WOPI),true)
|
||||
COMPOSE_FILE := $(COMPOSE_FILE):src/wopi.yml
|
||||
endif
|
||||
|
||||
# default to posix
|
||||
@@ -54,224 +50,92 @@ STORAGE_DRIVER ?= posix
|
||||
ifeq ($(STORAGE_DRIVER),posix)
|
||||
# posix requires a additional driver config
|
||||
COMPOSE_FILE := $(COMPOSE_FILE):src/posix.yml
|
||||
else ifeq ($(STORAGE_DRIVER),decomposeds3)
|
||||
COMPOSE_FILE := src/ceph.yml:$(COMPOSE_FILE)
|
||||
endif
|
||||
|
||||
# static
|
||||
DIVIDE_INTO_NUM_PARTS := 10
|
||||
PARTS = 1 2 3 4 5 6 7 8 9 10
|
||||
LOCAL_API_SUITES = $(shell ls ../features | grep ^api*)
|
||||
# use latest as default tag if OC_IMAGE is provided but no tag is set
|
||||
ifneq ($(strip $(OC_IMAGE)),)
|
||||
ifeq ($(strip $(OC_IMAGE_TAG)),)
|
||||
OC_IMAGE_TAG := latest
|
||||
endif
|
||||
endif
|
||||
|
||||
COMPOSE_PROJECT_NAME := opencloud-acceptance-tests
|
||||
|
||||
# Export variables for sub-make calls
|
||||
export COMPOSE_PROJECT_NAME
|
||||
export COMPOSE_FILE
|
||||
|
||||
export OC_IMAGE
|
||||
export OC_IMAGE_TAG
|
||||
|
||||
# test configurations
|
||||
export STORAGE_DRIVER
|
||||
export WITH_WRAPPER
|
||||
export BEHAT_SUITE
|
||||
export BEHAT_FEATURE
|
||||
export TEST_SERVER_URL
|
||||
export USE_BEARER_TOKEN
|
||||
|
||||
## make definition
|
||||
.PHONY: help
|
||||
help:
|
||||
@echo "Please use 'make <target>' where <target> is one of the following:"
|
||||
@echo -e "Test suites: ${CYAN}https://github.com/opencloud-eu/opencloud/tree/main/tests/acceptance/features${RESET}"
|
||||
@echo -e "Testing docs: ${CYAN}https://github.com/opencloud-eu/opencloud/tree/main/tests/README.md${RESET}"
|
||||
@echo
|
||||
@echo -e "${PURPLE}docs: https://docs.opencloud.eu/opencloud/development/testing/#testing-with-test-suite-in-docker${RESET}\n"
|
||||
@echo "Available commands (targets):"
|
||||
@echo -e " ${GREEN}run-api-tests\t\t${RESET}Build dev image, start services and run the tests."
|
||||
@echo -e " ${GREEN}start-services\t${RESET}Start service containers."
|
||||
@echo -e " ${GREEN}run-test-only\t\t${RESET}Run the tests only."
|
||||
@echo -e " ${GREEN}show-test-logs\t${RESET}Show the test logs."
|
||||
@echo -e " ${GREEN}ps\t\t\t${RESET}Show the running containers."
|
||||
@echo
|
||||
@echo -e "OpenCloud feature tests and test suites can be found here:"
|
||||
@echo -e "\thttps://github.com/opencloud-eu/opencloud/tree/main/tests/acceptance/features"
|
||||
@echo -e " ${YELLOW}clean-dev-image\t${RESET}Delete the docker image built during acceptance tests."
|
||||
@echo -e " ${YELLOW}clean-containers\t${RESET}Delete the docker containers and volumes."
|
||||
@echo -e " ${YELLOW}clean-tests\t\t${RESET}Delete test dependencies and results."
|
||||
@echo -e " ${YELLOW}clean-all\t\t${RESET}Clean all resources: images, containers, volumes, test files."
|
||||
@echo
|
||||
@echo -e "test suites that test core compatibility are found here and they start with prefix coreApi-:"
|
||||
@echo -e "\thttps://github.com/opencloud-eu/opencloud/tree/main/tests/acceptance/features"
|
||||
@echo "Available environment variables:"
|
||||
@echo -e " ${PURPLE}OC_IMAGE\t\t${RESET}${CYAN}[image_repo]${RESET} OpenCloud image to use. If provided, the dev image build is skipped."
|
||||
@echo -e " ${PURPLE}OC_IMAGE_TAG\t\t${RESET}${CYAN}[image_tag]${RESET} OpenCloud image tag to use. If provided, the dev image build is skipped."
|
||||
@echo -e " ${PURPLE}WITH_WRAPPER\t\t${RESET}${CYAN}[true|false]${RESET} Start OpenCloud server using ocwrapper. Default: ${YELLOW}true${RESET}"
|
||||
@echo -e " ${PURPLE}STORAGE_DRIVER\t${RESET}${CYAN}[posix|decomposed|decomposeds3]${RESET} Storage driver to use. Default: ${YELLOW}posix${RESET}"
|
||||
@echo -e " ${PURPLE}BEHAT_FEATURE\t\t${RESET}${RESET}${CYAN}[path]${RESET} Path to a feature file. Example: ${YELLOW}tests/acceptance/features/apiGraph/changeRole.feature${RESET}"
|
||||
@echo -e " ${PURPLE}BEHAT_SUITE\t\t${RESET}${RESET}${CYAN}[suite_name]${RESET} Test suite to run. Example: ${YELLOW}apiGraph${RESET}"
|
||||
@echo -e " ${PURPLE}TEST_SERVER_URL\t${RESET}${CYAN}[url]${RESET} URL of the OpenCloud server to test against."
|
||||
@echo -e " ${PURPLE}USE_BEARER_TOKEN\t${RESET}${CYAN}[true|false]${RESET} Use a bearer token for authentication. Default: ${YELLOW}false${RESET}"
|
||||
@echo
|
||||
@echo -e "The OpenCloud to be tested will be build from your current working state."
|
||||
@echo -e "You also can select the OpenCloud Docker image for all tests by setting"
|
||||
@echo -e "\tmake ... ${YELLOW}OC_IMAGE_TAG=latest${RESET}"
|
||||
@echo -e "where ${YELLOW}latest${RESET} is an example for any valid Docker image tag from"
|
||||
@echo -e "https://hub.docker.com/r/opencloud-eu/opencloud."
|
||||
@echo
|
||||
@echo -e "${GREEN}Run full OpenCloud test suites with decomposed storage:${RESET}\n"
|
||||
@echo -e "\tmake localApiTests-apiAccountsHashDifficulty-decomposed\t\t${BLUE}run apiAccountsHashDifficulty test suite, where available test suite are apiAccountsHashDifficulty apiArchiver apiContract apiGraph apiSpaces apiSpacesShares apiAsyncUpload apiCors${RESET}"
|
||||
@echo
|
||||
@echo -e "${GREEN}Run full OpenCloud test suites with decomposeds3 storage:${RESET}\n"
|
||||
@echo -e "\tmake localApiTests-apiAccountsHashDifficulty-decomposeds3\t\t${BLUE}run apiAccountsHashDifficulty test suite, where available test suite are apiAccountsHashDifficulty apiArchiver apiContract apiGraph apiSpaces apiSpacesShares apiAsyncUpload apiCors${RESET}"
|
||||
@echo
|
||||
@echo -e "${GREEN}Run full OpenCloud test suites with decomposed storage:${RESET}\n"
|
||||
@echo -e "\tmake Core-API-Tests-decomposed-storage-${RED}X${RESET}\t\t${BLUE}run test suite number X, where ${RED}X = 1 .. 10${RESET}"
|
||||
@echo
|
||||
@echo -e "${GREEN}Run full OpenCloud test suites with decomposeds3 storage:${RESET}\n"
|
||||
@echo -e "\tmake Core-API-Tests-decomposeds3-storage-${RED}X${RESET}\t\t${BLUE}run test suite number X, where ${RED}X = 1 .. 10${RESET}"
|
||||
@echo
|
||||
@echo -e "${GREEN}Run an OpenCloud feature test with decomposed storage:${RESET}\n"
|
||||
@echo -e "\tmake test-opencloud-feature-decomposed-storage ${YELLOW}BEHAT_FEATURE='...'${RESET}\t${BLUE}run single feature test${RESET}"
|
||||
@echo
|
||||
@echo -e "\twhere ${YELLOW}BEHAT_FEATURE='...'${RESET} contains a relative path to the feature definition."
|
||||
@echo -e "\texample: ${RED}tests/acceptance/features/apiAccountsHashDifficulty/addUser.feature${RESET}"
|
||||
@echo
|
||||
@echo -e "${GREEN}Run an OpenCloud feature test with decomposeds3 storage:${RESET}\n"
|
||||
@echo -e "\tmake test-opencloud-feature-decomposeds3-storage ${YELLOW}BEHAT_FEATURE='...'${RESET}\t${BLUE}run single feature test${RESET}"
|
||||
@echo
|
||||
@echo -e "\twhere ${YELLOW}BEHAT_FEATURE='...'${RESET} contains a relative path to the feature definition."
|
||||
@echo -e "\texample: ${RED}tests/acceptance/features/apiAccountsHashDifficulty/addUser.feature${RESET}"
|
||||
@echo
|
||||
@echo -e "\twhere ${YELLOW}BEHAT_FEATURE='...'${RESET} contains a relative path to the feature definition."
|
||||
@echo -e "\texample: ${RED}tests/acceptance/features/apiAccountsHashDifficulty/addUser.feature${RESET}"
|
||||
@echo
|
||||
@echo -e "${GREEN}Run a core test against OpenCloud with decomposed storage:${RESET}\n"
|
||||
@echo -e "\tmake test-core-feature-decomposed-storage ${YELLOW}BEHAT_FEATURE='...'${RESET}\t${BLUE}run single feature test${RESET}"
|
||||
@echo
|
||||
@echo -e "\twhere ${YELLOW}BEHAT_FEATURE='...'${RESET} contains a relative path to the feature definition."
|
||||
@echo -e "\texample: ${RED}tests/acceptance/features/coreApiAuth/webDavAuth.feature${RESET}"
|
||||
@echo
|
||||
@echo -e "${GREEN}Run a core test against OpenCloud with decomposeds3 storage:${RESET}\n"
|
||||
@echo -e "\tmake test-core-feature-decomposeds3-storage ${YELLOW}BEHAT_FEATURE='...'${RESET}\t${BLUE}run single feature test${RESET}"
|
||||
@echo
|
||||
@echo -e "\twhere ${YELLOW}BEHAT_FEATURE='...'${RESET} contains a relative path to the feature definition."
|
||||
@echo -e "\texample: ${RED}tests/acceptance/features/coreApiAuth/webDavAuth.feature${RESET}"
|
||||
@echo
|
||||
@echo -e "\twhere ${YELLOW}BEHAT_FEATURE='...'${RESET} contains a relative path to the feature definition."
|
||||
@echo -e "\texample: ${RED}tests/acceptance/features/coreApiAuth/webDavAuth.feature${RESET}"
|
||||
@echo
|
||||
@echo
|
||||
@echo -e "${GREEN}Show output of tests:${RESET}\n"
|
||||
@echo -e "\tmake show-test-logs\t\t${BLUE}show output of running or finished tests${RESET}"
|
||||
@echo
|
||||
@echo
|
||||
@echo -e "${GREEN}Clean up after testing:${RESET}\n"
|
||||
@echo -e "\tmake clean\t${BLUE}clean up all${RESET}"
|
||||
@echo -e "\tmake clean-docker-container\t\t${BLUE}stops and removes used docker containers${RESET}"
|
||||
@echo -e "\tmake clean-docker-volumes\t\t${BLUE}removes used docker volumes (used for caching)${RESET}"
|
||||
@echo
|
||||
.PHONY: test-opencloud-feature-decomposed-storage
|
||||
test-opencloud-feature-decomposed-storage: ## test a OpenCloud feature with decomposed storage, usage: make ... BEHAT_FEATURE='tests/acceptance/features/apiAccountsHashDifficulty/addUser.feature:10'
|
||||
@TEST_SOURCE=opencloud \
|
||||
STORAGE_DRIVER=decomposed \
|
||||
BEHAT_FEATURE=$(BEHAT_FEATURE) \
|
||||
$(MAKE) --no-print-directory testSuite
|
||||
@echo -e "Example usage:"
|
||||
@echo -e " ${PURPLE}WITH_WRAPPER${RESET}=${YELLOW}false${RESET} \\"
|
||||
@echo -e " ${PURPLE}STORAGE_DRIVER${RESET}=${YELLOW}posix${RESET} \\"
|
||||
@echo -e " ${PURPLE}BEHAT_FEATURE${RESET}=${YELLOW}tests/acceptance/features/apiGraph/changeRole.feature${RESET} \\"
|
||||
@echo -e " make ${GREEN}run-api-tests${RESET}"
|
||||
|
||||
.PHONY: test-opencloud-feature-decomposeds3-storage
|
||||
test-opencloud-feature-decomposeds3-storage: ## test a OpenCloud feature with decomposeds3 storage, usage: make ... BEHAT_FEATURE='tests/acceptance/features/apiAccountsHashDifficulty/addUser.feature:10'
|
||||
@TEST_SOURCE=opencloud \
|
||||
STORAGE_DRIVER=decomposeds3 \
|
||||
BEHAT_FEATURE=$(BEHAT_FEATURE) \
|
||||
START_CEPH=1 \
|
||||
$(MAKE) --no-print-directory testSuite
|
||||
.PHONY: run-api-tests
|
||||
run-api-tests: $(OC_WRAPPER) build-dev-image clean-containers
|
||||
@echo "${BLUE}[INFO]${RESET} Compose project: ${YELLOW}$(COMPOSE_PROJECT_NAME)${RESET}"
|
||||
@echo "${BLUE}[INFO]${RESET} Compose file: ${YELLOW}$(COMPOSE_FILE)${RESET}"
|
||||
@echo "${BLUE}[INFO]${RESET} Using storage driver: ${YELLOW}$(STORAGE_DRIVER)${RESET}"
|
||||
# force use local server when using this command
|
||||
export TEST_SERVER_URL=https://opencloud-server:9200
|
||||
$(MAKE) --no-print-directory start-services
|
||||
$(MAKE) --no-print-directory run-test-only
|
||||
|
||||
.PHONY: test-opencloud-feature-posix-storage
|
||||
test-opencloud-feature-posix-storage: ## test a OpenCloud feature with posix storage, usage: make ... BEHAT_FEATURE='tests/acceptance/features/apiAccountsHashDifficulty/addUser.feature:10'
|
||||
@TEST_SOURCE=opencloud \
|
||||
STORAGE_DRIVER=posix \
|
||||
BEHAT_FEATURE=$(BEHAT_FEATURE) \
|
||||
$(MAKE) --no-print-directory testSuite
|
||||
|
||||
.PHONY: test-core-feature-decomposed-storage
|
||||
test-core-feature-decomposed-storage: ## test a core feature with decomposed storage, usage: make ... BEHAT_FEATURE='tests/acceptance/features/coreApiAuth/webDavAuth.feature'
|
||||
@TEST_SOURCE=core \
|
||||
STORAGE_DRIVER=decomposed \
|
||||
BEHAT_FEATURE=$(BEHAT_FEATURE) \
|
||||
$(MAKE) --no-print-directory testSuite
|
||||
|
||||
.PHONY: test-core-feature-decomposeds3-storage
|
||||
test-core-feature-decomposeds3-storage: ## test a core feature with decomposeds3 storage, usage: make ... BEHAT_FEATURE='tests/acceptance/features/coreApiAuth/webDavAuth.feature'
|
||||
@TEST_SOURCE=core \
|
||||
STORAGE_DRIVER=decomposeds3 \
|
||||
BEHAT_FEATURE=$(BEHAT_FEATURE) \
|
||||
START_CEPH=1 \
|
||||
$(MAKE) --no-print-directory testSuite
|
||||
|
||||
.PHONY: test-opencloud-feature-posix-storage
|
||||
test-core-opencloud-feature-posix-storage: ## test a core feature with posix storage, usage: make ... BEHAT_FEATURE='tests/acceptance/features/apiAccountsHashDifficulty/addUser.feature:10'
|
||||
@TEST_SOURCE=core \
|
||||
STORAGE_DRIVER=posix \
|
||||
BEHAT_FEATURE=$(BEHAT_FEATURE) \
|
||||
$(MAKE) --no-print-directory testSuite
|
||||
|
||||
localSuiteOpencloud = $(addprefix localApiTests-, $(addsuffix -decomposed,${LOCAL_API_SUITES}))
|
||||
.PHONY: $(localSuiteOpencloud)
|
||||
$(localSuiteOpencloud): ## run local api test suite with decomposed storage
|
||||
@$(eval BEHAT_SUITE=$(shell echo "$@" | cut -d'-' -f2))
|
||||
@TEST_SOURCE=opencloud \
|
||||
STORAGE_DRIVER=decomposed \
|
||||
BEHAT_SUITE=$(BEHAT_SUITE) \
|
||||
$(MAKE) --no-print-directory testSuite
|
||||
|
||||
localSuiteDecomposedS3 = $(addprefix localApiTests-, $(addsuffix -decomposeds3,${LOCAL_API_SUITES}))
|
||||
.PHONY: $(localSuiteDecomposedS3)
|
||||
$(localSuiteDecomposedS3): ## run local api test suite with s3 storage
|
||||
@$(eval BEHAT_SUITE=$(shell echo "$@" | cut -d'-' -f2))
|
||||
@TEST_SOURCE=opencloud \
|
||||
STORAGE_DRIVER=decomposeds3 \
|
||||
BEHAT_SUITE=$(BEHAT_SUITE) \
|
||||
$(MAKE) --no-print-directory testSuite
|
||||
|
||||
localSuitePosix = $(addprefix localApiTests-, $(addsuffix -posix,${LOCAL_API_SUITES}))
|
||||
.PHONY: $(localSuitePosix)
|
||||
$(localSuitePosix): ## run local api test suite with posix storage
|
||||
@$(eval BEHAT_SUITE=$(shell echo "$@" | cut -d'-' -f2))
|
||||
@TEST_SOURCE=opencloud \
|
||||
STORAGE_DRIVER=posix \
|
||||
BEHAT_SUITE=$(BEHAT_SUITE) \
|
||||
$(MAKE) --no-print-directory testSuite
|
||||
|
||||
targetsOC = $(addprefix Core-API-Tests-decomposed-storage-,$(PARTS))
|
||||
.PHONY: $(targetsOC)
|
||||
$(targetsOC):
|
||||
@$(eval RUN_PART=$(shell echo "$@" | tr -dc '0-9'))
|
||||
@TEST_SOURCE=core \
|
||||
STORAGE_DRIVER=decomposed \
|
||||
RUN_PART=$(RUN_PART) \
|
||||
$(MAKE) --no-print-directory testSuite
|
||||
|
||||
targetsDecomposedS3 = $(addprefix Core-API-Tests-decomposeds3-storage-,$(PARTS))
|
||||
.PHONY: $(targetsDecomposedS3)
|
||||
$(targets):
|
||||
@$(eval RUN_PART=$(shell echo "$@" | tr -dc '0-9'))
|
||||
@TEST_SOURCE=core \
|
||||
STORAGE_DRIVER=decomposeds3 \
|
||||
RUN_PART=$(RUN_PART) \
|
||||
$(MAKE) --no-print-directory testSuite
|
||||
|
||||
.PHONY: testSuite
|
||||
testSuite: $(OC_WRAPPER) build-dev-image clean-docker-container
|
||||
@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 [ "${ENABLE_WOPI}" = "true" ]; then \
|
||||
COMPOSE_FILE_VAR="$${COMPOSE_FILE_VAR}:src/wopi.yml"; \
|
||||
fi; \
|
||||
\
|
||||
|
||||
COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \
|
||||
COMPOSE_FILE=$${COMPOSE_FILE_VAR} \
|
||||
STORAGE_DRIVER=$(STORAGE_DRIVER) \
|
||||
TEST_SOURCE=$(TEST_SOURCE) \
|
||||
WITH_WRAPPER=$(WITH_WRAPPER) \
|
||||
OC_ASYNC_UPLOADS=$(OC_ASYNC_UPLOADS) \
|
||||
OC_ADD_RUN_SERVICES=$(OC_ADD_RUN_SERVICES) \
|
||||
POSTPROCESSING_STEPS=$(POSTPROCESSING_STEPS) \
|
||||
SEARCH_EXTRACTOR_TYPE=$(SEARCH_EXTRACTOR_TYPE) \
|
||||
OC_IMAGE_TAG=$(OC_IMAGE_TAG) \
|
||||
BEHAT_SUITE=$(BEHAT_SUITE) \
|
||||
BEHAT_FEATURE=$(BEHAT_FEATURE) \
|
||||
DIVIDE_INTO_NUM_PARTS=$(DIVIDE_INTO_NUM_PARTS) \
|
||||
RUN_PART=$(RUN_PART) \
|
||||
.PHONY: start-services
|
||||
start-services: $(OC_WRAPPER) ## start services
|
||||
docker compose up -d --build --force-recreate
|
||||
|
||||
.PHONY: run-test-only
|
||||
run-test-only:
|
||||
docker compose -f src/acceptance.yml up
|
||||
|
||||
.PHONY: show-test-logs
|
||||
show-test-logs: ## show logs of test
|
||||
@COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \
|
||||
show-test-logs: ## show test logs
|
||||
docker compose logs --no-log-prefix -f acceptance-tests | less
|
||||
|
||||
.PHONY: ps
|
||||
ps: ## show docker status
|
||||
@COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \
|
||||
ps: ## show running containers
|
||||
docker compose ps
|
||||
|
||||
$(OC_WRAPPER):
|
||||
@@ -281,66 +145,21 @@ $(OC_WRAPPER):
|
||||
|
||||
.PHONY: build-dev-image
|
||||
build-dev-image:
|
||||
@if [ $(BUILD_DEV_IMAGE) -eq 1 ]; then \
|
||||
@if [ -z "$(OC_IMAGE)" ] && [ -z "$(OC_IMAGE_TAG)" ]; then \
|
||||
$(MAKE) --no-print-directory -C ../../../opencloud dev-docker \
|
||||
; fi;
|
||||
|
||||
.PHONY: clean-dev-docker-image
|
||||
clean-dev-docker-image: ## clean docker image built during acceptance tests
|
||||
.PHONY: clean-dev-image
|
||||
clean-dev-image: ## clean docker image built during acceptance tests
|
||||
@docker image rm opencloudeu/opencloud:dev || true
|
||||
|
||||
.PHONY: clean-docker-container
|
||||
clean-docker-container: ## clean docker containers created during acceptance tests
|
||||
@COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \
|
||||
COMPOSE_FILE=$(COMPOSE_FILE) \
|
||||
BEHAT_SUITE="" \
|
||||
DIVIDE_INTO_NUM_PARTS="" \
|
||||
OC_IMAGE_TAG="" \
|
||||
RUN_PART="" \
|
||||
STORAGE_DRIVER="" \
|
||||
TEST_SOURCE="" \
|
||||
docker compose down --remove-orphans
|
||||
|
||||
.PHONY: clean-docker-volumes
|
||||
clean-docker-volumes: ## clean docker volumes created during acceptance tests
|
||||
@COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \
|
||||
COMPOSE_FILE=$(COMPOSE_FILE) \
|
||||
BEHAT_SUITE="" \
|
||||
DIVIDE_INTO_NUM_PARTS="" \
|
||||
OC_IMAGE_TAG="" \
|
||||
RUN_PART="" \
|
||||
STORAGE_DRIVER="" \
|
||||
TEST_SOURCE="" \
|
||||
.PHONY: clean-containers
|
||||
clean-containers: ## clean docker containers created during acceptance tests
|
||||
docker compose down --remove-orphans -v
|
||||
|
||||
.PHONY: clean-files
|
||||
clean-files:
|
||||
.PHONY: clean-tests
|
||||
clean-tests:
|
||||
@$(MAKE) --no-print-directory -C ../../../. clean-tests
|
||||
|
||||
.PHONY: clean
|
||||
clean: clean-docker-container clean-docker-volumes clean-dev-docker-image clean-files ## clean all
|
||||
|
||||
.PHONY: start-server
|
||||
start-server: $(OC_WRAPPER) ## build and start server
|
||||
@echo "Build and start server..."
|
||||
COMPOSE_FILE=$(COMPOSE_FILE) \
|
||||
COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \
|
||||
OC_IMAGE_TAG=dev \
|
||||
WITH_WRAPPER=$(WITH_WRAPPER) \
|
||||
TEST_SOURCE=opencloud \
|
||||
STORAGE_DRIVER=$(STORAGE_DRIVER) \
|
||||
OC_ASYNC_UPLOADS=true \
|
||||
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
|
||||
clean-all: clean-containers clean-dev-image clean-tests ## clean all
|
||||
|
||||
@@ -5,14 +5,12 @@ services:
|
||||
command: /bin/bash /test/run-tests.sh
|
||||
environment:
|
||||
OC_ROOT: /woodpecker/src/github.com/opencloud-eu/opencloud
|
||||
TEST_SERVER_URL: https://opencloud-server:9200
|
||||
TEST_SERVER_URL: ${TEST_SERVER_URL:-https://opencloud-server:9200}
|
||||
OC_WRAPPER_URL: http://opencloud-server:5200
|
||||
STORAGE_DRIVER: $STORAGE_DRIVER
|
||||
TEST_SOURCE: $TEST_SOURCE
|
||||
STORAGE_DRIVER: ${STORAGE_DRIVER:-posix}
|
||||
BEHAT_SUITE: ${BEHAT_SUITE:-}
|
||||
BEHAT_FEATURE: ${BEHAT_FEATURE:-}
|
||||
DIVIDE_INTO_NUM_PARTS: $DIVIDE_INTO_NUM_PARTS
|
||||
RUN_PART: $RUN_PART
|
||||
USE_BEARER_TOKEN: ${USE_BEARER_TOKEN:-false}
|
||||
# email
|
||||
EMAIL_HOST: email
|
||||
EMAIL_PORT: 9000
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
services:
|
||||
opencloud-server:
|
||||
image: opencloudeu/opencloud:dev
|
||||
image: ${OC_IMAGE:-opencloudeu/opencloud}:${OC_IMAGE_TAG:-dev}
|
||||
entrypoint: ["/bin/sh", "/usr/bin/serve-opencloud.sh"]
|
||||
user: root
|
||||
environment:
|
||||
WITH_WRAPPER: $WITH_WRAPPER
|
||||
WITH_WRAPPER: ${WITH_WRAPPER:-true}
|
||||
OC_URL: "https://opencloud-server:9200"
|
||||
STORAGE_USERS_DRIVER: $STORAGE_DRIVER
|
||||
STORAGE_USERS_DRIVER: ${STORAGE_DRIVER:-posix}
|
||||
STORAGE_USERS_POSIX_WATCH_FS: "true"
|
||||
STORAGE_USERS_DRIVER_LOCAL_ROOT: /srv/app/tmp/opencloud/local/root
|
||||
STORAGE_USERS_DRIVER_OC_ROOT: /srv/app/tmp/opencloud/storage/users
|
||||
@@ -19,8 +19,7 @@ services:
|
||||
IDM_CREATE_DEMO_USERS: "true"
|
||||
IDM_ADMIN_PASSWORD: "admin"
|
||||
FRONTEND_SEARCH_MIN_LENGTH: "2"
|
||||
OC_ASYNC_UPLOADS: $OC_ASYNC_UPLOADS
|
||||
OC_ADD_RUN_SERVICES: $OC_ADD_RUN_SERVICES
|
||||
OC_ADD_RUN_SERVICES: ${OC_ADD_RUN_SERVICES:-}
|
||||
PROXY_HTTP_ADDR: "0.0.0.0:9200"
|
||||
|
||||
# decomposeds3 specific settings
|
||||
@@ -41,10 +40,10 @@ services:
|
||||
ANTIVIRUS_CLAMAV_SOCKET: tcp://clamav:3310
|
||||
|
||||
# postprocessing step
|
||||
POSTPROCESSING_STEPS: $POSTPROCESSING_STEPS
|
||||
POSTPROCESSING_STEPS: ${POSTPROCESSING_STEPS:-}
|
||||
|
||||
# tika
|
||||
SEARCH_EXTRACTOR_TYPE: $SEARCH_EXTRACTOR_TYPE
|
||||
SEARCH_EXTRACTOR_TYPE: ${SEARCH_EXTRACTOR_TYPE:-basic}
|
||||
SEARCH_EXTRACTOR_TIKA_TIKA_URL: "http://tika:9998"
|
||||
SEARCH_EXTRACTOR_CS3SOURCE_INSECURE: "true"
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
services:
|
||||
opencloud-server:
|
||||
environment:
|
||||
# activate posix storage driver for users
|
||||
STORAGE_USERS_DRIVER: posix
|
||||
# posix requires a shared cache store
|
||||
STORAGE_USERS_ID_CACHE_STORE: "nats-js-kv"
|
||||
STORAGE_USERS_POSIX_WATCH_FS: "true"
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
services:
|
||||
redis:
|
||||
image: redis:6
|
||||
command: ["--databases", "1"]
|
||||
@@ -1,70 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
#mkdir -p /drone/src/vendor-bin/behat
|
||||
#cp /tmp/vendor-bin/behat/composer.json /drone/src/vendor-bin/behat/composer.json
|
||||
mkdir -p "${OC_ROOT}/vendor-bin/behat"
|
||||
if [ ! -f "${OC_ROOT}/vendor-bin/behat/composer.json" ]; then
|
||||
cp /tmp/vendor-bin/behat/composer.json "${OC_ROOT}/vendor-bin/behat/composer.json"
|
||||
fi
|
||||
|
||||
git config --global advice.detachedHead false
|
||||
|
||||
## CONFIGURE TEST
|
||||
BEHAT_FILTER_TAGS='~@skip'
|
||||
EXPECTED_FAILURES_FILE=''
|
||||
|
||||
if [ "$TEST_SOURCE" = "core" ]; then
|
||||
export ACCEPTANCE_TEST_TYPE='core-api'
|
||||
if [ "$STORAGE_DRIVER" = "decomposed" ]; then
|
||||
export OC_REVA_DATA_ROOT=''
|
||||
export BEHAT_FILTER_TAGS='~@skipOnOpencloud-decomposed-Storage'
|
||||
export EXPECTED_FAILURES_FILE='/drone/src/tests/acceptance/expected-failures-API-on-decomposed-storage.md'
|
||||
elif [ "$STORAGE_DRIVER" = "decomposeds3" ]; then
|
||||
export BEHAT_FILTER_TAGS='~@skip&&~@skipOnOpencloud-decomposeds3-Storage'
|
||||
export OC_REVA_DATA_ROOT=''
|
||||
else
|
||||
echo "non existing STORAGE selected"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
unset BEHAT_SUITE
|
||||
|
||||
elif [ "$TEST_SOURCE" = "opencloud" ]; then
|
||||
if [ "$STORAGE_DRIVER" = "decomposed" ]; then
|
||||
export BEHAT_FILTER_TAGS='~@skip&&~@skipOnOpencloud-decomposed-Storage'
|
||||
export OC_REVA_DATA_ROOT=''
|
||||
elif [ "$STORAGE_DRIVER" = "decomposeds3" ]; then
|
||||
export BEHAT_FILTER_TAGS='~@skip&&~@skipOnOpencloud-decomposeds3-Storage'
|
||||
export OC_REVA_DATA_ROOT=''
|
||||
elif [ "$STORAGE_DRIVER" = "posix" ]; then
|
||||
export BEHAT_FILTER_TAGS='~@skip&&~@skipOnOpencloud-posix-Storage'
|
||||
export OC_REVA_DATA_ROOT=''
|
||||
else
|
||||
echo "non existing storage selected"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
unset DIVIDE_INTO_NUM_PARTS
|
||||
unset RUN_PART
|
||||
else
|
||||
echo "non existing TEST_SOURCE selected"
|
||||
exit 1
|
||||
if [ "$STORAGE_DRIVER" = "posix" ]; then
|
||||
BEHAT_FILTER_TAGS+='&&~@skipOnOpencloud-posix-Storage'
|
||||
EXPECTED_FAILURES_FILE="${OC_ROOT}/tests/acceptance/expected-failures-posix-storage.md"
|
||||
elif [ "$STORAGE_DRIVER" = "decomposed" ]; then
|
||||
BEHAT_FILTER_TAGS+='&&~@skipOnOpencloud-decomposed-Storage'
|
||||
EXPECTED_FAILURES_FILE="${OC_ROOT}/tests/acceptance/expected-failures-decomposed-storage.md"
|
||||
fi
|
||||
|
||||
if [ ! -z "$BEHAT_FEATURE" ]; then
|
||||
echo "feature selected: " + $BEHAT_FEATURE
|
||||
# allow running without filters if its a feature
|
||||
export BEHAT_FILTER_TAGS
|
||||
export EXPECTED_FAILURES_FILE
|
||||
|
||||
if [ -n "$BEHAT_FEATURE" ]; then
|
||||
export BEHAT_FEATURE
|
||||
echo "[INFO] Running feature: $BEHAT_FEATURE"
|
||||
# allow running without filters if its a feature
|
||||
unset BEHAT_FILTER_TAGS
|
||||
unset DIVIDE_INTO_NUM_PARTS
|
||||
unset RUN_PART
|
||||
unset BEHAT_SUITE
|
||||
unset EXPECTED_FAILURES_FILE
|
||||
else
|
||||
elif [ -n "$BEHAT_SUITE" ]; then
|
||||
export BEHAT_SUITE
|
||||
echo "[INFO] Running suite: $BEHAT_SUITE"
|
||||
unset BEHAT_FEATURE
|
||||
fi
|
||||
|
||||
## RUN TEST
|
||||
sleep 10
|
||||
make -C "$OC_ROOT" test-acceptance-api
|
||||
|
||||
if [[ -z "$TEST_SOURCE" ]]; then
|
||||
echo "non existing TEST_SOURCE selected"
|
||||
exit 1
|
||||
else
|
||||
sleep 10
|
||||
make -C $OC_ROOT test-acceptance-api
|
||||
fi
|
||||
|
||||
chmod -R 777 vendor-bin/**/vendor vendor-bin/**/composer.lock tests/acceptance/output
|
||||
chmod -R 777 "${OC_ROOT}/vendor-bin/"*"/vendor" "${OC_ROOT}/vendor-bin/"*"/composer.lock" "${OC_ROOT}/tests/acceptance/output" 2>/dev/null || true
|
||||
|
||||
Reference in New Issue
Block a user