Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions test/smoke/harness/backdoor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Federation } from "@fedify/fedify/federation";
import { Create, Follow, Note, Undo } from "@fedify/vocab";
import { resetFederationTestState } from "./federation.ts";
import { store } from "./store.ts";

function json(data: unknown, status = 200): Response {
Expand Down Expand Up @@ -80,6 +81,7 @@ export async function handleBackdoor(
if (url.pathname === "/_test/reset" && request.method === "POST") {
store.clear();
recipientCache.clear();
await resetFederationTestState();
return json({ ok: true });
}

Expand Down
9 changes: 8 additions & 1 deletion test/smoke/harness/federation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,21 @@ const ORIGIN = Deno.env.get("HARNESS_ORIGIN") ??
"http://fedify-harness:3001";

const rsaKeyPair = await generateCryptoKeyPair("RSASSA-PKCS1-v1_5");
const kv = new MemoryKvStore();

const federation = createFederation<void>({
kv: new MemoryKvStore(),
kv,
origin: ORIGIN,
allowPrivateAddress: true,
skipSignatureVerification: !Deno.env.get("STRICT_MODE"),
});

export async function resetFederationTestState(): Promise<void> {
for await (const entry of kv.list()) {
Comment thread
dahlia marked this conversation as resolved.
Comment thread
dahlia marked this conversation as resolved.
await kv.delete(entry.key);
}
Comment thread
dahlia marked this conversation as resolved.
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Comment thread
dahlia marked this conversation as resolved.

federation
.setActorDispatcher("/users/{identifier}", async (ctx, identifier) => {
if (identifier !== "testuser") return null;
Expand Down
Loading