-
Notifications
You must be signed in to change notification settings - Fork 9
/
test.sh
executable file
·105 lines (85 loc) · 3.68 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/env bash
set -o errexit
start() { echo travis_fold':'start:$1; echo $1; }
end() { echo travis_fold':'end:$1; }
die() { set +v; echo "$*" 1>&2 ; sleep 1; exit 1; }
# Race condition truncates logs on Travis: "sleep" might help.
# https://github.com/travis-ci/travis-ci/issues/6018
# Due to Travis CI permissions, create temporary work
# directory that is relative to the home directory
TMPDIR=$(mktemp --directory --tmpdir=${HOME})
start get-data
./get_test_data.sh
end get-data
HIGLASS_DOCKER_VERSION=v0.6.9;
start ingest
[ -e ${TMPDIR}/test-hg-data ] && rm -rf ${TMPDIR}/test-hg-data
[ -e ${TMPDIR}/test-hg-media ] && rm -rf ${TMPDIR}/test-hg-media
# ingest a bedfile; useful for testing the aggregate
# function that gets called first
higlass-manage ingest --filetype bedfile \
--datatype bedlike --assembly hg19\
data/ctcf_known1_100.bed
# directories that will store data and media
mkdir ${TMPDIR}/test-hg-data
mkdir ${TMPDIR}/test-hg-media
cp data/Dixon2012-J1-NcoI-R1-filtered.100kb.multires.cool \
${TMPDIR}/test-hg-media/dixon.mcool
higlass-manage view ${TMPDIR}/test-hg-media/dixon.mcool
PORT=8123
higlass-manage start --version ${HIGLASS_DOCKER_VERSION} --port ${PORT} \
--hg-name test-hg \
--data-dir ${TMPDIR}/test-hg-data \
--media-dir ${TMPDIR}/test-hg-media
higlass-manage ingest --hg-name test-hg \
--no-upload /media/dixon.mcool \
--uid a
docker exec higlass-manage-container-default bash -c 'grep -v "showTooltip" higlass-app/static/js/main*.chunk.js | grep function' || die
end ingest
# check to make sure that the default options were loaded
start default-options
higlass-manage start --version ${HIGLASS_DOCKER_VERSION} --default-track-options data/default_options.json
docker exec higlass-manage-container-default bash -c 'grep "showTooltip" higlass-app/static/js/main*.chunk.js' || die
end default-options
start wait
URL="localhost:$PORT/api/v1/tilesets/"
until curl ${URL}; do
sleep 1
done
curl ${URL} | grep dixon.mcool \
|| die
end wait
start update-viewconfs
# if I understand correctly "test-hg" is still alive by now !
# so we'll use it to test "update-viewconfs":
URL="http://localhost:$PORT/api/v1/viewconfs/"
# 1) post viewconf - to simulate a viewconf saved as a link ...
curl -d "@data/test_viewconf.json" -X POST ${URL}
# 2) once "test-123" viewconf is on server-side, i.e. in the "${TMPDIR}/test-hg-data/db.sqlite3"
higlass-manage update-viewconfs --old-hg-name test-hg --new-site-url new.host.org
# 3) now "${TMPDIR}/test-hg-data/db.sqlite3.updated" should become available, with new.host.org instead
sqlite3 ${TMPDIR}/test-hg-data/db.sqlite3.updated \
"SELECT viewconf FROM tilesets_viewconf WHERE uuid='test-123'" | grep new.host.org \
|| die
end update-viewconfs
start cleanup
higlass-manage stop test-hg
end cleanup
start redis
mkdir ${TMPDIR}/test-hg-data-with-redis
mkdir ${TMPDIR}/test-hg-media-with-redis
mkdir ${TMPDIR}/test-redis
PORT=8124
higlass-manage start --version $HIGLASS_DOCKER_VERSION \
--port ${PORT} \
--hg-name test-hg-with-redis \
--data-dir ${TMPDIR}/test-hg-data-with-redis \
--media-dir ${TMPDIR}/test-hg-media-with-redis \
--redis-dir ${TMPDIR}/test-redis \
--use-redis
docker exec -i higlass-manage-redis-test-hg-with-redis 'redis-cli' < <(echo ping) || die
end redis
start cleanup
higlass-manage stop test-hg-with-redis
end cleanup
echo 'Passed all tests'