dsh-delete-session 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +9 -0
- package/cordis.patch.yml +7 -7
- package/package.json +1 -1
- package/src/index.js +2166 -2157
- package/test/artifacts.host.test.js +22 -3
|
@@ -50,7 +50,12 @@ process.env.DSH_HOME = HOME_ROOT
|
|
|
50
50
|
// hand the next test the real home.
|
|
51
51
|
beforeEach(() => {
|
|
52
52
|
assert.equal(process.env.DSH_HOME, HOME_ROOT, 'every test must run against the scratch home')
|
|
53
|
-
|
|
53
|
+
// Compare through realpath: on macOS `os.tmpdir()` is /var/folders/... while
|
|
54
|
+
// the same directory resolves to /private/var/folders/..., and a plain prefix
|
|
55
|
+
// test failed every single test in this file on this machine.
|
|
56
|
+
const tmp = fs.realpathSync(os.tmpdir())
|
|
57
|
+
const root = fs.realpathSync(HOME_ROOT)
|
|
58
|
+
assert.ok(root.startsWith(tmp), 'the scratch home must live under tmp, got ' + HOME_ROOT)
|
|
54
59
|
})
|
|
55
60
|
|
|
56
61
|
function writeAt(root, relative, content = 'x') {
|
|
@@ -1165,10 +1170,24 @@ test('the delete reports which children failed', async () => {
|
|
|
1165
1170
|
|
|
1166
1171
|
const result = await internals.deleteSession(serviceFree, PARENT_ID, {
|
|
1167
1172
|
recycle: false,
|
|
1168
|
-
|
|
1173
|
+
// Not "not-a-session-id": a dashed name is a LEGAL DSH id (the GUI creates
|
|
1174
|
+
// named sessions). What must never become a child delete is an id that
|
|
1175
|
+
// could leave the session store.
|
|
1176
|
+
childSessionIds: ['../etc/passwd'],
|
|
1169
1177
|
})
|
|
1170
1178
|
|
|
1171
|
-
assert.equal(result.children.length, 0, 'an
|
|
1179
|
+
assert.equal(result.children.length, 0, 'an id that could leave a path never becomes a child delete')
|
|
1180
|
+
})
|
|
1181
|
+
|
|
1182
|
+
test('a NAMED session is taken with its parent, like any other id', async () => {
|
|
1183
|
+
const parent = plantSession(PARENT_ID)
|
|
1184
|
+
const named = plantSession('bili-whale')
|
|
1185
|
+
|
|
1186
|
+
await internals.deleteSession(serviceFree, PARENT_ID, { recycle: false, childSessionIds: ['bili-whale'] })
|
|
1187
|
+
|
|
1188
|
+
assert.equal(fs.existsSync(parent.dir), false, 'the parent is gone')
|
|
1189
|
+
assert.equal(fs.existsSync(named.dir), false, 'the named child went with it')
|
|
1190
|
+
assert.equal(fs.existsSync(named.cache), false, 'and so did its cache row')
|
|
1172
1191
|
})
|
|
1173
1192
|
|
|
1174
1193
|
test('a child is probed for a live writer before its files go', async () => {
|