mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-11-18 09:43:04 +00:00
Address PR review feedback (#3340)
Reset the pool forced-refusal mock Database sequence in native.reset() so later tests can still script the first construction as the checkpoint victim.
This commit is contained in:
parent
3594528299
commit
d2aea963a4
1 changed files with 3 additions and 2 deletions
|
|
@ -29,11 +29,13 @@ const { native } = vi.hoisted(() => {
|
|||
/** Script the FIRST read-only Database (index 0) as the checkpoint victim. */
|
||||
refuseFirst: true,
|
||||
reset(options: { refuseFirst?: boolean } = {}) {
|
||||
native.seq = 0;
|
||||
native.calls.constructions = [];
|
||||
native.calls.checkpoints = 0;
|
||||
native.calls.refusalProbes = 0;
|
||||
native.refuseFirst = options.refuseFirst ?? true;
|
||||
},
|
||||
seq: 0,
|
||||
};
|
||||
return { native };
|
||||
});
|
||||
|
|
@ -44,7 +46,6 @@ const { native } = vi.hoisted(() => {
|
|||
// recovery open and the read-only retry must never refuse, or the recovery
|
||||
// would kill itself.
|
||||
vi.mock('@ladybugdb/core', () => {
|
||||
let seq = 0;
|
||||
class Database {
|
||||
role: 'ro' | 'rw';
|
||||
index: number;
|
||||
|
|
@ -55,7 +56,7 @@ vi.mock('@ladybugdb/core', () => {
|
|||
readOnly = false,
|
||||
) {
|
||||
this.role = readOnly ? 'ro' : 'rw';
|
||||
this.index = seq++;
|
||||
this.index = native.seq++;
|
||||
native.calls.constructions.push(this.role);
|
||||
}
|
||||
async init(): Promise<void> {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue