Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 516
test(cli): stabilize e2e shard one#6313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2 apps/cli/src/legacy/commands/db/diff/diff.declarative.e2e.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2 apps/cli/src/legacy/commands/db/schema/declarative/sync/sync.e2e.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 8 additions & 1 deletion
9 apps/cli/src/legacy/commands/start/start.lifecycle.e2e.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import { spawn } from "node:child_process"; | ||
| import { existsSync, mkdirSync, mkdtempSync, rmSync, symlinkSync } from "node:fs"; | ||
| import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises"; | ||
| import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises"; | ||
| import { createServer } from "node:net"; | ||
| import { homedir, tmpdir } from "node:os"; | ||
| import path from "node:path"; | ||
| @@ -131,6 +131,33 @@ function pickFreePort(): Promise<number> { | ||
| }); | ||
| } | ||
| /** | ||
| * Rewrites every active port assignment in an `init`-generated | ||
| * `supabase/config.toml` with a freshly allocated free port, so stacks started | ||
| * from default configs cannot collide on host ports with other e2e stacks on | ||
| * the same runner. Commented-out port lines are left untouched. | ||
| */ | ||
| export async function overrideStackPorts(projectDir: string) { | ||
| const configPath = path.join(projectDir, "supabase", "config.toml"); | ||
| const config = await readFile(configPath, "utf8"); | ||
| const assigned = new Set<number>(); | ||
| const lines: string[] = []; | ||
| for (const line of config.split("\n")) { | ||
| const match = /^(\s*(?:port|smtp_port|pop3_port|inspector_port|shadow_port) = )\d+$/.exec(line); | ||
| if (match === null) { | ||
| lines.push(line); | ||
| continue; | ||
| } | ||
| let port = await pickFreePort(); | ||
| while (assigned.has(port)) { | ||
| port = await pickFreePort(); | ||
7ttp marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
| assigned.add(port); | ||
| lines.push(`${match[1]}${port}`); | ||
| } | ||
| await writeFile(configPath, lines.join("\n")); | ||
| } | ||
| async function makeTempProject(prefix = "supabase-project-e2e-") { | ||
| const projectDir = await mkdtemp(path.join(tmpdir(), prefix)); | ||
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.