@@ -68,6 +68,7 @@ function createReadinessHarness(params: {
|
68 | 68 | accounts?: Record<string, Partial<ChannelAccountSnapshot>>; |
69 | 69 | getStartupPending?: () => boolean; |
70 | 70 | getStartupPendingReason?: Parameters<typeof createReadinessChecker>[0]["getStartupPendingReason"]; |
| 71 | +getGatewayDraining?: Parameters<typeof createReadinessChecker>[0]["getGatewayDraining"]; |
71 | 72 | getEventLoopHealth?: Parameters<typeof createReadinessChecker>[0]["getEventLoopHealth"]; |
72 | 73 | shouldSkipChannelReadiness?: Parameters< |
73 | 74 | typeof createReadinessChecker |
@@ -83,6 +84,7 @@ function createReadinessHarness(params: {
|
83 | 84 | startedAt, |
84 | 85 | getStartupPending: params.getStartupPending, |
85 | 86 | getStartupPendingReason: params.getStartupPendingReason, |
| 87 | +getGatewayDraining: params.getGatewayDraining, |
86 | 88 | getEventLoopHealth: params.getEventLoopHealth, |
87 | 89 | shouldSkipChannelReadiness: params.shouldSkipChannelReadiness, |
88 | 90 | cacheTtlMs: params.cacheTtlMs, |
@@ -178,6 +180,35 @@ describe("createReadinessChecker", () => {
|
178 | 180 | }); |
179 | 181 | }); |
180 | 182 | |
| 183 | +it("reports not ready while the gateway command queue is draining for restart", () => { |
| 184 | +withReadinessClock(() => { |
| 185 | +const { manager, readiness } = createReadinessHarness({ |
| 186 | +getGatewayDraining: () => true, |
| 187 | +cacheTtlMs: 1_000, |
| 188 | +}); |
| 189 | + |
| 190 | +expect(readiness()).toEqual(failingSnapshot(["gateway-draining"])); |
| 191 | +expect(manager.getRuntimeSnapshot).not.toHaveBeenCalled(); |
| 192 | +}); |
| 193 | +}); |
| 194 | + |
| 195 | +it("does not cache gateway-draining readiness", () => { |
| 196 | +withReadinessClock(() => { |
| 197 | +let gatewayDraining = true; |
| 198 | +const { manager, readiness } = createReadinessHarness({ |
| 199 | +getGatewayDraining: () => gatewayDraining, |
| 200 | +cacheTtlMs: 1_000, |
| 201 | +}); |
| 202 | + |
| 203 | +expect(readiness()).toEqual(failingSnapshot(["gateway-draining"])); |
| 204 | +expect(manager.getRuntimeSnapshot).not.toHaveBeenCalled(); |
| 205 | + |
| 206 | +gatewayDraining = false; |
| 207 | +expect(readiness()).toEqual(readySnapshot()); |
| 208 | +expect(manager.getRuntimeSnapshot).toHaveBeenCalledTimes(1); |
| 209 | +}); |
| 210 | +}); |
| 211 | + |
181 | 212 | it("ignores disabled and unconfigured channels", () => { |
182 | 213 | withReadinessClock(() => { |
183 | 214 | const { readiness } = createReadinessHarness({ |
|