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

Commit

Permalink
Add archivematica-acceptance-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sevein committed Oct 25, 2017
1 parent f2affa5 commit 029f3cb
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 2 deletions.
38 changes: 38 additions & 0 deletions compose/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ AM_PIPELINE_DATA ?= /tmp/am-pipeline-data
SS_LOCATION_DATA ?= /tmp/ss-location-data


.PHONY: list

list:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'

create-volumes:
mkdir -p ${AM_PIPELINE_DATA}
docker volume create \
Expand Down Expand Up @@ -39,6 +44,12 @@ bootstrap-storage-service:
--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:
docker-compose exec mysql mysql -hlocalhost -uroot -p12345 -e "\
Expand Down Expand Up @@ -85,6 +96,33 @@ restart-am-services:
docker-compose restart archivematica-dashboard
docker-compose restart archivematica-storage-service

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

at-check: at-up
docker-compose -f docker-compose.yml -f docker-compose.acceptance-tests.yml run --rm --no-deps archivematica-acceptance-tests simplehubtest

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

at-run-firefox: at-up
docker-compose -f docker-compose.yml -f docker-compose.acceptance-tests.yml run --rm --no-deps archivematica-acceptance-tests firefox

at-run-chrome: at-up
docker-compose -f docker-compose.yml -f docker-compose.acceptance-tests.yml run --rm --no-deps archivematica-acceptance-tests chrome

at-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

at-rebuilt:
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

at-logs:
docker-compose -f docker-compose.yml -f docker-compose.acceptance-tests.yml logs -f selenium-hub selenium-firefox selenium-chrome archivematica-acceptance-tests

at-stop:
docker-compose -f docker-compose.yml -f docker-compose.acceptance-tests.yml stop selenium-hub selenium-firefox selenium-chrome archivematica-acceptance-tests

db:
mysql -h127.0.0.1 --port=62001 -uroot -p12345

Expand Down
24 changes: 23 additions & 1 deletion compose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- [Web UIs](#web-uis)
- [Source code auto-reloading](#source-code-auto-reloading)
- [Ports](#ports)
- [Acceptance tests](#acceptance-tests)
- [Cleaning up](#cleaning-up)

## Audience
Expand All @@ -26,7 +27,7 @@ may work:
$ sudo apt install -y build-essential python-dev git
$ sudo pip install -U ansible docker-compose

And install Docker CE following [https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/](these instructions).
And install Docker CE following [these instructions](https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/).

## Installation

Expand Down Expand Up @@ -79,6 +80,27 @@ container is using the newest image, e.g.:
| 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` |

### Acceptance tests

There is an extra Compose file called `docker-compose.acceptance-tests.yml` that defines some extra services to run our acceptance tests, e.g. Selenium Standalone Server, Selenium Chrome Node or Selenium Firefox Node. In order to run the tests use the following command:

$ make at-run

There are some extra targets that you may find useful:

- `make at-check`: make sure that both Firefox and Chrome are working.
- `make at-logs`: watch the logs generated by the containers for debugging purposes.
- `make at-rebuilt`: ensure that all the containers are rebuilt and restarted.
- `make at-restarted`: ensure that all the containers are restarted.
- `make at-run-chrome`: run the tests using just Chrome.
- `make at-run-firefox`: run the tests using just Firefox.
- `make at-stop`: stop services - because browsers are not particularly lightweight.

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.

## Resetting the environment

Expand Down
55 changes: 55 additions & 0 deletions compose/docker-compose.acceptance-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
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.6.0"
expose:
- "4444"
ports:
- "62100:4444"
environment:
GRID_BROWSER_TIMEOUT: "10"
GRID_DEBUG: "false"

selenium-firefox:
image: "selenium/node-firefox:3.6.0"
links:
- "selenium-hub"
- "nginx"
environment:
FIREFOX_VERSION: "55.0.3"
GECKODRIVER_VERSION: "0.18.0"
HUB_PORT_4444_TCP_ADDR: "selenium-hub"
HUB_PORT_4444_TCP_PORT: "4444"

selenium-chrome:
image: "selenium/node-chrome:3.6.0"
links:
- "selenium-hub"
- "nginx"
volumes:
# Mitigates the Chromium issue described at https://goo.gl/fBzwcm
- /dev/shm:/dev/shm
shm_size: 2g # TODO: Do I need this?
privileged: true # TODO: Do I need this?
environment:
CHROME_VERSION: "google-chrome-stable"
CHROME_DRIVER_VERSION: "latest"
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"

0 comments on commit 029f3cb

Please sign in to comment.