File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ ENV TEMPORARY_CERT_NAME=solid-temporary
1111
1212WORKDIR ${SOLID_HOME}
1313COPY ./src/entrypoint.sh ./entrypoint.sh
14+ COPY ./src/checks.sh ./checks.sh
1415COPY ./src/create-temporary-cert.sh ./create-temporary-cert.sh
1516RUN chown --recursive ${PROCESS_USER}:${PROCESS_USER} ${SOLID_HOME}
1617
@@ -27,4 +28,4 @@ VOLUME $SOLID_HOME
2728
2829ENTRYPOINT ["./entrypoint.sh" ]
2930
30- CMD ["start" ]
31+ CMD ["start" ]
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ checks_failed=0
4+
5+ check_failed ()
6+ {
7+ checks_failed=$(( checks_failed + 1 ))
8+ }
9+ check_dir_exists ()
10+ {
11+ dir=$1
12+ if [ -f " ${dir} " ]; then
13+ echo " ✓ ${dir} exists"
14+ else
15+ echo " ✗ ${dir} missing"
16+ check_failed
17+ fi
18+ }
19+
20+ check_dir_exists " ${SOLID_HOME} /data"
21+ check_dir_exists " ${SOLID_HOME} /.db"
22+ check_dir_exists " ${SOLID_HOME} /config"
23+
24+ if [ " $checks_failed " -gt 0 ]; then
25+ echo " Finished: ERROR"
26+ exit 1
27+ fi
Original file line number Diff line number Diff line change 22
33set -e
44
5+ ./checks.sh
6+
57./create-temporary-cert.sh ${TEMPORARY_CERT_NAME}
68
7- solid " $@ "
9+ solid " $@ "
Original file line number Diff line number Diff line change 1+ # coding=utf-8
2+ import docker
3+ import pytest
4+ import time
5+
6+ testinfra_hosts = ['docker://test_container' ]
7+
8+
9+ @pytest .fixture (scope = "module" , autouse = True )
10+ def container (client , image ):
11+ container = client .containers .run (
12+ image .id ,
13+ name = "test_container" ,
14+ volumes = {
15+ 'missing_data' : {'bind' : '/opt/solid/data' },
16+ 'missing_db' : {'bind' : '/opt/solid/.db' },
17+ 'missing_config' : {'bind' : '/opt/solid/config' }
18+ },
19+ environment = [
20+ "SOLID_SERVER_KEY=/missing/key" ,
21+ "SOLID_SERVER_CERT=/missing/cert"
22+ ],
23+ detach = True ,
24+ tty = True
25+ )
26+ # give the solid process some seconds to create the directory structure before making assertions
27+ time .sleep (2 )
28+ yield container
29+ container .remove (force = True )
30+
31+
32+ def test_container_fails_with_errors (container ):
33+ assert container .status == "created"
34+ logs = container .logs ()
35+ assert "✗ /opt/solid/data missing" in logs
36+ assert "✗ /opt/solid/.db missing" in logs
37+ assert "✗ /opt/solid/config missing" in logs
38+ assert "Finished: ERROR" in logs
39+ assert not "Finished: SUCCESS" in logs
You can’t perform that action at this time.
0 commit comments