Revert "test(credentials): await reload commit notifications"
This reverts commit 436ec72d4b744cbf3c1473680388d802940b6b9e.
This commit is contained in:
1 parent
5367541916
commit
ba1e73ddf5
1 file changed
+7
-11
@@ -145,15 +145,9 @@ describe('watcher pipeline', () => {
|
||||
const dir = await tempDir()
|
||||
const path = join(dir, '.credentials.yaml')
|
||||
const ctx = await boot({ path, debounceMs: 5 })
|
||||
const firstUpdate = Promise.withResolvers<undefined>()
|
||||
const secondUpdate = Promise.withResolvers<undefined>()
|
||||
let arm = true
|
||||
ctx.on('credentials/reference-updated', () => {
|
||||
if (!arm) {
|
||||
secondUpdate.resolve(undefined)
|
||||
return
|
||||
}
|
||||
firstUpdate.resolve(undefined)
|
||||
if (!arm) return
|
||||
throw Object.assign(new Error('forged relation'), { code: 'INVARIANT' })
|
||||
})
|
||||
const [instance] = await fakeInstances()
|
||||
@@ -162,14 +156,16 @@ describe('watcher pipeline', () => {
|
||||
instance!.watcher.emit('all', 'change', path)
|
||||
// The snapshot commits before the fan-out, so the value lands even though
|
||||
// the listener threw out of the refresh.
|
||||
await firstUpdate.promise
|
||||
expect(await ctx.credentials.resolve(KEY)).toEqual({ value: 'first', source: 'file' })
|
||||
await vi.waitFor(async () => {
|
||||
expect(await ctx.credentials.resolve(KEY)).toEqual({ value: 'first', source: 'file' })
|
||||
})
|
||||
|
||||
arm = false
|
||||
await writeCredentials(path, 'version: 1\nrefs:\n DSH_CRED_PIPE: second\n')
|
||||
instance!.watcher.emit('all', 'change', path)
|
||||
await secondUpdate.promise
|
||||
expect(await ctx.credentials.resolve(KEY)).toEqual({ value: 'second', source: 'file' })
|
||||
await vi.waitFor(async () => {
|
||||
expect(await ctx.credentials.resolve(KEY)).toEqual({ value: 'second', source: 'file' })
|
||||
})
|
||||
})
|
||||
|
||||
it('quiesces the refresh pipeline before dispose completes', async () => {
|
||||
|
||||
Reference in new issue
Block a user