Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Added acceptance tests container #6

Merged
merged 1 commit into from
Nov 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion compose/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ bootstrap-storage-service: ## Boostrap Storage Service (new database).
--password="test" \
--email="[email protected]" \
--api-key="test"
docker-compose exec --user root archivematica-storage-service \
git clone https://github.com/artefactual/archivematica-sampledata.git \
/home/archivematica/archivematica-sampledata
docker-compose exec --user root archivematica-storage-service \
chown -R archivematica:archivematica \
/home/archivematica/archivematica-sampledata

bootstrap-dashboard-db: ## Bootstrap Dashboard (new database).
docker-compose exec mysql mysql -hlocalhost -uroot -p12345 -e "\
Expand Down Expand Up @@ -115,8 +121,34 @@ test-dashboard: ## Run Dashboard tests.
test-storage-service: ## Run Storage Service tests.
docker-compose run --workdir /src --rm --no-deps --entrypoint py.test -e "DJANGO_SETTINGS_MODULE=storage_service.settings.test" archivematica-storage-service

test-at-up:
docker-compose -f docker-compose.yml -f docker-compose.acceptance-tests.yml up -d

test-at-check: test-at-up ## Make sure that both Firefox and Chrome are working.
docker-compose -f docker-compose.yml -f docker-compose.acceptance-tests.yml run --rm --no-deps archivematica-acceptance-tests simplehubtest

test-at-run: test-at-up ## Run the acceptance tests.
docker-compose -f docker-compose.yml -f docker-compose.acceptance-tests.yml run --rm --no-deps archivematica-acceptance-tests all

test-at-run-firefox: test-at-up ## Run the tests using just Firefox.
docker-compose -f docker-compose.yml -f docker-compose.acceptance-tests.yml run --rm --no-deps archivematica-acceptance-tests firefox

test-at-run-chrome: test-at-up ## Run the tests using just Chrome.
docker-compose -f docker-compose.yml -f docker-compose.acceptance-tests.yml run --rm --no-deps archivematica-acceptance-tests chrome

test-at-restarted: ## Ensure that all the containers are restarted.
docker-compose -f docker-compose.yml -f docker-compose.acceptance-tests.yml up -d --force-recreate --no-deps selenium-hub selenium-firefox selenium-chrome archivematica-acceptance-tests

test-at-rebuilt: ## Ensure that all the containers are rebuilt and restarted.
docker-compose -f docker-compose.yml -f docker-compose.acceptance-tests.yml up -d --build --force-recreate --no-deps selenium-hub selenium-firefox selenium-chrome archivematica-acceptance-tests

test-at-logs: ## Watch the logs generated by the containers for debugging purposes.
docker-compose -f docker-compose.yml -f docker-compose.acceptance-tests.yml logs -f selenium-hub selenium-firefox selenium-chrome archivematica-acceptance-tests

test-at-stop: ## Stop services - because browsers are not particularly lightweight.
docker-compose -f docker-compose.yml -f docker-compose.acceptance-tests.yml stop selenium-hub selenium-firefox selenium-chrome archivematica-acceptance-tests

help: ## Print this help message.
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'


.DEFAULT_GOAL := help
11 changes: 7 additions & 4 deletions compose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,19 @@ are connected to Gearman:
| clamavd | `tcp/3310` | `tcp/62006` |
| nginx » archivematica-dashboard | `tcp/80` | `tcp/62080` |
| nginx » archivematica-storage-service | `tcp/8000` | `tcp/62081` |
| selenium-hub | `tcp/4444` | `tcp/62100` |

## Tests

At the moment the acceptance tests can't run in this environment. You can run
unit and integration tests though. The `Makefile` offers some shortcuts that
you can list with the following command:
The `Makefile` includes many useful targets for testing. List them all with:

$ make 2>&1 | grep test-

For example, run `make test-storage-service` to run the Storage Service tests.
The sources of the [acceptance tests](../src/archivematica-acceptance-tests)
have been made available inside Docker using volumes so you can edit them and
the changes will apply immediately.

**TODO**: INTERACTING WITH BEHAVE, PASS TAGS, ETC? :construction:

## Resetting the environment

Expand Down
49 changes: 49 additions & 0 deletions compose/docker-compose.acceptance-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
version: "2"

# Based on "Getting Started with Docker Compose" (https://goo.gl/pBpyyY)
# More notes here: https://goo.gl/yDLK7f (incl. debugging instructions).

services:

selenium-hub:
image: "selenium/hub:3.7.1-beryllium"
expose:
- "4444"
ports:
- "62100:4444"
environment:
GRID_BROWSER_TIMEOUT: "10"
GRID_DEBUG: "false"

selenium-firefox:
image: "selenium/node-firefox:3.7.1-beryllium"
links:
- "selenium-hub"
- "nginx"
shm_size: 2g # See https://goo.gl/dkZzHh
environment:
HUB_PORT_4444_TCP_ADDR: "selenium-hub"
HUB_PORT_4444_TCP_PORT: "4444"

selenium-chrome:
image: "selenium/node-chrome:3.7.1-beryllium"
links:
- "selenium-hub"
- "nginx"
volumes:
- /dev/shm:/dev/shm # See https://goo.gl/fBzwcm
environment:
HUB_PORT_4444_TCP_ADDR: "selenium-hub"
HUB_PORT_4444_TCP_PORT: "4444"

archivematica-acceptance-tests:
build:
context: "../src/archivematica-acceptance-tests"
dockerfile: "Dockerfile"
links:
- "selenium-hub:hub"
volumes:
- "../src/archivematica-acceptance-tests:/home/archivematica/acceptance-tests:rw"
environment:
HUB_ADDRESS: "http://hub:4444/wd/hub"