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(backend): add federation test #14582

Open
wants to merge 125 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
9cb0727
test(backend): add federation test
zyoshoka Sep 19, 2024
1f5feb8
fix(ci): install pnpm
zyoshoka Sep 19, 2024
0d89ea0
fix(ci): cd
zyoshoka Sep 19, 2024
7a55d9b
fix(ci): build entire project
zyoshoka Sep 19, 2024
2bdf1a5
fix(ci): skip frontend build
zyoshoka Sep 19, 2024
19aed96
fix(ci): pull submodule when checkout
zyoshoka Sep 19, 2024
a930964
chore: show log for debugging
zyoshoka Sep 19, 2024
eff9cd9
Revert "chore: show log for debugging"
zyoshoka Sep 19, 2024
f3759b3
fix(ci): build entire project
zyoshoka Sep 19, 2024
7cfb75d
chore: omit unused globals
zyoshoka Sep 19, 2024
4a41094
Merge branch 'develop' into test-federation
zyoshoka Sep 19, 2024
28af0f3
refactor: use strictEqual and simplify some asserts
zyoshoka Sep 19, 2024
df69190
test: follow requests
zyoshoka Sep 20, 2024
2cee61d
refactor: add resolveRemoteNote function
zyoshoka Sep 20, 2024
d80205e
refactor: refine resolveRemoteUser function
zyoshoka Sep 20, 2024
fdcd929
refactor: cache admin credentials
zyoshoka Sep 20, 2024
ab41c4d
refactor: simplify assertion with excluded fields
zyoshoka Sep 20, 2024
3b38df6
refactor: use assert
zyoshoka Sep 20, 2024
f8a3820
test: note
zyoshoka Sep 20, 2024
72b3fbc
chore: labeler detect federation
zyoshoka Sep 20, 2024
1d0464c
test: blocking
zyoshoka Sep 20, 2024
52adf9d
test: move
zyoshoka Sep 20, 2024
fcc0e2b
fix: use appropriate TLD
zyoshoka Sep 20, 2024
da09a46
chore: shorter purge interval
zyoshoka Sep 20, 2024
2d280f5
fix(ci): change TLD
zyoshoka Sep 20, 2024
33ae401
refactor: delete trivial comment
zyoshoka Sep 20, 2024
bd94f95
Merge branch 'develop' into test-federation
zyoshoka Sep 20, 2024
51bb1af
test(user): isCat
zyoshoka Sep 20, 2024
00941bc
Merge branch 'develop' into test-federation
zyoshoka Sep 22, 2024
c8e416d
chore: use jest
zyoshoka Sep 22, 2024
2ffd677
chore: omit logs
zyoshoka Sep 22, 2024
744544a
chore: add memo
zyoshoka Sep 22, 2024
420b711
fix(ci): omit unnecessary build
zyoshoka Sep 22, 2024
0bcde9a
test: pinning Note
zyoshoka Sep 22, 2024
3f2a2d9
Merge branch 'develop' into test-federation
zyoshoka Sep 22, 2024
6df3b0d
fix: build daemon in container
zyoshoka Sep 22, 2024
4110de5
style: indent
zyoshoka Sep 22, 2024
02e3dd9
test(streaming): timeline
zyoshoka Sep 22, 2024
8bb100e
chore: rename
zyoshoka Sep 22, 2024
1387a91
fix: delete role after test
zyoshoka Sep 22, 2024
acca8b8
refactor: resolve users by uri
zyoshoka Sep 22, 2024
1ef73c7
fix: delete antenna after test
zyoshoka Sep 22, 2024
21b0761
test: api timeline
zyoshoka Sep 22, 2024
407ec36
test: Note deletion
zyoshoka Sep 22, 2024
41ffbd1
refactor: sleep function
zyoshoka Sep 22, 2024
bb23f33
Merge branch 'develop' into test-federation
zyoshoka Sep 22, 2024
2286064
test: notification
zyoshoka Sep 22, 2024
914fb6c
style: indent
zyoshoka Sep 22, 2024
2587458
refactor: type-safe host
zyoshoka Sep 22, 2024
165a761
Merge branch 'develop' into test-federation
zyoshoka Sep 22, 2024
bb8d9d8
docs: update description
zyoshoka Sep 22, 2024
59caa5d
refactor: resolve function params
zyoshoka Sep 22, 2024
62404f8
fix(block): wrong test name
zyoshoka Sep 22, 2024
dba4018
fix: invalid type
zyoshoka Sep 22, 2024
e048752
fix: longer timeout for fire testing
zyoshoka Sep 22, 2024
29ffce2
test(timeline): hashtag
zyoshoka Sep 22, 2024
7420f35
test(note): vote delivery
zyoshoka Sep 22, 2024
bb9d616
Merge branch 'develop' into test-federation
zyoshoka Sep 22, 2024
c33edaa
fix: wrong description
zyoshoka Sep 22, 2024
b4fb748
Merge branch 'develop' into test-federation
zyoshoka Sep 23, 2024
73a3800
fix: hashtag channel param type
zyoshoka Sep 23, 2024
84b4db4
refactor: wrap basic cases
zyoshoka Sep 23, 2024
24b3d16
test(timeline): add homeTimeline tests
zyoshoka Sep 23, 2024
124f8f8
fix(timeline): correct wrong case and description
zyoshoka Sep 23, 2024
c67ac4c
test(notification): add tests for Note
zyoshoka Sep 23, 2024
b948461
refactor(user): wrap profile consistency with describe
zyoshoka Sep 23, 2024
36381ac
chore(note): add issue link
zyoshoka Sep 23, 2024
256f5e5
test(timeline): add test
zyoshoka Sep 23, 2024
66255e2
test(user): suspension
zyoshoka Sep 23, 2024
a41335f
test: emoji
zyoshoka Sep 23, 2024
b672a77
Merge branch 'develop' into test-federation
zyoshoka Sep 23, 2024
30f2c01
refactor: fetch admin first
zyoshoka Sep 23, 2024
540d9da
perf: faster tests
zyoshoka Sep 23, 2024
fdde76f
test(drive): sensitive flag
zyoshoka Sep 23, 2024
38703a7
test(emoji): add tests
zyoshoka Sep 23, 2024
0125197
chore: ignore .config/docker.env
zyoshoka Sep 23, 2024
cb131d3
chore: hard-coded tester IP address
zyoshoka Sep 23, 2024
8c6df97
test(emoji): custom emoji are surrounded by zero width space
zyoshoka Sep 23, 2024
03ad31e
refactor: client and username as property
zyoshoka Sep 24, 2024
da3e5fc
Merge branch 'develop' into test-federation
zyoshoka Sep 24, 2024
a74ce99
test(notification): mute
zyoshoka Sep 24, 2024
eb4af53
fix(notification): correct description
zyoshoka Sep 24, 2024
03a9998
test(block): mention
zyoshoka Sep 24, 2024
28264be
refactor(emoji): addCustomEmoji function
zyoshoka Sep 24, 2024
c5936a2
fix: typo
zyoshoka Sep 24, 2024
4b30001
test(note): add reaction tests
zyoshoka Sep 24, 2024
5c99def
test(timeline): Note deletion
zyoshoka Sep 25, 2024
84d400a
Merge branch 'develop' into test-federation
zyoshoka Sep 25, 2024
76d6404
fix: unnecessary ts-expect-error
zyoshoka Sep 25, 2024
b8d5c83
refactor: unnecessary fetch mocking
zyoshoka Sep 25, 2024
3734cf9
chore: add TODO comments
zyoshoka Sep 25, 2024
28cbc78
test(user): deletion
zyoshoka Sep 25, 2024
02627ba
chore: enable --frozen-lockfile
zyoshoka Sep 25, 2024
1e03b84
fix(ci): copying configs
zyoshoka Sep 25, 2024
16e51c4
docs: update CONTRIBUTING.md
zyoshoka Sep 25, 2024
e942d5f
docs: fix typo
zyoshoka Sep 25, 2024
ba69e07
chore: set default sleep duration
zyoshoka Sep 25, 2024
2b88661
fix(notification): omit flaky tests
zyoshoka Sep 25, 2024
cfa764d
fix(notification): correct type
zyoshoka Sep 25, 2024
373401e
test(notification): add api endpoint tests
zyoshoka Sep 25, 2024
fb09f4e
chore: remove redundant mute test
zyoshoka Sep 25, 2024
9c2d6b2
refactor: use param client
zyoshoka Sep 25, 2024
72c9e09
fix: start timer after trigger
zyoshoka Sep 25, 2024
ad5a4fa
refactor: remove unnecessary any
zyoshoka Sep 25, 2024
aa67eb1
chore: shorter timeout for checking if fired
zyoshoka Sep 25, 2024
da53aa6
fix(block): remove outdated comment
zyoshoka Sep 26, 2024
ca5e403
refactor: shorten remote user variable name
zyoshoka Sep 26, 2024
18095f8
refactor(block): use existing function
zyoshoka Sep 26, 2024
b320e5c
Merge branch 'develop' into test-federation
zyoshoka Sep 26, 2024
43a2000
refactor: file upload
zyoshoka Sep 26, 2024
1a51139
docs: update description
zyoshoka Oct 3, 2024
31b61ec
Merge branch 'develop' into test-federation
zyoshoka Oct 3, 2024
93eee7f
test(user): ffVisibility
zyoshoka Oct 3, 2024
ccc76ae
Merge branch 'develop' into test-federation
zyoshoka Oct 5, 2024
f38b23e
fix: `/api/signin` -> `/api/signin-flow`
zyoshoka Oct 5, 2024
e9b4a15
Merge branch 'develop' into test-federation
zyoshoka Oct 5, 2024
7085fd7
test: abuse report
zyoshoka Oct 5, 2024
c82ba39
refactor: use existing type
zyoshoka Oct 5, 2024
1afad9e
refactor: extract duplicate configs to template file
zyoshoka Oct 6, 2024
7983767
fix: typo
zyoshoka Oct 6, 2024
34bc144
Merge branch 'develop' into test-federation
zyoshoka Oct 6, 2024
717cb10
fix: avoid conflict
zyoshoka Oct 6, 2024
90cab5b
refactor: change container dependency
zyoshoka Oct 6, 2024
2e845de
perf: start misskey parallelly
zyoshoka Oct 6, 2024
a31d483
fix: remove dependency
zyoshoka Oct 6, 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
61 changes: 61 additions & 0 deletions .github/workflows/test-federation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Test (federation)

on:
push:
branches:
- master
- develop
paths:
- packages/backend/**
- packages/misskey-js/**
- .github/workflows/test-federation.yml
pull_request:
paths:
- packages/backend/**
- packages/misskey-js/**
- .github/workflows/test-federation.yml

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.16.0]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install FFmpeg
uses: FedericoCarboni/setup-ffmpeg@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4.0.3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Build Misskey
run: |
corepack enable && corepack prepare
pnpm i --frozen-lockfile
pnpm build
pnpm -F backend build:fed
- name: Setup
run: |
cd packages/backend/test-federation
cp ./.env.example ./.env
bash ./generate_certificates.sh
sudo chmod 644 ./certificates/*.local.key
- name: Start servers
# https://github.com/docker/compose/issues/1294#issuecomment-374847206
run: |
cd packages/backend/test-federation
docker compose up -d --scale tester=0
- name: Test
run: |
cd packages/backend/test-federation
docker compose run tester
- name: Stop servers
run: |
cd packages/backend/test-federation
docker compose down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ coverage
!/.config/docker_example.env
!/.config/cypress-devcontainer.yml
docker-compose.yml
compose.yml
./compose.yml
.devcontainer/compose.yml
!/.devcontainer/compose.yml

Expand Down
1 change: 1 addition & 0 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"build:test": "swc test-server -d built-test -D --config-file test-server/.swcrc --strip-leading-paths",
"watch:swc": "swc src -d built -D -w --strip-leading-paths",
"build:tsc": "tsc -p tsconfig.json && tsc-alias -p tsconfig.json",
"build:fed": "cd test-federation && tsc -p tsconfig.json",
"watch": "node ./scripts/watch.mjs",
"restart": "pnpm build && pnpm start",
"dev": "node ./scripts/dev.mjs",
Expand Down
70 changes: 70 additions & 0 deletions packages/backend/test-federation/.config/a.local.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# based on https://github.com/misskey-dev/misskey-hub/blob/7071f63a1c80ee35c71f0fd8a6d8722c118c7574/src/docs/admin/nginx.md
zyoshoka marked this conversation as resolved.
Show resolved Hide resolved

# For WebSocket
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

proxy_cache_path /tmp/nginx_cache levels=1:2 keys_zone=cache1:16m max_size=1g inactive=720m use_temp_path=off;

server {
listen 80;
listen [::]:80;
server_name a.local;

# For SSL domain validation
root /var/www/html;
location /.well-known/acme-challenge/ { allow all; }
location /.well-known/pki-validation/ { allow all; }
location / { return 301 https://$server_name$request_uri; }
}

server {
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
server_name a.local;

ssl_session_timeout 1d;
ssl_session_cache shared:ssl_session_cache:10m;
ssl_session_tickets off;

ssl_trusted_certificate /etc/nginx/certificates/rootCA.crt;
ssl_certificate /etc/nginx/certificates/$server_name.crt;
ssl_certificate_key /etc/nginx/certificates/$server_name.key;

# SSL protocol settings
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;
ssl_stapling on;
ssl_stapling_verify on;

# Change to your upload limit
client_max_body_size 80m;

# Proxy to Node
location / {
proxy_pass http://misskey.a.local:3000;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_redirect off;

# If it's behind another reverse proxy or CDN, remove the following.
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;

# For WebSocket
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;

# Cache settings
proxy_cache cache1;
proxy_cache_lock on;
proxy_cache_use_stale updating;
proxy_force_ranges on;
add_header X-Cache $upstream_cache_status;
}
}
70 changes: 70 additions & 0 deletions packages/backend/test-federation/.config/b.local.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# based on https://github.com/misskey-dev/misskey-hub/blob/7071f63a1c80ee35c71f0fd8a6d8722c118c7574/src/docs/admin/nginx.md

# For WebSocket
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

proxy_cache_path /tmp/nginx_cache levels=1:2 keys_zone=cache1:16m max_size=1g inactive=720m use_temp_path=off;

server {
listen 80;
listen [::]:80;
server_name b.local;

# For SSL domain validation
root /var/www/html;
location /.well-known/acme-challenge/ { allow all; }
location /.well-known/pki-validation/ { allow all; }
location / { return 301 https://$server_name$request_uri; }
}

server {
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
server_name b.local;

ssl_session_timeout 1d;
ssl_session_cache shared:ssl_session_cache:10m;
ssl_session_tickets off;

ssl_trusted_certificate /etc/nginx/certificates/rootCA.crt;
ssl_certificate /etc/nginx/certificates/$server_name.crt;
ssl_certificate_key /etc/nginx/certificates/$server_name.key;

# SSL protocol settings
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;
ssl_stapling on;
ssl_stapling_verify on;

# Change to your upload limit
client_max_body_size 80m;

# Proxy to Node
location / {
proxy_pass http://misskey.b.local:3000;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_redirect off;

# If it's behind another reverse proxy or CDN, remove the following.
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;

# For WebSocket
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;

# Cache settings
proxy_cache cache1;
proxy_cache_lock on;
proxy_cache_use_stale updating;
proxy_force_ranges on;
add_header X-Cache $upstream_cache_status;
}
}
25 changes: 25 additions & 0 deletions packages/backend/test-federation/.config/default.a.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
url: https://a.local/
port: 3000
db:
host: db.a.local
port: 5432
db: misskey
user: postgres
pass: postgres
dbReplications: false
redis:
host: redis.local
port: 6379
id: 'aidx'
proxyBypassHosts:
- api.deepl.com
- api-free.deepl.com
- www.recaptcha.net
- hcaptcha.com
- challenges.cloudflare.com
proxyRemoteFiles: true
signToActivityPubGet: true
allowedPrivateNetworks: [
'127.0.0.1/32',
'172.20.0.0/16'
]
25 changes: 25 additions & 0 deletions packages/backend/test-federation/.config/default.b.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
url: https://b.local/
port: 3000
db:
host: db.b.local
port: 5432
db: misskey
user: postgres
pass: postgres
dbReplications: false
redis:
host: redis.local
port: 6379
id: 'aidx'
proxyBypassHosts:
- api.deepl.com
- api-free.deepl.com
- www.recaptcha.net
- hcaptcha.com
- challenges.cloudflare.com
proxyRemoteFiles: true
signToActivityPubGet: true
allowedPrivateNetworks: [
'127.0.0.1/32',
'172.20.0.0/16'
]
4 changes: 4 additions & 0 deletions packages/backend/test-federation/.config/docker.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
NODE_EXTRA_CA_CERTS=/usr/local/share/ca-certificates/rootCA.crt
POSTGRES_DB=misskey
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
1 change: 1 addition & 0 deletions packages/backend/test-federation/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TESTER_IP_ADDRESS=172.20.1.1
3 changes: 3 additions & 0 deletions packages/backend/test-federation/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
certificates
volumes
.env
7 changes: 7 additions & 0 deletions packages/backend/test-federation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Execute following commands:
```sh
cp ./.env.example ./.env
bash ./generate_certificates.sh
pnpm build:fed
docker compose up
```
Loading
Loading