Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

Tests: the unwritable ./data checks are skipped when running as root, where a 0500 directory is still writable (GitLab CI)

Duarte Santose6c920eb0a65
diff --git a/api/test/server-push-prune-save.test.js b/api/test/server-push-prune-save.test.js
index fac09d441..7d150dc05 100644
--- a/api/test/server-push-prune-save.test.js
+++ b/api/test/server-push-prune-save.test.js
@@ -60,9 +60,13 @@ async function startServer(t) {
return h;
}
const unwritable = h => fs.chmodSync(h.dataDir, 0o500);
+// Root writes through a 0500 directory, so the failure these tests need cannot be made as root
+// (the GitLab CI container runs as root); they are skipped there rather than failing for it.
+const asRoot = typeof process.getuid === 'function' && process.getuid() === 0;
+const skip = asRoot ? 'running as root: a 0500 directory is still writable' : false;
const writable = h => fs.chmodSync(h.dataDir, 0o700);
-test('an unwritable ./data cannot take the process down through the rest timer nobody awaits', async t => {
+test('an unwritable ./data cannot take the process down through the rest timer nobody awaits', { skip }, async t => {
const h = await startServer(t);
unwritable(h);
const r = await fetch(`${h.api}/api/push/rest-timer`, {
@@ -78,7 +82,7 @@ test('an unwritable ./data cannot take the process down through the rest timer n
assert.match(h.log, /push: could not save db.json/, 'and it said so, once, without a stack');
});
-test('a push that was delivered is a 200 even when only the prune save failed', async t => {
+test('a push that was delivered is a 200 even when only the prune save failed', { skip }, async t => {
const h = await startServer(t);
unwritable(h);
const r = await fetch(`${h.api}/api/push/test`, {