Skip to content
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

test: server end-to-end #886

Merged
merged 133 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
51ef5d1
Initial server implementation
gmaclennan Oct 1, 2024
76387c9
WIP
gmaclennan Oct 1, 2024
1e568af
fix: use identity keypair for replication
gmaclennan Oct 1, 2024
88fd5b1
server: set device info on initialization
gmaclennan Oct 1, 2024
f997101
chore: move #identityKeypair member higher up
EvanHahn Oct 1, 2024
d272664
chore: remove unused server script (#876)
EvanHahn Oct 1, 2024
72f3190
chore: use `await` instead of `then` in server route (#878)
EvanHahn Oct 1, 2024
e0b4d4a
chore: remove commented-out `PeerSyncController` lines (#877)
EvanHahn Oct 1, 2024
ab49173
chore: remove console.logs from server code (#879)
EvanHahn Oct 1, 2024
e0ec6b8
Add GET /deviceinfo endpoint
EvanHahn Oct 1, 2024
c6629d2
chore: move response body data to a `data` key
EvanHahn Oct 1, 2024
f6f97f5
make createTestServer helper do more
gmaclennan Oct 2, 2024
d6128b0
use @fastify/sensible and more precise errors
gmaclennan Oct 2, 2024
d1dcc85
Test that doesn't work for some reason
gmaclennan Oct 2, 2024
59560b0
fix test
gmaclennan Oct 2, 2024
f018cf7
server integration tests
gmaclennan Oct 2, 2024
77b73be
Change `host` to `baseUrl`, save server URL to members
gmaclennan Oct 2, 2024
55f90d6
WIP: connectServers and disconnectServers()
gmaclennan Oct 2, 2024
a9dad88
Fix debugging event (still broken, but better debugging)
EvanHahn Oct 2, 2024
e3cec3d
Revert sync changes
EvanHahn Oct 3, 2024
7f74297
Sync test passing
EvanHahn Oct 3, 2024
400e305
Remove a useless delay
EvanHahn Oct 3, 2024
54823a8
Some server test cleanup
EvanHahn Oct 3, 2024
efdbee0
More server test cleanup
EvanHahn Oct 3, 2024
e9d5933
Remove a debugging console.log
EvanHahn Oct 3, 2024
6442c37
Clean up server integration tests
EvanHahn Oct 3, 2024
154a9f2
Skeleton GET /observations endpoint
EvanHahn Oct 3, 2024
9d67113
Returning observations without attachments
EvanHahn Oct 3, 2024
04c6e74
Merge branch 'main' into server
EvanHahn Oct 7, 2024
87934f6
Remove workaround for now-fixed bug
EvanHahn Oct 7, 2024
b82a69a
Minor: fix typo in comment
EvanHahn Oct 7, 2024
42999c5
Fix disconnect bug
EvanHahn Oct 7, 2024
2f2eea0
Remove .only from server integration test
EvanHahn Oct 7, 2024
07b6520
Fix test type error
EvanHahn Oct 7, 2024
981cb6e
GET /observations should authenticate
EvanHahn Oct 7, 2024
1f033a8
feat: add server.js script (#892)
gmaclennan Oct 7, 2024
4abd002
Fix type error when starting server
EvanHahn Oct 7, 2024
aef5186
GET /observations should return fetchable attachments
EvanHahn Oct 7, 2024
e72f342
Quiet type errors
EvanHahn Oct 7, 2024
75be09c
feat: use req.hostname instead of manually configured server host (#893)
gmaclennan Oct 8, 2024
c5c4a35
Add Dockerfile and fly.io deployment instructions and config (#894)
gmaclennan Oct 8, 2024
5d0a0aa
Remove old environment variable
EvanHahn Oct 8, 2024
4a275d8
Start sync when opening sync websocket
EvanHahn Oct 8, 2024
350eb8a
GET /projects to list projects
EvanHahn Oct 8, 2024
e47b743
chore: add CI workflow for server e2e tests (#895)
gmaclennan Oct 8, 2024
d6dbf2b
fix: avoid uncaught websocket errors (#897)
gmaclennan Oct 9, 2024
4fd5039
GET /projects should return project name
EvanHahn Oct 9, 2024
619894b
Remove an already-addressed TODO
EvanHahn Oct 9, 2024
df60da6
Proxy all headers through with attachments endpoint
EvanHahn Oct 9, 2024
d4a3999
Merge branch 'main' into server
EvanHahn Oct 9, 2024
22e1975
Merge branch 'main' into server
EvanHahn Oct 9, 2024
ac18cef
Add `deleted` field to GET /observations
EvanHahn Oct 9, 2024
be6dfe7
Add response schema for GET /observations
EvanHahn Oct 9, 2024
7f4f129
GET /observations should include tags
EvanHahn Oct 9, 2024
6d0a947
Remove/move some TODOs
EvanHahn Oct 9, 2024
7cc3a1f
Clean up project public key in MapeoProject
EvanHahn Oct 9, 2024
bb74456
Split addServerPeer into smaller methods
EvanHahn Oct 9, 2024
7449eb5
Wait for initial sync with server, not all peers
EvanHahn Oct 9, 2024
9aaeb37
waitForSyncWithServer shouldn't just wait
EvanHahn Oct 9, 2024
9135128
Improve validation of server base URLs
EvanHahn Oct 9, 2024
257b991
Move some members higher up in SyncApi
EvanHahn Oct 9, 2024
4d34392
Fix broken test
EvanHahn Oct 9, 2024
bee1ca4
Merge branch 'main' into server
EvanHahn Oct 16, 2024
1642109
test: server integration tests should use dynamic port
EvanHahn Oct 16, 2024
3b0a8e0
Move server integration tests into a separate server test folder
EvanHahn Oct 17, 2024
ad681f4
test: move GET /info test to separate file
EvanHahn Oct 17, 2024
10fb67b
test: move allowedhosts tests to separate file
EvanHahn Oct 17, 2024
7b443a8
test: move GET /projects tests to separate file
EvanHahn Oct 17, 2024
1b6e2ea
test: move POST /projects test to separate file
EvanHahn Oct 17, 2024
d2624f3
test: Move GET /observations to its own test file
EvanHahn Oct 17, 2024
d21ea62
test: rename remaining server integration tests
EvanHahn Oct 17, 2024
1920bce
Cleanups to sync endpoint tests
EvanHahn Oct 17, 2024
32e403c
WIP: additional tests for POST /proejcts
EvanHahn Oct 17, 2024
74fd08a
Clean up some add project endpoint tests
EvanHahn Oct 17, 2024
f6b65a3
fix: suspend rather than stop fly machines
gmaclennan Oct 21, 2024
bf8cec0
Merge branch 'main' into server
EvanHahn Oct 21, 2024
9aa74f3
Require server base URL to be relative to root path
EvanHahn Oct 21, 2024
44612cc
Test if server returns a non-200
EvanHahn Oct 21, 2024
4c41246
Remove a TODO
EvanHahn Oct 21, 2024
bb1d236
Also allow server to return 201
EvanHahn Oct 21, 2024
5e8df03
Test server returning bad data
EvanHahn Oct 21, 2024
297983d
Fix server test concurrency
EvanHahn Oct 21, 2024
f106f07
Fail if we can't connect to the server
EvanHahn Oct 21, 2024
d5380b6
Use a port guaranteed to be open
EvanHahn Oct 21, 2024
654ceb2
Remove a TODO from server test
EvanHahn Oct 21, 2024
33640d1
Handle bad server /sync endpoint
EvanHahn Oct 21, 2024
2661bea
Only include photo attachments in GET /observations endpoint
EvanHahn Oct 21, 2024
719df6b
Move server tests to src/server/test/
EvanHahn Oct 21, 2024
1bb9c06
Merge branch 'main' into server
EvanHahn Oct 21, 2024
c511a60
Basic server root
EvanHahn Oct 21, 2024
ae24889
Return some error codes when adding peers
EvanHahn Oct 21, 2024
fc1ad52
Add some failure codes when adding a server
EvanHahn Oct 21, 2024
1c025a1
test: use helper for finding server peer
EvanHahn Oct 21, 2024
b9dd1c0
Skeleton removal of server peer
EvanHahn Oct 21, 2024
4ce93ef
Merge branch 'main' into server
EvanHahn Oct 22, 2024
749c467
WIP
EvanHahn Oct 17, 2024
503b17e
Use 409, not 403, for duplicates
EvanHahn Oct 22, 2024
9192404
Adding projects multiple times is idempotent
EvanHahn Oct 22, 2024
9625729
Add a comment
EvanHahn Oct 22, 2024
9423285
Add another comment
EvanHahn Oct 22, 2024
cb8ebd3
feat: convert server to fastify plugin (#919)
gmaclennan Oct 23, 2024
a9cfff6
Merge branch 'main' into server
EvanHahn Oct 23, 2024
d1db84c
More work on removing server peers
EvanHahn Oct 23, 2024
9b0d820
Minor: reorder two methods
EvanHahn Oct 23, 2024
cf02e69
Merge branch 'main' into server
EvanHahn Oct 23, 2024
43f07ec
Remove unnecessary server close
EvanHahn Oct 23, 2024
a2ca81e
test: remove unnecessary `await`
EvanHahn Oct 23, 2024
23b7962
Remove unused test file
EvanHahn Oct 23, 2024
883d14b
Remove removeServerPeer
EvanHahn Oct 23, 2024
4827194
Server: PUT /projects, not POST /projects (#938)
EvanHahn Oct 24, 2024
4f47a29
Use string-timing-safe-equal in server code
EvanHahn Oct 24, 2024
47cce87
Install @comapeo/schema 1.2.0
EvanHahn Oct 24, 2024
f47d9f0
Use string-timing-safe-equal in member API code
EvanHahn Oct 24, 2024
02aedad
Merge branch 'main' into server
EvanHahn Oct 24, 2024
4482f59
Fix CI: we now use the real schema package
EvanHahn Oct 24, 2024
4f834c3
Merge branch 'main' into server
EvanHahn Oct 28, 2024
50be333
Remove some `any`s from server code
EvanHahn Oct 28, 2024
1c4f1ed
add reference to issue 25
EvanHahn Oct 28, 2024
50a5271
Send project name to server when adding it
EvanHahn Oct 29, 2024
b95e24c
More tests bad requests to `PUT /projects`
EvanHahn Oct 29, 2024
3f5d607
Handle quick connect/disconnects to server
EvanHahn Oct 29, 2024
966da94
Remove removeServerPeer skeleton test
EvanHahn Oct 29, 2024
0223710
reference a TODO
EvanHahn Oct 29, 2024
97e0902
test: stop using getManagerOptions
EvanHahn Oct 29, 2024
354a0a8
Remove getManagerOptions
EvanHahn Oct 29, 2024
4a82f22
Merge branch 'main' into server
EvanHahn Oct 30, 2024
b3b749b
Merge branch 'main' into server
EvanHahn Oct 30, 2024
3d8bd40
Merge branch 'main' into server
EvanHahn Oct 30, 2024
6d18bf6
src/server should use more realistic imports from core
EvanHahn Oct 30, 2024
92c84c7
Use more realistic imports of server code from core
EvanHahn Oct 30, 2024
5fa6192
Clean up a few small things
EvanHahn Oct 31, 2024
a0b310f
Use @comapeo/server
EvanHahn Oct 31, 2024
b25fee7
Merge branch 'main' into server
EvanHahn Oct 31, 2024
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
30 changes: 30 additions & 0 deletions .github/workflows/fly-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Cleans up orphaned test apps on Fly

# TODO: check app creation date - could destroy an app during a test run
# See <https://github.com/digidem/comapeo-core/issues/914>.

name: Fly Cleanup
on:
workflow_dispatch:
schedule:
- cron: '0 5 * * *' # Every day at 5am UTC
jobs:
cleanup:
name: Cleanup Orphaned Apps
runs-on: ubuntu-latest
concurrency: deploy-group # optional: ensure only one action runs at a time
steps:
- uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
- env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
run: |
fly apps list -q -o digidem | while IFS= read -r name; do
# Trim leading and trailing whitespace from $name
name=$(echo "$name" | xargs)
# Check if the name starts with 'comapeo-cloud-test-'
if [[ $name == comapeo-cloud-test-* ]]; then
# Call the fly destroy command with the name
fly apps destroy -y "$name"
fi
done
26 changes: 26 additions & 0 deletions .github/workflows/server-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Server e2e cloud test

on:
push:
branches: [main]
pull_request:

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: npm ci
- run: npm run build --if-present
- run: node --test ./test-e2e/server.js
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
REMOTE_TEST_SERVER: true
Loading
Loading