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

Setup ephemeral PDS server for testing #53

Open
shuuji3 opened this issue Jan 30, 2025 · 0 comments
Open

Setup ephemeral PDS server for testing #53

shuuji3 opened this issue Jan 30, 2025 · 0 comments
Assignees

Comments

@shuuji3
Copy link
Collaborator

shuuji3 commented Jan 30, 2025

The current setup uses the real accounts (@alice.bsky.social and @bob.bsky.social) for testing. But sometimes it causes the rate limit errors, especially when iterating changes during the local development.

Probably we can take a same setup as atcute's internal dev-env: https://github.com/mary-ext/atcute/blob/trunk/packages/internal/dev-env/lib/pds.ts

Example of the rate limit error message:

> CI=1 pnpm -r test:coverage
Scope: 4 of 5 workspace projects
packages/client test:coverage$ vitest --coverage
packages/client test:coverage:  RUN  v2.1.6 /home/shuuji3/dev/tsky/packages/client
packages/client test:coverage:       Coverage enabled with istanbul
packages/client test:coverage:  ❯ src/bsky/feed/feed.test.ts (1 test | 1 failed) 558ms
packages/client test:coverage:    × feed > .getFeed() 557ms
packages/client test:coverage:      → RateLimitExceeded > Rate Limit Exceeded
packages/client test:coverage:  ✓ src/user/profile.test.ts (3 tests) 1348ms
packages/client test:coverage:    ✓ profile > Getting alice's profile 630ms
packages/client test:coverage:    ✓ profile > Getting bob's profile 483ms
packages/client test:coverage:  ✓ src/user/preferences/preferences.test.ts (2 tests) 2155ms
packages/client test:coverage:    ✓ preferences > .get() 1201ms
packages/client test:coverage:    ✓ preferences > .set() 954ms
packages/client test:coverage: ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
packages/client test:coverage:  FAIL  src/bsky/feed/feed.test.ts > feed > .getFeed()
packages/client test:coverage: XRPCError: RateLimitExceeded > Rate Limit Exceeded
packages/client test:coverage:  ❯ XRPC.request ../../node_modules/.pnpm/@[email protected]/node_modules/@atcute/client/lib/rpc.ts:182:10
packages/client test:coverage:  ❯ CredentialManager.login ../../node_modules/.pnpm/@[email protected]/node_modules/@atcute/client/lib/credential-manager.ts:262:15
packages/client test:coverage:  ❯ Auth.login src/auth/auth.ts:26:3
packages/client test:coverage:      24| 
packages/client test:coverage:      25|     return session;
packages/client test:coverage:      26|   }
packages/client test:coverage:        |   ^
packages/client test:coverage:      27| 
packages/client test:coverage:      28|   async switch(did: string) {
packages/client test:coverage:  ❯ getAliceTsky src/bsky/feed/feed.test.ts:20:3
packages/client test:coverage:  ❯ src/bsky/feed/feed.test.ts:30:18
packages/client test:coverage: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
packages/client test:coverage:  Test Files  1 failed | 2 passed (3)
packages/client test:coverage:       Tests  1 failed | 5 passed (6)
packages/client test:coverage:    Start at  16:27:06
packages/client test:coverage:    Duration  2.70s (transform 275ms, setup 0ms, collect 1.43s, tests 4.06s, environment 0ms, prepare 162ms)
packages/client test:coverage:  % Coverage report from istanbul
packages/client test:coverage: ------------------|---------|----------|---------|---------|-------------------
packages/client test:coverage: File              | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
packages/client test:coverage: ------------------|---------|----------|---------|---------|-------------------
packages/client test:coverage: All files         |   12.77 |    10.63 |   13.46 |   12.84 |                   
packages/client test:coverage:  auth             |   54.54 |       50 |      60 |   54.54 |                   
packages/client test:coverage:   auth.ts         |   54.54 |       50 |      60 |   54.54 | 29-39             
packages/client test:coverage:  bsky             |       0 |      100 |       0 |       0 |                   
packages/client test:coverage:   bsky.ts         |       0 |      100 |       0 |       0 | 7-18              
packages/client test:coverage:  bsky/actor       |   16.66 |        0 |   13.33 |   16.66 |                   
packages/client test:coverage:   actor.ts        |   16.66 |        0 |   13.33 |   16.66 | 33-139            
packages/client test:coverage:  bsky/feed        |       0 |        0 |       0 |       0 |                   
packages/client test:coverage:   feed.ts         |       0 |        0 |       0 |       0 | 11-49             
packages/client test:coverage:   generator.ts    |       0 |        0 |       0 |       0 | 11-73             
packages/client test:coverage:  bsky/list        |       0 |      100 |       0 |       0 |                   
packages/client test:coverage:   list.ts         |       0 |      100 |       0 |       0 | 7-43              
packages/client test:coverage:  bsky/post        |       0 |        0 |       0 |       0 |                   
packages/client test:coverage:   post.ts         |       0 |        0 |       0 |       0 | 13-106            
packages/client test:coverage:  starterpack      |       0 |        0 |       0 |       0 |                   
packages/client test:coverage:   starterpack.ts  |       0 |        0 |       0 |       0 | 10-61             
packages/client test:coverage:  tsky             |   53.33 |       25 |   55.55 |   53.33 |                   
packages/client test:coverage:   client.ts       |      75 |      100 |      75 |      75 | 54                
packages/client test:coverage:   tsky.ts         |   45.45 |       25 |      40 |   45.45 | 25,32-44          
packages/client test:coverage:  user             |    9.09 |        0 |   11.11 |    9.09 |                   
packages/client test:coverage:   index.ts        |    9.09 |        0 |   11.11 |    9.09 | 23-63             
packages/client test:coverage:  user/mute        |       0 |        0 |       0 |       0 |                   
packages/client test:coverage:   mute.ts         |       0 |        0 |       0 |       0 | 5-32              
packages/client test:coverage:  user/muted       |       0 |      100 |       0 |       0 |                   
packages/client test:coverage:   muted.ts        |       0 |      100 |       0 |       0 | 6-38              
packages/client test:coverage:  user/preferences |     100 |      100 |     100 |     100 |                   
packages/client test:coverage:   preferences.ts  |     100 |      100 |     100 |     100 |                   
packages/client test:coverage:  user/suggestion  |       0 |      100 |       0 |       0 |                   
packages/client test:coverage:   suggestion.ts   |       0 |      100 |       0 |       0 | 6-47              
packages/client test:coverage:  user/unmute      |       0 |        0 |       0 |       0 |                   
packages/client test:coverage:   unmute.ts       |       0 |        0 |       0 |       0 | 5-32              
packages/client test:coverage:  utils            |       0 |        0 |       0 |       0 |                   
packages/client test:coverage:   paginator.ts    |       0 |        0 |       0 |       0 | 6-47              
packages/client test:coverage:  video            |       0 |        0 |       0 |       0 |                   
packages/client test:coverage:   video.ts        |       0 |        0 |       0 |       0 | 6-85              
packages/client test:coverage: ------------------|---------|----------|---------|---------|-------------------
packages/client test:coverage: Failed
/home/shuuji3/dev/tsky/packages/client:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  @tsky/[email protected] test:coverage: `vitest --coverage`
Exit status 1
@shuuji3 shuuji3 self-assigned this Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant