chore(8.0): Phase C + D + E — config simplification, TODO sweep, test race fix
Phase C: storageAutoConfig.ts rewrite (376 LOC → ~110 LOC). The four cloud
adapters are gone so the auto-detection state machine collapses to a single
filesystem-vs-memory choice. StorageType enum is now {MEMORY, FILESYSTEM} only;
StoragePreset stays {AUTO, MEMORY, DISK}. zeroConfig.ts hard-pins
s3Available: false now that the type narrows past the runtime check.
Phase D: TODO/FIXME sweep in src/. Removed seven stale markers. The CLI cow
migrate command's backup path now uses fs.cp with recursive + force:false
instead of a TODO placeholder.
Phase E: skipped-test deletion + parallel-test race fix.
- storage-batch-operations.test.ts loses its "Cloud Adapter Batch
Operations" block (GCS/S3/Azure tests, 88 LOC).
- cow-full-integration.test.ts loses its skipped "S3 adapter" test.
- create-entities-default.test.ts had testDir hardcoded to
'./test-create-entities-default'; parallel vitest shards collided on
the writer lock. testDir is now os.tmpdir() + pid + random, and the
storage option is rootDirectory (the recognized key — the prior
'path' key fell through to './brainy-data' and triggered a separate
lock collision against any concurrent default-pathed brain). Added
afterEach brain.close() so the lock releases before rmSync.
This commit is contained in:
parent
cb16a39a0c
commit
2626ab8d62
10 changed files with 94 additions and 485 deletions
|
|
@ -92,33 +92,6 @@ describe('COW Full Integration', () => {
|
|||
await brain.destroy()
|
||||
await fork.destroy()
|
||||
})
|
||||
|
||||
// Note: S3/R2/GCS/Azure tests require cloud credentials
|
||||
// Run these in CI/CD with proper credentials
|
||||
it.skip('should work with S3 adapter', async () => {
|
||||
const brain = new Brainy({ requireSubtype: false,
|
||||
storage: {
|
||||
adapter: 's3',
|
||||
bucket: 'test-brainy-cow',
|
||||
region: 'us-east-1'
|
||||
}
|
||||
})
|
||||
|
||||
await brain.init()
|
||||
|
||||
const entity = await brain.add({
|
||||
type: NounType.File,
|
||||
data: { content: 'S3 test' }
|
||||
})
|
||||
|
||||
const fork = await brain.fork('s3-branch')
|
||||
|
||||
const retrieved = await fork.get(entity.id)
|
||||
expect(retrieved.data.content).toBe('S3 test')
|
||||
|
||||
await brain.destroy()
|
||||
await fork.destroy()
|
||||
})
|
||||
})
|
||||
|
||||
describe('Billion-Scale Performance', () => {
|
||||
|
|
|
|||
|
|
@ -546,94 +546,3 @@ describe('Storage-Level Batch Operations v5.12.0', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe('Cloud Adapter Batch Operations (Integration)', () => {
|
||||
// Note: These tests require actual cloud storage credentials
|
||||
// Skip in CI unless credentials are configured
|
||||
|
||||
it.skip('should use native GCS batch API', async () => {
|
||||
// Requires GOOGLE_APPLICATION_CREDENTIALS
|
||||
const brain = new Brainy({ requireSubtype: false,
|
||||
storage: {
|
||||
type: 'gcs',
|
||||
bucketName: process.env.GCS_TEST_BUCKET || 'test-bucket',
|
||||
projectId: process.env.GCS_PROJECT_ID || 'test-project'
|
||||
}
|
||||
})
|
||||
|
||||
await brain.init()
|
||||
|
||||
// Test batch operations
|
||||
const ids = []
|
||||
for (let i = 0; i < 50; i++) {
|
||||
const id = await brain.add({ type: 'document', data: `GCS ${i}` })
|
||||
ids.push(id)
|
||||
}
|
||||
|
||||
const startTime = performance.now()
|
||||
const results = await brain.batchGet(ids)
|
||||
const duration = performance.now() - startTime
|
||||
|
||||
expect(results.size).toBe(50)
|
||||
console.log(`GCS batch (50 entities): ${duration.toFixed(2)}ms`)
|
||||
|
||||
await brain.close()
|
||||
})
|
||||
|
||||
it.skip('should use native S3 batch API', async () => {
|
||||
// Requires AWS credentials
|
||||
const brain = new Brainy({ requireSubtype: false,
|
||||
storage: {
|
||||
type: 's3',
|
||||
bucketName: process.env.S3_TEST_BUCKET || 'test-bucket',
|
||||
region: process.env.AWS_REGION || 'us-east-1'
|
||||
}
|
||||
})
|
||||
|
||||
await brain.init()
|
||||
|
||||
// Test batch operations
|
||||
const ids = []
|
||||
for (let i = 0; i < 50; i++) {
|
||||
const id = await brain.add({ type: 'document', data: `S3 ${i}` })
|
||||
ids.push(id)
|
||||
}
|
||||
|
||||
const startTime = performance.now()
|
||||
const results = await brain.batchGet(ids)
|
||||
const duration = performance.now() - startTime
|
||||
|
||||
expect(results.size).toBe(50)
|
||||
console.log(`S3 batch (50 entities): ${duration.toFixed(2)}ms`)
|
||||
|
||||
await brain.close()
|
||||
})
|
||||
|
||||
it.skip('should use native Azure batch API', async () => {
|
||||
// Requires Azure credentials
|
||||
const brain = new Brainy({ requireSubtype: false,
|
||||
storage: {
|
||||
type: 'azure',
|
||||
containerName: process.env.AZURE_CONTAINER || 'test-container',
|
||||
accountName: process.env.AZURE_ACCOUNT_NAME || 'testaccount'
|
||||
}
|
||||
})
|
||||
|
||||
await brain.init()
|
||||
|
||||
// Test batch operations
|
||||
const ids = []
|
||||
for (let i = 0; i < 50; i++) {
|
||||
const id = await brain.add({ type: 'document', data: `Azure ${i}` })
|
||||
ids.push(id)
|
||||
}
|
||||
|
||||
const startTime = performance.now()
|
||||
const results = await brain.batchGet(ids)
|
||||
const duration = performance.now() - startTime
|
||||
|
||||
expect(results.size).toBe(50)
|
||||
console.log(`Azure batch (50 entities): ${duration.toFixed(2)}ms`)
|
||||
|
||||
await brain.close()
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue