ome / omero-test-infra

Test infrastructure for decoupled repositories
BSD 2-Clause "Simplified" License
3 stars 13 forks source link
docker infrastructure omero test travis

OMERO Test Infra

Actions Status

omero-test-infra provides simplified integration testing for projects that are built on OMERO.server or OMERO.web.

Any repository that relies on an existing OMERO installation can depend on this directory whether for testing in CI system or locally.

The are a number of examples which are run regularly by CI.

Setup

The directory MUST BE located at .omero at the top-level of your source code. This can be achieved most simply by:

git clone https://github.com/openmicroscopy/omero-test-infra .omero

but adding the repository as a submodule or downloading a zip file is also permissible.

Basic usage

.omero/compose up will start a basic OMERO stack including PostgreSQL, OMERO.server, and OMERO.web using the current production docker images. The definition of the stack is available in docker-compose.yml with a number of environment variables being specified in .env.

All docker compose environment variables like COMPOSE_FILE will be respected, except for COMPOSE_PROJECT_NAME which has special handling via the PROJECT environment variable.

Docker commands

To run a full build and install the desire applications, it is recommended to use

where NAME is app, cli, lib or scripts. The special srv command will build the parent directory as a replacement for the OMERO.server container.

It is also possible to combine several application e.g.

but each of the applications must pass when it is run alone as well.

These commands should be invoked by the script step in the project's omero_plugin.yml file. Set any environment variables as necessary.

Extension mechanisms

If none of the commands above work for your scenario, there are a number of extension mechanisms that you can make use of.

Finally, if none of these options cover what you need, please contact us via GitHub issues to suggest a new stage command.

Hooks

Each command runs a number of subcommands or tasks which can be overridden by placing an executable file of the same name in an .omeroci directory beside the .omero directory.

You can also define a custom environment:

Environment variables

The .env defines a number of variables that can optionally be passed to docker instances if specified in the docker compile file. By setting these values in your calling environment or updating the .env file, you can influence the behavior of omero-test-infra. Of particular use are:

Other environment arguments that omero-test-infra uses:

Docker compose files

Helper scripts

Some of the other scripts in this repository are generally useful for interacting with the services started by omero-test-infra:

Developer mode

When developing a plugin it can be useful to run part of the OMERO-test-infra scripts instead of recreating the full docker infrastructure each time. A special dev command is available to modify an existing running server. Examine the docker script for available commands. For example:

Start a particular server with NOCLEAN=true:

NOCLEAN=true .omero/docker cli

or start an independent server:

.omero/docker dev start_up

Update the plugin with local changes:

.omero/docker dev install

Run the linter, install, run tests

.omero/docker dev run py check
.omero/docker dev run py setup
.omero/docker dev run --user cli build

Remember, you may need to set some environment variables to ensure your plugin is discovered and tested correctly. See docker.

Trouble-shooting

You can also obtain a bash shell in the server:

.omero/docker dev sh

If you run with:

NOCLEAN=true .omero/docker app

then you can inspect the docker containers. For example:

.omero/compose exec web bash

Examples

You can find more examples by searching for "ome/omero-test-infra filename:omero_plugin.yml" on GitHub.com.