Skip to content

Commit

Permalink
Do not delay snapshot on start to next tick
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-dp committed Apr 23, 2024
1 parent 027107c commit fb3f2ce
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions clients/typescript/test/satellite/process.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ const startSatellite = async (
await satellite.start(authState)
satellite.setToken(token)
const connectionPromise = satellite.connectWithBackoff().catch((e) => {
if (
e.message === 'terminating connection due to administrator command'
) {
if (e.message === 'terminating connection due to administrator command') {
// This is to be expected as we stop Postgres at the end of the test
return
}
Expand Down Expand Up @@ -2514,4 +2512,28 @@ export const processTests = (test: TestFn<ContextType>) => {

t.pass()
})

test("don't snapshot after closing satellite process", async (t) => {
// open and then immediately close
// check that no snapshot is called after close
const { satellite, authState, token } = t.context
const { connectionPromise } = await startSatellite(
satellite,
authState,
token
)

await connectionPromise
await satellite.stop()

satellite._performSnapshot = () => {
t.fail('Snapshot was called')
return Promise.resolve(new Date())
}

// wait some time to see that mutexSnapshot is not called
await sleepAsync(50)

t.pass()
})
}

0 comments on commit fb3f2ce

Please sign in to comment.