git » chasquid » commit 735613c

test: Set `state_dir` in Dovecot config

author Alberto Bertogli
2022-07-03 20:23:11 UTC
committer Alberto Bertogli
2022-07-04 08:46:50 UTC
parent 7fe22ef1044dbb359754435906acbf5b6d2def1d

test: Set `state_dir` in Dovecot config

Dovecot's `state_dir` usually defaults to be at `/var/lib/dovecot`, or a
similar system-wide path.

Under some conditions, our test Dovecot instance can fail, because it's
wanting to write to state_dir, but it is not writeable by us in the test
environment.

This was reported by foxcpp in
https://github.com/albertito/chasquid/issues/28.

This patch fixes the problem by setting a custom state_dir to be within
our testing directory.

Thanks to foxcpp for reporting this problem and suggesting a fix.

test/t-11-dovecot/config/dovecot.conf.in +1 -0
test/t-11-dovecot/run.sh +1 -1

diff --git a/test/t-11-dovecot/config/dovecot.conf.in b/test/t-11-dovecot/config/dovecot.conf.in
index e97913d..eb7a9be 100644
--- a/test/t-11-dovecot/config/dovecot.conf.in
+++ b/test/t-11-dovecot/config/dovecot.conf.in
@@ -1,4 +1,5 @@
 base_dir = $ROOT/run/
+state_dir = $ROOT/lib/
 log_path = $ROOT/dovecot.log
 ssl = no
 
diff --git a/test/t-11-dovecot/run.sh b/test/t-11-dovecot/run.sh
index c20f279..2a96b32 100755
--- a/test/t-11-dovecot/run.sh
+++ b/test/t-11-dovecot/run.sh
@@ -23,7 +23,7 @@ fi
 # limitation, so we use a directory in /tmp, which is not ideal, as a
 # workaround.
 export ROOT="/tmp/chasquid-dovecot-test"
-mkdir -p $ROOT $ROOT/run
+mkdir -p $ROOT $ROOT/run $ROOT/lib
 rm -f $ROOT/dovecot.log
 
 export GROUP=$(id -g -n)