Skip to content

Commit 512c56e

Browse files
committed
check only if dirs are writable if they already exist (i.e. are mounted)
1 parent 1a165f4 commit 512c56e

3 files changed

Lines changed: 19 additions & 13 deletions

File tree

src/checks.sh

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,26 @@ check_failed()
66
{
77
checks_failed=$((checks_failed + 1))
88
}
9-
check_dir_exists()
9+
check_if_writable()
1010
{
11+
# checks if the given dir is writable, if it exists
12+
# it's ok if the dir does not exist at all, because it will be created
13+
# during solid server startup then and have the correct permissions
1114
dir=$1
12-
if [ -f "${dir}" ]; then
13-
echo "${dir} exists"
14-
else
15-
echo "${dir} missing"
16-
check_failed
15+
if [ -d "${dir}" ]; then
16+
if [ -w "${dir}" ]; then
17+
ls -lah ${dir};
18+
echo "${dir} is accessible by $(whoami)"
19+
else
20+
echo "${dir} not writable by $(whoami)"
21+
check_failed
22+
fi
1723
fi
1824
}
1925

20-
check_dir_exists "${SOLID_HOME}/data"
21-
check_dir_exists "${SOLID_HOME}/.db"
22-
check_dir_exists "${SOLID_HOME}/config"
26+
check_if_writable "${SOLID_HOME}/config"
27+
check_if_writable "${SOLID_HOME}/data"
28+
check_if_writable "${SOLID_HOME}/.db"
2329

2430
if [ "$checks_failed" -gt 0 ]; then
2531
echo "Finished: ERROR"

test/test_precondition_checks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ def container(client, image):
3232
def test_container_fails_with_errors(container):
3333
assert container.status == "created"
3434
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
35+
assert "✗ /opt/solid/config not writable by node" in logs
36+
assert "✗ /opt/solid/data not writable by node" in logs
37+
assert "✗ /opt/solid/.db not writable by node" in logs
3838
assert "Finished: ERROR" in logs
3939
assert not "Finished: SUCCESS" in logs

test/test_solid_default_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ def test_solid_is_running(host):
6464
assert solid.group == "node"
6565

6666
def test_solid_is_listening_on_port_8443(host):
67-
assert host.socket("tcp://0.0.0.0:8443").is_listening
67+
assert host.socket("tcp://0.0.0.0:8443").is_listening

0 commit comments

Comments
 (0)