Caddy (including Caddies run as caddytest.Tester) will create instance.uuid if it doesn't already exist. However, this will fail if caddy.AppDataDir() doesn't already exist, which appears to be the case when caddytest.Tester is used on Linux (though not on Windows or macOS, which I don't understand).
This makes it difficult to use caddytest.Tester to test modules that need caddy.InstanceID() to work. See for example my struggles in mholt/caddy-ratelimit#34, where I resorted to doing os.MkdirAll(caddy.AppDataDir()), which works well enough in CI, but doesn't feel like a great solution.
It'd be nice if caddytest.Tester could consistently guarantee that AppDataDir will exist, or perhaps it could avoid writing the instance ID to disk altogether since a caddytest.Tester instance is not likely to need persistence across restarts.
Caddy (including Caddies run as
caddytest.Tester) will createinstance.uuidif it doesn't already exist. However, this will fail ifcaddy.AppDataDir()doesn't already exist, which appears to be the case whencaddytest.Testeris used on Linux (though not on Windows or macOS, which I don't understand).This makes it difficult to use
caddytest.Testerto test modules that needcaddy.InstanceID()to work. See for example my struggles in mholt/caddy-ratelimit#34, where I resorted to doingos.MkdirAll(caddy.AppDataDir()), which works well enough in CI, but doesn't feel like a great solution.It'd be nice if
caddytest.Testercould consistently guarantee thatAppDataDirwill exist, or perhaps it could avoid writing the instance ID to disk altogether since acaddytest.Testerinstance is not likely to need persistence across restarts.