-
Notifications
You must be signed in to change notification settings - Fork 10
feat: refactor client + containers to be testable, and add tests #43
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
Draft
ghostwriternr
wants to merge
40
commits into
main
Choose a base branch
from
init-testing
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 25 commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
a4071d9
Initial testing setup
ghostwriternr ca9fb7b
WIP: Refactor sandbox client
ghostwriternr 6b49aee
Fix expose/unexpose ports
ghostwriternr bf2eac8
Move away from guessable preview URLs
ghostwriternr 5664c2b
Fix process streaming endpoint
ghostwriternr 38d4a34
Improve error handling
ghostwriternr 2b4bb48
Improve exports
ghostwriternr be4b440
Add unit tests for clients
ghostwriternr c0dac99
Add integration tests
ghostwriternr 1e3a6e5
Add container testing with dynamic build ID support
ghostwriternr 2fe9d07
Add e2e tests
ghostwriternr a2c466d
Test request handler
ghostwriternr 8efc363
Add tests into CI
ghostwriternr c255514
Document testing setup
ghostwriternr a231ce4
Make test suite action read-only
ghostwriternr 3be8332
Arbitrary attempt at fixing e2e tests
ghostwriternr b126eca
Revert "Arbitrary attempt at fixing e2e tests"
ghostwriternr 3e30ca3
First pass at refactoring container
ghostwriternr cbae2d4
Improve type safety
ghostwriternr cfb3da8
Fix broken streaming contracts
ghostwriternr 61863ef
Add container integration tests
ghostwriternr 480c5e9
Add docs for working with codebase
ghostwriternr 1c12390
Commit Claude planning files
ghostwriternr 1d66293
Revert "Commit Claude planning files"
ghostwriternr f0bff2e
Test on node 20
ghostwriternr 99417cf
Fix tests
ghostwriternr 1c6eb96
Fix PR action permissions
ghostwriternr 61dd586
Fix type errors and remove integration tests
ghostwriternr f0a6eb5
Complete transition away from integration tests
ghostwriternr 75e024d
Integrate tests with actions
ghostwriternr a90cb78
Build before typecheck
ghostwriternr f04beb4
Format
ghostwriternr 1911385
Fix biome complaints
ghostwriternr 54a359b
Fix broken tests
ghostwriternr 2f48fe5
Fix docs
ghostwriternr 35444a3
Get rid of contract tests for now
ghostwriternr bc88a15
Purge contract tests
ghostwriternr 4c134ce
Move tests around
ghostwriternr 9b23b58
Fix tests
ghostwriternr ae7dda6
Rename post method
ghostwriternr 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 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@cloudflare/sandbox": patch | ||
--- | ||
|
||
comprehensive testing infrastructure and client architecture improvements | ||
|
||
Establishes complete testing suite (476 tests) with unit, integration, container, and e2e coverage. Refactors monolithic HttpClient into domain-specific clients (Command, File, Process, Port, Git, Utility) with enhanced error handling. Fixes critical port access control vulnerability and enhances preview URL security with mandatory tokens. Solves Build ID problem enabling container testing. Maintains 100% backward compatibility. |
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 |
---|---|---|
@@ -0,0 +1,109 @@ | ||
name: Test Suite | ||
permissions: | ||
contents: read | ||
|
||
on: | ||
push: | ||
branches: [main, develop] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [20] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Run type checking | ||
run: npm run typecheck | ||
|
||
- name: Run linting | ||
run: npm run check | ||
|
||
- name: Run unit tests | ||
run: npm run test:unit | ||
|
||
- name: Run integration tests | ||
run: npm run test:integration | ||
|
||
- name: Run container tests | ||
run: npm run test:container | ||
|
||
- name: Run E2E tests | ||
run: npm run test:e2e | ||
|
||
- name: Generate coverage report | ||
run: npm run test:coverage | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
file: ./packages/sandbox/coverage/lcov.info | ||
fail_ci_if_error: true | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
needs: test | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
cache: 'npm' | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Build sandbox package | ||
run: npm run build | ||
working-directory: packages/sandbox | ||
|
||
- name: Build Docker image | ||
run: npm run docker:local | ||
working-directory: packages/sandbox | ||
|
||
example-test: | ||
|
||
runs-on: ubuntu-latest | ||
needs: build | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
cache: 'npm' | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Build sandbox package | ||
run: npm run build | ||
working-directory: packages/sandbox | ||
|
||
- name: Test example application | ||
run: | | ||
npm ci | ||
npm run build | ||
working-directory: examples/basic | ||
|
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.