forked from ome/omero-server-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·87 lines (64 loc) · 1.73 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
set -e
set -u
PREFIX=test
IMAGE=omero-server:$PREFIX
CLEAN=${CLEAN:-y}
ci_group_start() {
if [ -n "${GITHUB_ACTIONS:-}" ]; then
echo "::group::$1"
fi
}
ci_group_end() {
if [ -n "${GITHUB_ACTIONS:-}" ]; then
echo "::endgroup::"
fi
}
cleanup() {
docker logs $PREFIX-server || echo "Failed to get logs"
docker rm -f -v $PREFIX-db $PREFIX-server
docker network rm $PREFIX-omero || true
}
if [ "$CLEAN" = y ]; then
trap cleanup ERR EXIT
fi
ci_group_start "Build"
cleanup || true
docker build -t $IMAGE .
ci_group_end
ci_group_start "Run"
docker network create $PREFIX-omero
docker run --network=$PREFIX-omero -d --name $PREFIX-db -e POSTGRES_PASSWORD=postgres docker.io/library/postgres:14
# Check both CONFIG_environment and *.omero config mounts work
docker run --network=$PREFIX-omero -d --name $PREFIX-server \
-p 4064 \
-e CONFIG_omero_db_host="$PREFIX-db" \
-e CONFIG_omero_db_user=postgres \
-e CONFIG_omero_db_pass=postgres \
-e CONFIG_omero_db_name=postgres \
-e CONFIG_custom_property_fromenv=fromenv \
-e ROOTPASS=omero-root-password \
-v $PWD/test-config/config.omero:/opt/omero/server/config/config.omero:ro,z \
$IMAGE
ci_group_end
# Smoke tests
ci_group_start "Login and config"
export OMERO_USER=root
export OMERO_PASS=omero-root-password
export PREFIX
# Login to server
bash test_login.sh
# Check the Docker OMERO configuration system
bash test_config.sh
ci_group_end
ci_group_start "Dropbox"
# Wait a minute to ensure other servers are running
sleep 60
# Now that we know the server is up, test Dropbox
bash test_dropbox.sh
ci_group_end
# And Processor (slave-1)
ci_group_start "Processor"
bash test_processor.sh
ci_group_end
echo "Success!"