test: add help command

Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com>
This commit is contained in:
Saw-jan
2026-01-16 14:40:16 +05:45
parent 389aa16179
commit 45e2441b4b

View File

@@ -6,9 +6,9 @@ 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)
@@ -70,83 +70,50 @@ export BEHAT_FEATURE
## 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
@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 "Available environment variables:"
@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
@echo -e "Example usage:"
@echo -e " ${PURPLE}WITH_WRAPPER${RESET}=${YELLOW}false${RESET} \\"
@echo -e " ${PURPLE}STORAGE_DRIVER${RESET}=${YELLOW}decomposed${RESET} \\"
@echo -e " ${PURPLE}BEHAT_FEATURE${RESET}=${YELLOW}tests/acceptance/features/apiGraph/changeRole.feature${RESET} \\"
@echo -e " make ${GREEN}run-api-tests${RESET}"
.PHONY: run-api-tests
run-api-tests: $(OC_WRAPPER) build-dev-image clean-docker-container
@echo "[INFO] Compose project: $(COMPOSE_PROJECT_NAME)"
@echo "[INFO] Compose file: $(COMPOSE_FILE)"
@echo "[INFO] Using storage driver: $(STORAGE_DRIVER)"
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}"
$(MAKE) --no-print-directory start-services
$(MAKE) --no-print-directory run-test-only
.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 test logs
docker compose logs --no-log-prefix -f acceptance-tests | less
@@ -174,17 +141,9 @@ clean-dev-image: ## clean docker image built during acceptance tests
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-all: clean-containers clean-dev-image clean-files ## clean all
.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
clean-all: clean-containers clean-dev-image clean-tests ## clean all