mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2025-12-19 19:10:29 -06:00
implement acceptance tests in docker for dev machine
This commit is contained in:
committed by
Phil Davis
parent
f9f90568b4
commit
1c409c64a1
@@ -1,4 +1,4 @@
|
||||
FROM golang:alpine as build
|
||||
FROM webhippie/golang:1.14 as build
|
||||
|
||||
COPY ./ /ocis/
|
||||
ENV CGO_ENABLED=0
|
||||
|
||||
42
Makefile
42
Makefile
@@ -1,18 +1,50 @@
|
||||
SHELL := bash
|
||||
|
||||
# define standard colors
|
||||
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)
|
||||
PURPLE := $(shell tput -Txterm setaf 5)
|
||||
BLUE := $(shell tput -Txterm setaf 6)
|
||||
WHITE := $(shell tput -Txterm setaf 7)
|
||||
|
||||
RESET := $(shell tput -Txterm sgr0)
|
||||
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
@echo "Please use 'make <target>' where <target> is one of the following:"
|
||||
@echo
|
||||
@echo -e "Testing:\n"
|
||||
@echo -e "make test-acceptance-api\trun API acceptance tests"
|
||||
@echo -e "make clean-tests\t\tdelete API tests framework dependencies"
|
||||
@echo -e "${GREEN}Testing with test suite natively installed:${RESET}\n"
|
||||
@echo -e "${PURPLE}\tdocs: https://owncloud.github.io/ocis/development/testing/#testing-with-test-suite-natively-installed${RESET}\n"
|
||||
@echo -e "\tmake test-acceptance-api\t${BLUE}run API acceptance tests${RESET}"
|
||||
@echo -e "\tmake clean-tests\t\t${BLUE}delete API tests framework dependencies${RESET}"
|
||||
@echo
|
||||
@echo -e "${BLACK}---------------------------------------------------------${RESET}"
|
||||
@echo
|
||||
@echo -e "${RED}You also should have a look at other available Makefiles:${RESET}"
|
||||
@echo
|
||||
@echo -e "${GREEN}oCIS:${RESET}\n"
|
||||
@echo -e "${PURPLE}\tdocs: https://owncloud.github.io/ocis/development/building/${RESET}\n"
|
||||
@echo -e "\tsee ./ocis/Makefile"
|
||||
@echo -e "\tor run ${YELLOW}make -C ocis help${RESET}"
|
||||
@echo
|
||||
@echo -e "${GREEN}Documentation:${RESET}\n"
|
||||
@echo -e "${PURPLE}\tdocs: https://owncloud.github.io/ocis/development/building-docs/${RESET}\n"
|
||||
@echo -e "\tsee ./docs/Makefile"
|
||||
@echo -e "\tor run ${YELLOW}make -C docs help${RESET}"
|
||||
@echo
|
||||
@echo -e "${GREEN}Testing with test suite in docker:${RESET}\n"
|
||||
@echo -e "${PURPLE}\tdocs: https://owncloud.github.io/ocis/development/testing/#testing-with-test-suite-in-docker${RESET}\n"
|
||||
@echo -e "\tsee ./tests/acceptance/docker/Makefile"
|
||||
@echo -e "\tor run ${YELLOW}make -C tests/acceptance/docker help${RESET}"
|
||||
@echo
|
||||
@echo -e "See the Makefile in the ocis folder for other build and test targets"
|
||||
|
||||
.PHONY: clean-tests
|
||||
clean-tests:
|
||||
rm -Rf vendor-bin/**/vendor vendor-bin/**/composer.lock
|
||||
@rm -Rf vendor-bin/**/vendor vendor-bin/**/composer.lock tests/acceptance/output
|
||||
|
||||
BEHAT_BIN=vendor-bin/behat/vendor/bin/behat
|
||||
|
||||
|
||||
@@ -1,22 +1,34 @@
|
||||
config-docs-generate:
|
||||
make -C ../accounts config-docs-generate
|
||||
make -C ../glauth config-docs-generate
|
||||
make -C ../konnectd config-docs-generate
|
||||
make -C ../ocis config-docs-generate
|
||||
make -C ../web config-docs-generate
|
||||
make -C ../ocis-pkg config-docs-generate
|
||||
make -C ../ocs config-docs-generate
|
||||
make -C ../proxy config-docs-generate
|
||||
make -C ../settings config-docs-generate
|
||||
make -C ../storage config-docs-generate
|
||||
make -C ../store config-docs-generate
|
||||
make -C ../thumbnails config-docs-generate
|
||||
make -C ../webdav config-docs-generate
|
||||
SHELL := bash
|
||||
|
||||
OCIS_MODULES = \
|
||||
accounts \
|
||||
glauth \
|
||||
konnectd \
|
||||
ocis \
|
||||
ocs \
|
||||
ocis-pkg \
|
||||
proxy \
|
||||
settings \
|
||||
storage \
|
||||
store \
|
||||
thumbnails \
|
||||
web \
|
||||
webdav
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||
|
||||
.PHONY: config-docs-generate
|
||||
config-docs-generate: ## run config-docs-generate for all oCIS extensions
|
||||
@for mod in $(OCIS_MODULES); do \
|
||||
$(MAKE) --no-print-directory -C ../$$mod config-docs-generate; \
|
||||
done
|
||||
|
||||
.PHONY: docs-copy
|
||||
docs-copy:
|
||||
mkdir -p hugo/content/
|
||||
cd hugo; \
|
||||
docs-copy: ## copy docs to hugo
|
||||
@mkdir -p hugo/content/
|
||||
@cd hugo; \
|
||||
git init; \
|
||||
git config advice.detachedHead false; \
|
||||
git remote rm origin; \
|
||||
@@ -29,6 +41,10 @@ docs-copy:
|
||||
docs-serve: config-docs-generate docs-copy
|
||||
docker run --rm --network host -v $(shell pwd)/hugo:/src owncloudci/hugo:0 server
|
||||
|
||||
.PHONY: docs-serve
|
||||
docs-serve: config-docs-generate docs-copy ## serve docs with hugo
|
||||
@docker run --rm --network host -v $(shell pwd)/hugo:/src owncloudci/hugo:0 server
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf hugo
|
||||
clean: ## clean up docs build artifacts
|
||||
@rm -rf hugo
|
||||
|
||||
@@ -9,7 +9,79 @@ geekdocFilePath: testing.md
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
## Acceptance tests
|
||||
For running tests in the test suite you have two options. You may go the easy way and just run the test suite in docker. But for some tasks you could also need to install the test suite natively, which requires a little bit more setup since PHP and some dependencies need to be installed.
|
||||
|
||||
Both ways to run tests with the test suites are described here.
|
||||
|
||||
## Testing with test suite in docker
|
||||
|
||||
Let's see what is available. Invoke the following command from within the root of the oCIS repository.
|
||||
|
||||
```
|
||||
make -C tests/acceptance/docker help
|
||||
```
|
||||
|
||||
Basically we have two sources for feature tests and test suites:
|
||||
|
||||
- [oCIS feature test and test suites](https://github.com/owncloud/ocis/tree/master/tests/acceptance/features)
|
||||
- [ownCloud feature tests and test suites](https://github.com/owncloud/core/tree/master/tests/acceptance/features)
|
||||
|
||||
At the moment both can be applied to oCIS since the api of oCIS is designed to be compatible to ownCloud.
|
||||
|
||||
Since we have to offer an migration path to existing users of ownCloud, you can use your existing ownCloud as storage backend for oCIS. As another storage backend we offer oCIS native storage, also called "oCIS". This stores files directly on disk. Which storage backend is used is also reflected in the tests, there are always different tests for oCIS storage and ownCloud storage.
|
||||
|
||||
You can invoke two types of test suite runs:
|
||||
|
||||
- run a full test suite, which consists of multiple feature tests
|
||||
- run a single feature test
|
||||
|
||||
### Run full test suite
|
||||
|
||||
The names of the full test suite make targets have the same naming as in the CI pipeline.
|
||||
|
||||
For example `make -C tests/acceptance/docker localApiTests-apiOcisSpecific-ocis` runs the same tests as the `localApiTests-apiOcisSpecific-ocis` CI pipeline, which runs the oCIS test suite "apiOcisSpecific" against an oCIS with oCIS storage.
|
||||
|
||||
For example `make -C tests/acceptance/docker Core-API-Tests-owncloud-storage-3`runs the same tests as the `Core-API-Tests-owncloud-storage-3` CI pipline, which runs the third (out of ten) ownCloud test suite against an oCIS with owncloud storage.
|
||||
|
||||
### Run single feature test
|
||||
|
||||
The single feature tests can also be run against the different storage backends. Therefore multiple make targets with the schema test-<test source>-feature-<storage backend> exists. For selecting a single feature test you have to add an additional `BEHAT_FEATURE=...` parameter when invoking the make command:
|
||||
|
||||
```
|
||||
make -C tests/acceptance/docker test-ocis-feature-ocis BEHAT_FEATURE='tests/acceptance/features/apiOcisSpecific/apiAuthOcs-ocsDELETEAuth.feature'
|
||||
```
|
||||
|
||||
This must be pointing to a valid feature definition.
|
||||
|
||||
### oCIS image to be tested (or: skip build and take existing image)
|
||||
|
||||
By default the tests will be run against docker image built from your current working state of the oCIS repository. For some purposes it might also be handy to use a oCIS image from Docker Hub. Therefore you can provide the optional flag `OCIS_IMAGE_TAG=...` which must contain an available docker tag of the [owncloud/ocis registry on Docker Hub](https://hub.docker.com/r/owncloud/ocis) (eg. 'latest').
|
||||
|
||||
```
|
||||
make -C tests/acceptance/docker localApiTests-apiOcisSpecific-ocis OCIS_IMAGE_TAG=latest
|
||||
```
|
||||
|
||||
### Test log output
|
||||
|
||||
While a test is running or when it is finished, you can attach to the logs generated by the tests.
|
||||
|
||||
```
|
||||
make -C tests/acceptance/docker show-test-logs
|
||||
```
|
||||
|
||||
{{< hint info >}}
|
||||
The log output is opened in `less`. You can navigate up and down with your cursors. By pressing "F" you can follow the latest line of the output.
|
||||
{{< /hint >}}
|
||||
|
||||
### Cleanup
|
||||
|
||||
During testing we start an redis and oCIS docker container. These will not be stopped automatically. You can stop them with:
|
||||
|
||||
```
|
||||
make -C tests/acceptance/docker clean
|
||||
```
|
||||
|
||||
## Testing with test suite natively installed
|
||||
|
||||
We are using the ownCloud 10 acceptance test suite against oCIS. To set this up you need the ownCloud 10 core repo, a LDAP server that the acceptance tests can use to manage users, a redis server for file-versions and the oCIS code.
|
||||
|
||||
|
||||
@@ -50,11 +50,15 @@ LDFLAGS += -s -w -X "$(IMPORT)/pkg/version.String=$(VERSION)" -X "$(IMPORT)/pkg/
|
||||
DEBUG_LDFLAGS += -X "$(IMPORT)/pkg/version.String=$(VERSION)" -X "$(IMPORT)/pkg/version.Date=$(DATE)"
|
||||
GCFLAGS += all=-N -l
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||
|
||||
.PHONY: all
|
||||
all: build
|
||||
all: build ## build oCIS
|
||||
|
||||
.PHONY: sync
|
||||
sync:
|
||||
sync: ## download go dependencies
|
||||
go mod download
|
||||
|
||||
.PHONY: clean
|
||||
@@ -67,31 +71,31 @@ clean-config:
|
||||
rm -rf $(CONFIG)
|
||||
|
||||
.PHONY: fmt
|
||||
fmt:
|
||||
fmt: ## fmt
|
||||
gofmt -s -w $(SOURCES)
|
||||
|
||||
.PHONY: vet
|
||||
vet:
|
||||
vet: ## vet
|
||||
go vet $(PACKAGES)
|
||||
|
||||
.PHONY: lint
|
||||
lint:
|
||||
lint: ## lint
|
||||
for PKG in $(PACKAGES); do go run golang.org/x/lint/golint -set_exit_status $$PKG || exit 1; done;
|
||||
|
||||
.PHONY: generate
|
||||
generate:
|
||||
generate: ## generate
|
||||
go generate $(GENERATE)
|
||||
|
||||
.PHONY: changelog
|
||||
changelog:
|
||||
changelog: ## generate changelog
|
||||
go run github.com/restic/calens -i ../changelog -t ../changelog/CHANGELOG.tmpl >| ../CHANGELOG.md
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
test: ## run tests
|
||||
go run github.com/haya14busa/goverage -v -coverprofile coverage.out $(PACKAGES)
|
||||
|
||||
.PHONY: install
|
||||
install: $(SOURCES)
|
||||
install: $(SOURCES) ## install
|
||||
go install -v -tags '$(TAGS)' -ldflags '$(LDFLAGS)' ./cmd/$(NAME)
|
||||
|
||||
.PHONY: build
|
||||
@@ -107,7 +111,7 @@ $(BIN)/$(EXECUTABLE)-linux: $(SOURCES)
|
||||
GOOS=linux GOARCH=amd64 $(GOBUILD) -v -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -gcflags '$(GCFLAGS)' -o $@ ./cmd/$(NAME)
|
||||
|
||||
.PHONY: staticcheck
|
||||
staticcheck:
|
||||
staticcheck: ## static check
|
||||
go run honnef.co/go/tools/cmd/staticcheck -tags '$(TAGS)' $(PACKAGES)
|
||||
|
||||
.PHONY: release
|
||||
@@ -141,7 +145,7 @@ release-check:
|
||||
release-finish: release-copy release-check
|
||||
|
||||
.PHONY: config-docs-generate
|
||||
config-docs-generate:
|
||||
config-docs-generate: ## generate configuration documentation
|
||||
go run github.com/owncloud/flaex >| ../docs/ocis/configuration.md
|
||||
|
||||
.PHONY: watch
|
||||
|
||||
1
tests/acceptance/.gitignore
vendored
Normal file
1
tests/acceptance/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
output
|
||||
232
tests/acceptance/docker/Makefile
Normal file
232
tests/acceptance/docker/Makefile
Normal file
@@ -0,0 +1,232 @@
|
||||
SHELL := bash
|
||||
|
||||
# define standard colors
|
||||
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)
|
||||
PURPLE := $(shell tput -Txterm setaf 5)
|
||||
BLUE := $(shell tput -Txterm setaf 6)
|
||||
WHITE := $(shell tput -Txterm setaf 7)
|
||||
|
||||
RESET := $(shell tput -Txterm sgr0)
|
||||
|
||||
## default values only for sub-make calls
|
||||
COMPOSE_FILE ?= src/redis.yml:src/ocis-base.yml:src/acceptance.yml
|
||||
|
||||
## user input
|
||||
BEHAT_FEATURE ?=
|
||||
|
||||
CORE_BRANCH ?= master
|
||||
CORE_COMMIT ?= 52105a981c0c74fc81c84218e9076d443b06f074
|
||||
|
||||
ifdef OCIS_IMAGE_TAG
|
||||
COMPOSE_FILE := $(COMPOSE_FILE):src/ocis-image.yml
|
||||
else
|
||||
COMPOSE_FILE := $(COMPOSE_FILE):src/ocis-build.yml
|
||||
endif
|
||||
OCIS_IMAGE_TAG ?= latest
|
||||
|
||||
# static
|
||||
DIVIDE_INTO_NUM_PARTS := 10
|
||||
PARTS = 1 2 3 4 5 6 7 8 9 10
|
||||
|
||||
COMPOSE_PROJECT_NAME := ocis-acceptance-tests
|
||||
|
||||
## make definition
|
||||
.PHONY: help
|
||||
help:
|
||||
@echo "Please use 'make <target>' where <target> is one of the following:"
|
||||
@echo
|
||||
@echo -e "${PURPLE}docs: https://owncloud.github.io/ocis/development/testing/#testing-with-test-suite-in-docker${RESET}\n"
|
||||
@echo
|
||||
@echo -e "oCIS feature tests and test suites can be found here:"
|
||||
@echo -e "\thttps://github.com/owncloud/ocis/tree/master/tests/acceptance/features"
|
||||
@echo
|
||||
@echo -e "ownCloud feature tests and test suites can be found here:"
|
||||
@echo -e "\thttps://github.com/owncloud/core/tree/master/tests/acceptance/features"
|
||||
@echo
|
||||
@echo -e "The oCIS to be tested will be build from your current working state."
|
||||
@echo -e "You also can select the oCIS Docker image for all tests by setting"
|
||||
@echo -e "\tmake ... ${YELLOW}OCIS_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/owncloud/ocis."
|
||||
@echo
|
||||
@echo -e "${GREEN}Run full oCIS test suites against oCIS with oCIS storage:${RESET}\n"
|
||||
@echo -e "\tmake localApiTests-apiBasic-ocis\t\t${BLUE}run apiBasic test suite${RESET}"
|
||||
@echo -e "\tmake localApiTests-apiOcisSpecific-ocis\t\t${BLUE}run apiOcisSPecific test suite${RESET}"
|
||||
@echo
|
||||
@echo -e "${GREEN}Run full oCIS test suites against oCIS with ownCloud storage:${RESET}\n"
|
||||
@echo -e "\tmake localApiTests-apiBasic-owncloud\t\t${BLUE}run apiBasic test suite${RESET}"
|
||||
@echo -e "\tmake localApiTests-apiOcisSpecific-owncloud\t${BLUE}run apiOcisSpecific test suite${RESET}"
|
||||
@echo
|
||||
@echo -e "${GREEN}Run full ownCloud test suites against oCIS with oCIS storage:${RESET}\n"
|
||||
@echo -e "\tmake Core-API-Tests-ocis-storage-${RED}X${RESET}\t\t${BLUE}run test suite number X, where ${RED}X = 1 .. 10${RESET}"
|
||||
@echo
|
||||
@echo -e "${GREEN}Run full ownCloud test suites against oCIS with ownCloud storage:${RESET}\n"
|
||||
@echo -e "\tmake Core-API-Tests-owncloud-storage-${RED}X${RESET}\t\t${BLUE}run test suite number X, where ${RED}X = 1 .. 10${RESET}"
|
||||
@echo
|
||||
@echo -e "${GREEN}Run an oCIS feature test against oCIS with oCIS storage:${RESET}\n"
|
||||
@echo -e "\tmake test-ocis-feature-ocis-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/apiOcisSpecific/apiAuthOcs-ocsDELETEAuth.feature${RESET}"
|
||||
@echo
|
||||
@echo -e "${GREEN}Run an oCIS feature test against oCIS with owncloud storage:${RESET}\n"
|
||||
@echo -e "\tmake test-ocis-feature-owncloud-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/apiOcisSpecific/apiAuthOcs-ocsDELETEAuth.feature${RESET}"
|
||||
@echo
|
||||
@echo -e "${GREEN}Run an ownCloud feature test against oCIS with oCIS storage:${RESET}\n"
|
||||
@echo -e "\tmake test-oc10-feature-ocis-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/apiAuth/cors.feature${RESET}"
|
||||
@echo
|
||||
@echo -e "${GREEN}Run an ownCloud feature test against oCIS with owncloud storage:${RESET}\n"
|
||||
@echo -e "\tmake test-oc10-feature-owncloud-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/apiAuth/cors.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-ocis-feature-ocis-storage
|
||||
test-ocis-feature-ocis-storage: ## test a ocis feature with oCIS storage, useage: make ... BEHAT_FEATURE='tests/acceptance/features/apiOcisSpecific/apiAuthOcs-ocsDELETEAuth.feature:7'
|
||||
@TEST_SOURCE=ocis \
|
||||
STORAGE=ocis \
|
||||
BEHAT_FEATURE=$(BEHAT_FEATURE) \
|
||||
$(MAKE) --no-print-directory testSuite
|
||||
|
||||
.PHONY: test-ocis-feature-owncloud-storage
|
||||
test-ocis-feature-owncloud-storage: ## test a ocis feature with oc10 storage, useage: make ... BEHAT_FEATURE='tests/acceptance/features/apiOcisSpecific/apiAuthOcs-ocsDELETEAuth.feature:7'
|
||||
@TEST_SOURCE=ocis \
|
||||
STORAGE=owncloud \
|
||||
BEHAT_FEATURE=$(BEHAT_FEATURE) \
|
||||
$(MAKE) --no-print-directory testSuite
|
||||
|
||||
.PHONY: test-oc10-feature-ocis-storage
|
||||
test-oc10-feature-ocis-storage: ## test a oC10 feature with oCIS storage, useage: make ... BEHAT_FEATURE='tests/acceptance/features/apiAuth/cors.feature'
|
||||
@TEST_SOURCE=oc10 \
|
||||
STORAGE=ocis \
|
||||
BEHAT_FEATURE=$(BEHAT_FEATURE) \
|
||||
$(MAKE) --no-print-directory testSuite
|
||||
|
||||
.PHONY: test-oc10-feature-owncloud-storage
|
||||
test-oc10-feature-owncloud-storage: ## test a oC10 feature with oc10 storage, useage: make ... BEHAT_FEATURE='tests/acceptance/features/apiAuth/cors.feature'
|
||||
@TEST_SOURCE=oc10 \
|
||||
STORAGE=owncloud \
|
||||
BEHAT_FEATURE=$(BEHAT_FEATURE) \
|
||||
$(MAKE) --no-print-directory testSuite
|
||||
|
||||
.PHONY: localApiTests-apiOcisSpecific-owncloud
|
||||
localApiTests-apiOcisSpecific-owncloud: ## run apiOcisSpecific test suite with owncloud storage
|
||||
@TEST_SOURCE=oc10 \
|
||||
STORAGE=owncloud \
|
||||
BEHAT_SUITE=apiOcisSpecific \
|
||||
$(MAKE) --no-print-directory testSuite
|
||||
|
||||
.PHONY: localApiTests-apiBasic-owncloud
|
||||
localApiTests-apiBasic-owncloud: ## run apiBasic test suite with owncloud storage
|
||||
@TEST_SOURCE=ocis \
|
||||
STORAGE=owncloud \
|
||||
BEHAT_SUITE=apiBasic \
|
||||
$(MAKE) --no-print-directory testSuite
|
||||
|
||||
.PHONY: localApiTests-apiOcisSpecific-ocis
|
||||
localApiTests-apiOcisSpecific-ocis: ## run apiOcisSPecific test suite with ocis storage
|
||||
@TEST_SOURCE=ocis \
|
||||
STORAGE=ocis \
|
||||
BEHAT_SUITE=apiOcisSpecific \
|
||||
$(MAKE) --no-print-directory testSuite
|
||||
|
||||
.PHONY: localApiTests-apiBasic-ocis
|
||||
localApiTests-apiBasic-ocis: ## run apiBasic test suite with ocis storage
|
||||
@TEST_SOURCE=ocis \
|
||||
STORAGE=ocis \
|
||||
BEHAT_SUITE=apiBasic \
|
||||
$(MAKE) --no-print-directory testSuite
|
||||
|
||||
targets = $(addprefix Core-API-Tests-owncloud-storage-,$(PARTS))
|
||||
.PHONY: $(targets)
|
||||
$(targets):
|
||||
@$(eval RUN_PART=$(shell echo "$@" | tr -dc '0-9'))
|
||||
@TEST_SOURCE=oc10 \
|
||||
STORAGE=owncloud \
|
||||
RUN_PART=$(RUN_PART) \
|
||||
$(MAKE) --no-print-directory testSuite
|
||||
|
||||
targets = $(addprefix Core-API-Tests-ocis-storage-,$(PARTS))
|
||||
.PHONY: $(targets)
|
||||
$(targets):
|
||||
@$(eval RUN_PART=$(shell echo "$@" | tr -dc '0-9'))
|
||||
@TEST_SOURCE=oc10 \
|
||||
STORAGE=ocis \
|
||||
RUN_PART=$(RUN_PART) \
|
||||
$(MAKE) --no-print-directory testSuite
|
||||
|
||||
.PHONY: testSuite
|
||||
testSuite: clean-docker-container
|
||||
@COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \
|
||||
COMPOSE_FILE=$(COMPOSE_FILE) \
|
||||
STORAGE=$(STORAGE) \
|
||||
TEST_SOURCE=$(TEST_SOURCE) \
|
||||
OCIS_IMAGE_TAG=$(OCIS_IMAGE_TAG) \
|
||||
BEHAT_SUITE=$(BEHAT_SUITE) \
|
||||
BEHAT_FEATURE=$(BEHAT_FEATURE) \
|
||||
CORE_BRANCH=$(CORE_BRANCH) \
|
||||
CORE_COMMIT=$(CORE_COMMIT) \
|
||||
DIVIDE_INTO_NUM_PARTS=$(DIVIDE_INTO_NUM_PARTS) \
|
||||
RUN_PART=$(RUN_PART) \
|
||||
docker-compose up -d --build --remove-orphans --force-recreate
|
||||
|
||||
.PHONY: show-test-logs
|
||||
show-test-logs: ## show logs of test
|
||||
@COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME) \
|
||||
COMPOSE_FILE=$(COMPOSE_FILE) \
|
||||
docker logs -f ocis-acceptance-tests_acceptance-tests_1 | less
|
||||
|
||||
.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="" \
|
||||
CORE_BRANCH="" \
|
||||
CORE_COMMIT="" \
|
||||
DIVIDE_INTO_NUM_PARTS="" \
|
||||
OCIS_IMAGE_TAG="" \
|
||||
RUN_PART="" \
|
||||
STORAGE="" \
|
||||
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) \
|
||||
STORAGE=$(STORAGE) \
|
||||
COMPOSE_FILE=$(COMPOSE_FILE) \
|
||||
BEHAT_SUITE="" \
|
||||
CORE_BRANCH="" \
|
||||
CORE_COMMIT="" \
|
||||
DIVIDE_INTO_NUM_PARTS="" \
|
||||
OCIS_IMAGE_TAG="" \
|
||||
RUN_PART="" \
|
||||
STORAGE="" \
|
||||
TEST_SOURCE="" \
|
||||
docker-compose down --remove-orphans -v
|
||||
|
||||
.PHONY: clean-files
|
||||
@$(MAKE) --no-print-directory -C ../. clean-tests
|
||||
|
||||
.PHONY: clean
|
||||
clean: clean-docker-container clean-docker-volumes clean-files ## clean all
|
||||
27
tests/acceptance/docker/src/acceptance.yml
Normal file
27
tests/acceptance/docker/src/acceptance.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
services:
|
||||
acceptance-tests:
|
||||
image: owncloudci/php:7.4
|
||||
command: /bin/bash /test/run-tests.sh
|
||||
environment:
|
||||
OCIS_ROOT: /drone/src
|
||||
PATH_TO_CORE: /srv/app/testrunner
|
||||
SKELETON_DIR: /srv/app/tmp/testing/data/apiSkeleton
|
||||
TEST_OCIS: "true"
|
||||
TEST_SERVER_URL: https://ocis-server:9200
|
||||
TESTING_DIR: /srv/app/tmp/testing
|
||||
|
||||
CORE_BRANCH: $CORE_BRANCH
|
||||
CORE_COMMIT: $CORE_COMMIT
|
||||
STORAGE: $STORAGE
|
||||
TEST_SOURCE: $TEST_SOURCE
|
||||
BEHAT_SUITE: ${BEHAT_SUITE:-}
|
||||
BEHAT_FEATURE: ${BEHAT_FEATURE:-}
|
||||
DIVIDE_INTO_NUM_PARTS: $DIVIDE_INTO_NUM_PARTS
|
||||
RUN_PART: $RUN_PART
|
||||
volumes:
|
||||
- ./run-tests.sh:/test/run-tests.sh
|
||||
- oCISownCloud10testsuite:/srv
|
||||
- ../../../../:/drone/src
|
||||
|
||||
volumes:
|
||||
oCISownCloud10testsuite:
|
||||
30
tests/acceptance/docker/src/ocis-base.yml
Normal file
30
tests/acceptance/docker/src/ocis-base.yml
Normal file
@@ -0,0 +1,30 @@
|
||||
services:
|
||||
ocis-server:
|
||||
environment:
|
||||
STORAGE_HOME_DRIVER: $STORAGE
|
||||
STORAGE_USERS_DRIVER: $STORAGE
|
||||
STORAGE_DRIVER_OCIS_ROOT: /srv/app/tmp/ocis/storage/users
|
||||
STORAGE_DRIVER_LOCAL_ROOT: /srv/app/tmp/ocis/local/root
|
||||
STORAGE_METADATA_ROOT: /srv/app/tmp/ocis/metadata
|
||||
STORAGE_DRIVER_OWNCLOUD_DATADIR: /srv/app/tmp/ocis/owncloud/data
|
||||
STORAGE_DRIVER_OWNCLOUD_REDIS_ADDR: redis:6379
|
||||
STORAGE_LDAP_IDP: https://ocis-server:9200
|
||||
STORAGE_OIDC_ISSUER: https://ocis-server:9200
|
||||
PROXY_OIDC_ISSUER: https://ocis-server:9200
|
||||
STORAGE_HOME_DATA_SERVER_URL: http://ocis-server:9155/data
|
||||
STORAGE_DATAGATEWAY_PUBLIC_URL: https://ocis-server:9200/data
|
||||
STORAGE_USERS_DATA_SERVER_URL: http://ocis-server:9158/data
|
||||
STORAGE_FRONTEND_PUBLIC_URL: https://ocis-server:9200
|
||||
STORAGE_SHARING_USER_JSON_FILE: /srv/app/tmp/ocis/shares.json
|
||||
PROXY_ENABLE_BASIC_AUTH: "true"
|
||||
PHOENIX_WEB_CONFIG: /drone/src/ocis/tests/config/drone/ocis-config.json
|
||||
KONNECTD_IDENTIFIER_REGISTRATION_CONF: /drone/src/ocis/tests/config/drone/identifier-registration.yml
|
||||
KONNECTD_ISS: https://ocis-server:9200
|
||||
KONNECTD_TLS: "true"
|
||||
ACCOUNTS_HASH_DIFFICULTY: 4
|
||||
volumes:
|
||||
- ../../../config:/drone/src/ocis/tests/config
|
||||
- oCISownCloud10testsuite:/srv
|
||||
|
||||
volumes:
|
||||
oCISownCloud10testsuite:
|
||||
5
tests/acceptance/docker/src/ocis-build.yml
Normal file
5
tests/acceptance/docker/src/ocis-build.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
services:
|
||||
ocis-server:
|
||||
build:
|
||||
context: ./../../../../.
|
||||
dockerfile: Dockerfile
|
||||
3
tests/acceptance/docker/src/ocis-image.yml
Normal file
3
tests/acceptance/docker/src/ocis-image.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
services:
|
||||
ocis-server:
|
||||
image: owncloud/ocis:$OCIS_IMAGE_TAG
|
||||
5
tests/acceptance/docker/src/redis.yml
Normal file
5
tests/acceptance/docker/src/redis.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
services:
|
||||
redis:
|
||||
image: webhippie/redis
|
||||
environment:
|
||||
REDIS_DATABASES: 1
|
||||
103
tests/acceptance/docker/src/run-tests.sh
Normal file
103
tests/acceptance/docker/src/run-tests.sh
Normal file
@@ -0,0 +1,103 @@
|
||||
#!/bin/bash
|
||||
|
||||
git config --global advice.detachedHead false
|
||||
|
||||
## GET DEPENDENCIES
|
||||
|
||||
if cd $TESTING_DIR > /dev/null 2>&1
|
||||
then
|
||||
git pull
|
||||
else
|
||||
git clone -b master --depth=1 https://github.com/owncloud/testing.git $TESTING_DIR
|
||||
fi
|
||||
|
||||
if cd $PATH_TO_CORE > /dev/null 2>&1
|
||||
then
|
||||
git checkout $CORE_BRANCH
|
||||
git pull
|
||||
git checkout $CORE_COMMIT
|
||||
else
|
||||
git clone -b $CORE_BRANCH --single-branch --no-tags https://github.com/owncloud/core.git $PATH_TO_CORE
|
||||
cd $PATH_TO_CORE
|
||||
git checkout $CORE_COMMIT
|
||||
fi
|
||||
|
||||
## CONFIGURE TEST
|
||||
|
||||
if [ "$TEST_SOURCE" = "oc10" ]
|
||||
then
|
||||
if [ "$STORAGE" = "owncloud" ]
|
||||
then
|
||||
export OCIS_REVA_DATA_ROOT='/srv/app/tmp/ocis/owncloud/data/'
|
||||
export DELETE_USER_DATA_CMD=''
|
||||
export BEHAT_FILTER_TAGS='~@notToImplementOnOCIS&&~@toImplementOnOCIS&&~comments-app-required&&~@federation-app-required&&~@notifications-app-required&&~systemtags-app-required&&~@local_storage&&~@skipOnOcis-OC-Storage'
|
||||
export OCIS_SKELETON_STRATEGY='copy'
|
||||
export EXPECTED_FAILURES_FILE='/drone/src/tests/acceptance/expected-failures-on-OWNCLOUD-storage.txt'
|
||||
elif [ "$STORAGE" = "ocis" ]
|
||||
then
|
||||
export OCIS_REVA_DATA_ROOT=''
|
||||
export DELETE_USER_DATA_CMD='rm -rf /srv/app/tmp/ocis/storage/users/nodes/root/* /srv/app/tmp/ocis/storage/users/nodes/*-*-*-*'
|
||||
export BEHAT_FILTER_TAGS='~@notToImplementOnOCIS&&~@toImplementOnOCIS&&~comments-app-required&&~@federation-app-required&&~@notifications-app-required&&~systemtags-app-required&&~@local_storage&&~@skipOnOcis-OCIS-Storage'
|
||||
export OCIS_SKELETON_STRATEGY='upload'
|
||||
export EXPECTED_FAILURES_FILE='/drone/src/tests/acceptance/expected-failures-on-OCIS-storage.txt'
|
||||
else
|
||||
echo "non existing STORAGE selected"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
unset BEHAT_SUITE
|
||||
|
||||
elif [ "$TEST_SOURCE" = "ocis" ]
|
||||
then
|
||||
|
||||
if [ "$STORAGE" = "owncloud" ]
|
||||
then
|
||||
export BEHAT_FILTER_TAGS='~@skipOnOcis-OC-Storage'
|
||||
export DELETE_USER_DATA_CMD=''
|
||||
export OCIS_REVA_DATA_ROOT='/srv/app/tmp/ocis/owncloud/data/'
|
||||
export OCIS_SKELETON_STRATEGY='copy'
|
||||
elif [ "$STORAGE" = "ocis" ]
|
||||
then
|
||||
export BEHAT_FILTER_TAGS='~@skipOnOcis-OCIS-Storage'
|
||||
export DELETE_USER_DATA_CMD='rm -rf /srv/app/tmp/ocis/storage/users/nodes/root/* /srv/app/tmp/ocis/storage/users/nodes/*-*-*-*'
|
||||
export OCIS_REVA_DATA_ROOT=''
|
||||
export OCIS_SKELETON_STRATEGY='upload'
|
||||
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
|
||||
fi
|
||||
|
||||
if [ ! -z "$BEHAT_FEATURE" ]
|
||||
then
|
||||
echo "feature selected: " + $BEHAT_FEATURE
|
||||
# allow to run without filters if its a feature
|
||||
|
||||
unset BEHAT_FILTER_TAGS
|
||||
unset DIVIDE_INTO_NUM_PARTS
|
||||
unset RUN_PART
|
||||
unset EXPECTED_FAILURES_FILE
|
||||
fi
|
||||
|
||||
## RUN TEST
|
||||
|
||||
if [ "$TEST_SOURCE" = "oc10" ]
|
||||
then
|
||||
make -C /srv/app/testrunner test-acceptance-api
|
||||
elif [ "$TEST_SOURCE" = "ocis" ]
|
||||
then
|
||||
cd $OCIS_ROOT
|
||||
sleep 10
|
||||
make test-acceptance-api
|
||||
else
|
||||
echo "non existing TEST_SOURCE selected"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
chmod -R 777 vendor-bin/**/vendor vendor-bin/**/composer.lock tests/acceptance/output
|
||||
Reference in New Issue
Block a user