Tests: a corrupt chunk fails its range on the third report
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fa52d9256b
commit
d72fe2f13f
1 file changed
+9
-6
@@ -105,12 +105,15 @@ test.group('Node API', (group) => {
|
||||
assert.deepEqual(range.plain_chunks.map(Number), [101])
|
||||
// No longer this node's: a second report is refused.
|
||||
;(await client.post(`/api/v1/node/ranges/${rangeId}/corrupt`).bearerToken(token).json({ from: 101 })).assertStatus(409)
|
||||
// Leased again and the plain chunk still doesn't inflate: the range is set aside, not leased in a loop.
|
||||
await Spool.write(rangeId, { from: 101, to: 200 }, chunk(111))
|
||||
;(await client.post('/api/v1/node/lease').bearerToken(token)).assertStatus(200)
|
||||
;(await client.post(`/api/v1/node/ranges/${rangeId}/corrupt`).bearerToken(token).json({ from: 101 })).assertStatus(200)
|
||||
range = await db.from('ranges').where('id', rangeId).first()
|
||||
assert.equal(range.status, 'failed')
|
||||
// Leased again, the chunk still doesn't inflate: once more (the compressed copy may have been spooled
|
||||
// again meanwhile), then the range is set aside, not leased in a loop.
|
||||
for (const status of ['planned', 'failed']) {
|
||||
await Spool.write(rangeId, { from: 101, to: 200 }, chunk(111))
|
||||
;(await client.post('/api/v1/node/lease').bearerToken(token)).assertStatus(200)
|
||||
;(await client.post(`/api/v1/node/ranges/${rangeId}/corrupt`).bearerToken(token).json({ from: 101 })).assertStatus(200)
|
||||
range = await db.from('ranges').where('id', rangeId).first()
|
||||
assert.equal(range.status, status)
|
||||
}
|
||||
assert.include(range.error, 'also fetched plain')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user