Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(relay): a host restarting onto a deleted tunnel gets a new one #16649

Mergedjuliusmarmingemerged 1 commit intomain fromrefs/pull/16649/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 53 additions and 2 deletions.

x
0 of 2 viewed, 2 left
27 additions and 2 deletionsinfra/relay/src/environments/ManagedEndpointProvider.test.tsModified
View file
@@ -1118,7 +1118,7 @@
}).pipe(Effect.provide(layer));
- it.effect("does no Cloudflare work when the registered origin is unchanged", () => {
+ it.effect("only confirms the tunnel exists when the registered origin is unchanged", () => {
const tunnelCalls: TunnelCall[] = [];
const layer = layerProvider(makePersistentTunnelClient(tunnelCalls));
@@ -1137,7 +1137,31 @@
endpoint: provisioned.endpoint,
).toBe("ready");
- expect(tunnelCalls).toEqual([]);
+ expect(tunnelCalls).toEqual([{ operation: "get", input: "tunnel-id" }]);
+ }).pipe(Effect.provide(layer));
+ });
+​
+ it.effect("asks for recovery when the recorded tunnel was deleted", () => {
+ const tunnelCalls: TunnelCall[] = [];
+ const layer = layerProvider(makePersistentTunnelClient(tunnelCalls));
+​
+ return Effect.gen(function* () {
+ const provider = yield* ManagedEndpointProvider.ManagedEndpointProvider;
+ const key = { userId: "user_ABC", environmentId: "env_ABC" } as const;
+ const origin = { localHttpHost: "127.0.0.1", localHttpPort: 3773 } as const;
+ const provisioned = yield* provider.provision({ ...key, origin });
+ // A shutdown release deletes the tunnel but keeps the recorded id; the
+ // host was killed before it dropped its stored config.