passive-agent-startup-fixture.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import { mkdirSync } from "node:fs";
  2. import { resolve } from "node:path";
  3. export const PASSIVE_AGENT_STARTUP_WORKSPACE_COUNT = 9;
  4. export const PASSIVE_AGENT_STARTUP_SCENARIO = {
  5. workspaceCount: PASSIVE_AGENT_STARTUP_WORKSPACE_COUNT,
  6. activeWorkspaceIndex: 4,
  7. expectedWarmupWorkspaceIndexes: [4],
  8. explicitWorkspaceIndex: 2,
  9. } as const;
  10. export const SMALL_AGENT_WARMUP_SCENARIO = {
  11. workspaceCount: 2,
  12. activeWorkspaceIndex: 1,
  13. expectedWarmupWorkspaceIndexes: [1],
  14. } as const;
  15. export function getPassiveAgentStartupWorkspacePaths(
  16. e2eHomeDir: string,
  17. workspaceCount = PASSIVE_AGENT_STARTUP_WORKSPACE_COUNT,
  18. ): string[] {
  19. return Array.from({ length: workspaceCount }, (_, index) =>
  20. resolve(e2eHomeDir, `PassiveWorkspace-${String(index + 1).padStart(2, "0")}`),
  21. );
  22. }
  23. export function seedPassiveAgentStartupWorkspaces(
  24. e2eHomeDir: string,
  25. workspaceCount = PASSIVE_AGENT_STARTUP_WORKSPACE_COUNT,
  26. ): string[] {
  27. const workspacePaths = getPassiveAgentStartupWorkspacePaths(e2eHomeDir, workspaceCount);
  28. for (const workspacePath of workspacePaths) {
  29. mkdirSync(workspacePath, { recursive: true });
  30. }
  31. return workspacePaths;
  32. }