-
Notifications
You must be signed in to change notification settings - Fork 124
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
update local testing workflow to allow for parallelism, improved dx #3707
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c1697b9
update local testing workflow to allow for parallelism, improved dx
briangregoryholmes f56c748
update comment
briangregoryholmes 16e3523
remove extraneous comment
briangregoryholmes 56dfa5e
move file/directory removal to before process exit
briangregoryholmes 6f9e681
Merge branch 'main' into dx-local-testing
briangregoryholmes 9a3ac5a
prettier
briangregoryholmes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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 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 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 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
5 changes: 2 additions & 3 deletions
5
web-local/tests/dashboards/dimension-and-measure-selection.spec.ts
This file contains 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 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 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 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 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 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 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { createServer } from "net"; | ||
|
||
export async function getOpenPort(): Promise<number> { | ||
return new Promise((res) => { | ||
const srv = createServer(); | ||
srv.listen(0, () => { | ||
const address = srv?.address(); | ||
if (!address || typeof address === "string") { | ||
throw new Error("Invalid address"); | ||
} | ||
srv.close(() => res(address.port)); | ||
}); | ||
}); | ||
} |
This file contains 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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { test as base } from "@playwright/test"; | ||
import { rmSync, writeFileSync, existsSync, mkdirSync } from "fs"; | ||
import { spawn } from "node:child_process"; | ||
import treeKill from "tree-kill"; | ||
import { getOpenPort } from "./getOpenPort"; | ||
import { asyncWaitUntil } from "@rilldata/web-common/lib/waitUtils"; | ||
import axios from "axios"; | ||
|
||
const BASE_PROJECT_DIRECTORY = "temp/test-project"; | ||
|
||
export const test = base.extend({ | ||
page: async ({ page }, use) => { | ||
const TEST_PORT = await getOpenPort(); | ||
const TEST_PORT_GRPC = await getOpenPort(); | ||
const TEST_PROJECT_DIRECTORY = `${BASE_PROJECT_DIRECTORY}-${TEST_PORT}`; | ||
|
||
rmSync(TEST_PROJECT_DIRECTORY, { | ||
force: true, | ||
recursive: true, | ||
}); | ||
|
||
if (!existsSync(TEST_PROJECT_DIRECTORY)) { | ||
mkdirSync(TEST_PROJECT_DIRECTORY, { recursive: true }); | ||
} | ||
|
||
// Add `rill.yaml` file to the project repo | ||
writeFileSync( | ||
`${TEST_PROJECT_DIRECTORY}/rill.yaml`, | ||
'compiler: rill-beta\ntitle: "Test Project"', | ||
); | ||
|
||
const cmd = `start --no-open --port ${TEST_PORT} --port-grpc ${TEST_PORT_GRPC} --db ${TEST_PROJECT_DIRECTORY}/stage.db?rill_pool_size=4 ${TEST_PROJECT_DIRECTORY}`; | ||
|
||
const childProcess = spawn("../rill", cmd.split(" "), { | ||
stdio: "inherit", | ||
shell: true, | ||
}); | ||
|
||
childProcess.on("error", console.log); | ||
|
||
// Ping runtime until it's ready | ||
await asyncWaitUntil(async () => { | ||
try { | ||
const response = await axios.get( | ||
`http://localhost:${TEST_PORT}/v1/ping`, | ||
); | ||
return response.status === 200; | ||
} catch (err) { | ||
return false; | ||
} | ||
}); | ||
|
||
await page.goto(`http://localhost:${TEST_PORT}`); | ||
|
||
await use(page); | ||
|
||
rmSync(TEST_PROJECT_DIRECTORY, { | ||
force: true, | ||
recursive: true, | ||
}); | ||
|
||
const processExit = new Promise((resolve) => { | ||
childProcess.on("exit", resolve); | ||
}); | ||
|
||
if (childProcess.pid) treeKill(childProcess.pid); | ||
|
||
await processExit; | ||
}, | ||
}); |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
qq: typo at single "&" at
web-common & npm run test
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intention is to run
npm run test -w web-common
,npm run test -w web-auth
andmake cli
concurrently (separated by a single &) since they aren't dependent on each other. After that completes,npm run test -w web-local
will run.The two unit tests are pretty fast, but I just want to start
make cli
as soon as possible since it takes the longest.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gotcha, makes sense, great idea!