From a9ec00af973e1e4ddf8d2addfe54c064971c3f41 Mon Sep 17 00:00:00 2001 From: mikoto Date: Wed, 14 Feb 2024 18:37:01 +0000 Subject: [PATCH 01/15] chore: disable rate limiting in the correct homeserver configuration --- crates/test/fixtures/synapse/homeserver.yaml | 39 +++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/crates/test/fixtures/synapse/homeserver.yaml b/crates/test/fixtures/synapse/homeserver.yaml index 432d21e..17fc85f 100644 --- a/crates/test/fixtures/synapse/homeserver.yaml +++ b/crates/test/fixtures/synapse/homeserver.yaml @@ -34,5 +34,40 @@ signing_key_path: "/data/matrix.localhost.signing.key" trusted_key_servers: - server_name: "matrix.org" - -# vim:ft=yaml \ No newline at end of file +rc_message: + per_second: 1000 + burst_count: 1000 +rc_registration: + per_second: 1000 + burst_count: 1000 +rc_login: + address: + per_second: 1000 + burst_count: 1000 + account: + per_second: 1000 + burst_count: 1000 + failed_attempts: + per_second: 1000 + burst_count: 1000 +rc_admin_redaction: + per_second: 1000 + burst_count: 1000 +rc_joins: + local: + per_second: 1000 + burst_count: 1000 + remote: + per_second: 1000 + burst_count: 1000 +rc_3pid_validation: + per_second: 1000 + burst_count: 1000 +rc_invites: + per_room: + per_second: 1000 + burst_count: 1000 + per_user: + per_second: 1000 + burst_count: 1000 +# vim:ft=yaml From 58ba758ce53abb4c40be31691a4b2cbec54d1723 Mon Sep 17 00:00:00 2001 From: mikoto Date: Wed, 14 Feb 2024 18:50:48 +0000 Subject: [PATCH 02/15] sigh ... --- docker/synapse/media_store/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 docker/synapse/media_store/.gitkeep diff --git a/docker/synapse/media_store/.gitkeep b/docker/synapse/media_store/.gitkeep new file mode 100644 index 0000000..e69de29 From 21d169d246669c9b33b5a8739d6d76a33a52ef33 Mon Sep 17 00:00:00 2001 From: mikoto Date: Wed, 14 Feb 2024 19:51:11 +0000 Subject: [PATCH 03/15] hopefully making life easier for future contributors --- .github/workflows/ci.yml | 11 ++--- CONTRIBUTING.md | 20 -------- crates/test/fixtures/synapse/homeserver.yaml | 13 +++++- .../synapse/matrix.localhost.log.config | 30 ++++++------ crates/test/src/matrix/events.rs | 39 ++++++++++++++++ docker/.gitkeep | 0 docker/synapse/.gitkeep | 0 docker/synapse/media_store/.gitkeep | 0 fixtures/synapse/homeserver.yaml | 46 ------------------- fixtures/synapse/matrix.localhost.log.config | 39 ---------------- fixtures/synapse/matrix.localhost.signing.key | 1 - 11 files changed, 66 insertions(+), 133 deletions(-) create mode 100644 crates/test/src/matrix/events.rs delete mode 100644 docker/.gitkeep delete mode 100644 docker/synapse/.gitkeep delete mode 100644 docker/synapse/media_store/.gitkeep delete mode 100644 fixtures/synapse/homeserver.yaml delete mode 100644 fixtures/synapse/matrix.localhost.log.config delete mode 100644 fixtures/synapse/matrix.localhost.signing.key diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 398b910..d563665 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,13 +49,10 @@ jobs: - name: Create a copy of `.env.example` run: just dotenv - - name: Generate Synapse Configuration - run: | - just gen_synapse_conf - - name: Use Test Homeserver run: | - sudo cp -f ./crates/test/fixtures/synapse/homeserver.yaml ./docker/synapse/homeserver.yaml + mkdir -p ./docker/synapse/media_stroe + cp -f ./crates/test/fixtures/synapse/* ./docker/synapse/homeserver.yaml - name: Run Docker Containers run: | @@ -77,14 +74,12 @@ jobs: - name: Retrieve Admin Access Token run: | just get_access_token - export COMMUNE_SYNAPSE_ADMIN_TOKEN=$(cat ./access_token.txt) - echo "COMMUNE_SYNAPSE_ADMIN_TOKEN=${COMMUNE_SYNAPSE_ADMIN_TOKEN}" >> $GITHUB_ENV - name: E2E Tests env: COMMUNE_SYNAPSE_ADMIN_TOKEN: ${{ env.COMMUNE_SYNAPSE_ADMIN_TOKEN }} run: | - cargo test -p test -- --test-threads=1 + just e2e -- --show-output - name: Print Logs if: always() diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0b18fa0..c9657b1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -63,26 +63,6 @@ You must run Docker services as for development. In order to avoid messing up the development environment, its recommended to use the synapse setup from `crates/test/fixtures/synapse` replacing it with `docker/synapse`. -The only difference should be the `database` section, which uses SQLite instead. - -```diff -database: -+ name: psycopg2 -+ args: -+ database: /data/homeserver.db -- name: psycopg2 -- txn_limit: 10000 -- allow_unsafe_locale: true -- args: -- user: synapse_user -- password: secretpassword -- database: synapse -- host: localhost -- port: 5432 -- cp_min: 5 -- cp_max: 10 -``` - > Make sure the `.env` file is created from the contents on `.env.example` ### Application Layout diff --git a/crates/test/fixtures/synapse/homeserver.yaml b/crates/test/fixtures/synapse/homeserver.yaml index 17fc85f..11fe33b 100644 --- a/crates/test/fixtures/synapse/homeserver.yaml +++ b/crates/test/fixtures/synapse/homeserver.yaml @@ -21,9 +21,17 @@ listeners: - names: [client, federation] compress: false database: - name: sqlite3 + name: psycopg2 + txn_limit: 10000 + allow_unsafe_locale: true args: - database: /data/homeserver.db + user: synapse_user + password: secretpassword + database: synapse + host: localhost + port: 5432 + cp_min: 5 + cp_max: 10 log_config: "/data/matrix.localhost.log.config" media_store_path: /data/media_store registration_shared_secret: "m@;wYOUOh0f:CH5XA65sJB1^q01~DmIriOysRImot,OR_vzN&B" @@ -70,4 +78,5 @@ rc_invites: per_user: per_second: 1000 burst_count: 1000 + # vim:ft=yaml diff --git a/crates/test/fixtures/synapse/matrix.localhost.log.config b/crates/test/fixtures/synapse/matrix.localhost.log.config index 832f0fa..1fda721 100644 --- a/crates/test/fixtures/synapse/matrix.localhost.log.config +++ b/crates/test/fixtures/synapse/matrix.localhost.log.config @@ -2,38 +2,34 @@ version: 1 formatters: precise: - format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s' - handlers: - + file: + class: logging.handlers.TimedRotatingFileHandler + formatter: precise + filename: /data/homeserver.log + when: midnight + backupCount: 3 + encoding: utf8 + + buffer: + class: synapse.logging.handlers.PeriodicallyFlushingMemoryHandler + target: file + capacity: 10 console: class: logging.StreamHandler formatter: precise loggers: - # This is just here so we can leave `loggers` in the config regardless of whether - # we configure other loggers below (avoid empty yaml dict error). - _placeholder: - level: "INFO" - - - synapse.storage.SQL: # beware: increasing this to DEBUG will make synapse log sensitive # information such as access tokens. level: INFO - - - - root: level: INFO - - handlers: [console] -disable_existing_loggers: false \ No newline at end of file +disable_existing_loggers: false diff --git a/crates/test/src/matrix/events.rs b/crates/test/src/matrix/events.rs new file mode 100644 index 0000000..433ecda --- /dev/null +++ b/crates/test/src/matrix/events.rs @@ -0,0 +1,39 @@ +#[cfg(test)] +mod tests { + use std::sync::Once; + + use matrix::{ + admin::resources::room::{MessagesQuery, OrderBy}, + ruma_common::{RoomId, ServerName}, + ruma_events::AnyStateEvent, + }; + use rand::Rng; + use tokio::sync::OnceCell; + + #[tokio::test] + async fn send_room_message() { + let Test { client, .. } = TEST.get_or_init(util::init).await; + + // first join + let result = join_helper().await; + let rooms: Vec<_> = result.iter().map(|r| &r.0).collect(); + tracing::info!(?rooms, "joining all guests"); + + // check whether all guests are in the room and joined the expected room + for (room_id, guests, resps) in result { + let mut resp = AdminRoomService::get_members(&admin, &room_id) + .await + .unwrap(); + resp.members.sort(); + + assert!(resps.iter().all(|r| r.is_ok())); + let resps: Vec<_> = resps.into_iter().flatten().collect(); + + assert!(resps.iter().all(|r| r.room_id == *room_id)); + + for guest in guests { + assert!(resp.members.contains(&guest)); + } + } + } +} diff --git a/docker/.gitkeep b/docker/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/docker/synapse/.gitkeep b/docker/synapse/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/docker/synapse/media_store/.gitkeep b/docker/synapse/media_store/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/fixtures/synapse/homeserver.yaml b/fixtures/synapse/homeserver.yaml deleted file mode 100644 index 7769a09..0000000 --- a/fixtures/synapse/homeserver.yaml +++ /dev/null @@ -1,46 +0,0 @@ -# Configuration file for Synapse. -# -# This is a YAML file: see [1] for a quick introduction. Note in particular -# that *indentation is important*: all the elements of a list or dictionary -# should have the same indentation. -# -# [1] https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html -# -# For more information on how to configure Synapse, including a complete accounting of -# each option, go to docs/usage/configuration/config_documentation.md or -# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html -server_name: "matrix.localhost" -pid_file: /data/homeserver.pid -listeners: - - port: 8008 - tls: false - type: http - x_forwarded: true - bind_addresses: ['::', '0.0.0.0'] - resources: - - names: [client, federation] - compress: false -database: - name: psycopg2 - txn_limit: 10000 - allow_unsafe_locale: true - args: - user: synapse_user - password: secretpassword - database: synapse - host: localhost - port: 5432 - cp_min: 5 - cp_max: 10 -log_config: "/data/matrix.localhost.log.config" -media_store_path: /data/media_store -registration_shared_secret: "m@;wYOUOh0f:CH5XA65sJB1^q01~DmIriOysRImot,OR_vzN&B" -report_stats: true -macaroon_secret_key: "XND.g+P_7wz.Yx:i6js.Eh;=jG*#uWBIe;X2OoX78^E,LVJ;8c" -form_secret: "pS7pR@AFJD~BtUAqH^ku5Kenz1X^Hol0E_+xhwvohOrkx;sMoO" -signing_key_path: "/data/matrix.localhost.signing.key" -trusted_key_servers: - - server_name: "matrix.org" - - -# vim:ft=yaml \ No newline at end of file diff --git a/fixtures/synapse/matrix.localhost.log.config b/fixtures/synapse/matrix.localhost.log.config deleted file mode 100644 index 832f0fa..0000000 --- a/fixtures/synapse/matrix.localhost.log.config +++ /dev/null @@ -1,39 +0,0 @@ -version: 1 - -formatters: - precise: - - format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s' - - -handlers: - - - console: - class: logging.StreamHandler - formatter: precise - -loggers: - # This is just here so we can leave `loggers` in the config regardless of whether - # we configure other loggers below (avoid empty yaml dict error). - _placeholder: - level: "INFO" - - - - synapse.storage.SQL: - # beware: increasing this to DEBUG will make synapse log sensitive - # information such as access tokens. - level: INFO - - - - -root: - level: INFO - - - handlers: [console] - - -disable_existing_loggers: false \ No newline at end of file diff --git a/fixtures/synapse/matrix.localhost.signing.key b/fixtures/synapse/matrix.localhost.signing.key deleted file mode 100644 index 090b449..0000000 --- a/fixtures/synapse/matrix.localhost.signing.key +++ /dev/null @@ -1 +0,0 @@ -ed25519 a_VKUD FXu3HoEKJdiMh1e+3dW8kO/P8ldSdNzdV+/vg9wdowE From 9f316d703e0da1190536c549f021d1d9d58326d0 Mon Sep 17 00:00:00 2001 From: mikoto Date: Wed, 14 Feb 2024 20:20:41 +0000 Subject: [PATCH 04/15] last attempt --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d563665..dc10628 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,8 +51,7 @@ jobs: - name: Use Test Homeserver run: | - mkdir -p ./docker/synapse/media_stroe - cp -f ./crates/test/fixtures/synapse/* ./docker/synapse/homeserver.yaml + cp -f ./crates/test/fixtures/synapse/* ./docker/synapse - name: Run Docker Containers run: | From 59b5ddb115a3f69c9018f1b8b25c5e8045400eb7 Mon Sep 17 00:00:00 2001 From: mikoto Date: Wed, 14 Feb 2024 20:25:49 +0000 Subject: [PATCH 05/15] ... --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc10628..fc5205f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,6 +51,7 @@ jobs: - name: Use Test Homeserver run: | + mkdir -p ./docker/synapse cp -f ./crates/test/fixtures/synapse/* ./docker/synapse - name: Run Docker Containers From 75d50fddab656869449727783a11507b080f1d65 Mon Sep 17 00:00:00 2001 From: mikoto Date: Wed, 14 Feb 2024 20:34:53 +0000 Subject: [PATCH 06/15] permission incorrect? --- .github/workflows/ci.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc5205f..7bd89c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,8 +51,13 @@ jobs: - name: Use Test Homeserver run: | - mkdir -p ./docker/synapse - cp -f ./crates/test/fixtures/synapse/* ./docker/synapse + mkdir -p ./docker/synapse/media_store + cp ./crates/test/fixtures/synapse/* ./docker/synapse + + - name: Set UID/GID + run: | + export UID=$(id -u) + export GID=$(id -g) - name: Run Docker Containers run: | From 4c36726467dce154a91ad0f670c78325c9822e82 Mon Sep 17 00:00:00 2001 From: mikoto Date: Wed, 14 Feb 2024 20:38:34 +0000 Subject: [PATCH 07/15] permission correct --- .github/workflows/ci.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7bd89c1..828195a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,11 +54,6 @@ jobs: mkdir -p ./docker/synapse/media_store cp ./crates/test/fixtures/synapse/* ./docker/synapse - - name: Set UID/GID - run: | - export UID=$(id -u) - export GID=$(id -g) - - name: Run Docker Containers run: | docker compose up -d --build From 92e1e9d5d1fc2ab2142f243bd6231ee90e405c70 Mon Sep 17 00:00:00 2001 From: mikoto Date: Wed, 14 Feb 2024 20:51:20 +0000 Subject: [PATCH 08/15] permissions debugging --- .github/workflows/ci.yml | 6 ++++++ docker-compose.yml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 828195a..e3fee07 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,6 +54,12 @@ jobs: mkdir -p ./docker/synapse/media_store cp ./crates/test/fixtures/synapse/* ./docker/synapse + - name: Check filesystem permissions + run: | + ls -la ./docker/synapse + echo $UID + echo $GID + - name: Run Docker Containers run: | docker compose up -d --build diff --git a/docker-compose.yml b/docker-compose.yml index 1c558f3..c4c5397 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,7 +27,7 @@ services: synapse: image: 'ghcr.io/element-hq/synapse:v1.100.0' - user: '${UID:-1000}:${GID:-1000}' + user: '${UID}:${GID}' ports: - '8008:8008' - '8448:8448' From 96e5eda805e505c6184a6326b7865e4f3f58f17e Mon Sep 17 00:00:00 2001 From: mikoto Date: Wed, 14 Feb 2024 21:06:41 +0000 Subject: [PATCH 09/15] this will do --- .github/workflows/ci.yml | 9 +++------ docker-compose.yml | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3fee07..061688c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,17 +49,14 @@ jobs: - name: Create a copy of `.env.example` run: just dotenv + - name: Set environment variable + run: export DOCKER_USER="$(id -u):$(id -g)" + - name: Use Test Homeserver run: | mkdir -p ./docker/synapse/media_store cp ./crates/test/fixtures/synapse/* ./docker/synapse - - name: Check filesystem permissions - run: | - ls -la ./docker/synapse - echo $UID - echo $GID - - name: Run Docker Containers run: | docker compose up -d --build diff --git a/docker-compose.yml b/docker-compose.yml index c4c5397..ca501b1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,7 +27,7 @@ services: synapse: image: 'ghcr.io/element-hq/synapse:v1.100.0' - user: '${UID}:${GID}' + user: '${DOCKER_USER:-1000:1000}' ports: - '8008:8008' - '8448:8448' From 26bfd4ed7ea34a00aad9be40c0cd1f1bf4f25a91 Mon Sep 17 00:00:00 2001 From: mikoto Date: Wed, 14 Feb 2024 21:19:49 +0000 Subject: [PATCH 10/15] ... --- .github/workflows/ci.yml | 2 +- docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 061688c..31a359c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: run: just dotenv - name: Set environment variable - run: export DOCKER_USER="$(id -u):$(id -g)" + run: echo "DOCKER_USER='$(id -u):$(id -g)'" >> .env - name: Use Test Homeserver run: | diff --git a/docker-compose.yml b/docker-compose.yml index ca501b1..f15339a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,7 +27,7 @@ services: synapse: image: 'ghcr.io/element-hq/synapse:v1.100.0' - user: '${DOCKER_USER:-1000:1000}' + user: '${DOCKER_USER}' ports: - '8008:8008' - '8448:8448' From 44840c7d171fc0e6c95397a6b017be8f1a7876aa Mon Sep 17 00:00:00 2001 From: mikoto Date: Wed, 14 Feb 2024 21:28:29 +0000 Subject: [PATCH 11/15] ... --- .env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 54e81d5..2b3be0d 100644 --- a/.env.example +++ b/.env.example @@ -10,7 +10,7 @@ COMMUNE_REGISTRATION_SHARED_SECRET='m@;wYOUOh0f:CH5XA65sJB1^q01~DmIriOysRImot,OR # in the `access_tokens` table. # # Generate one using: `get_access_token` after running `just gen_synapse_admin_user` -COMMUNE_SYNAPSE_ADMIN_TOKEN='' +COMMUNE_SYNAPSE_ADMIN_TOKEN='null' COMMUNE_SYNAPSE_HOST='http://0.0.0.0:8008' # Found in the homeserver.yaml file COMMUNE_SYNAPSE_SERVER_NAME='matrix.localhost' From 72f2e197f543338a3e3cb6454879d9ba40b7102b Mon Sep 17 00:00:00 2001 From: mikoto Date: Wed, 14 Feb 2024 21:48:13 +0000 Subject: [PATCH 12/15] ... --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 31a359c..0b4a44c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,6 +77,7 @@ jobs: - name: Retrieve Admin Access Token run: | just get_access_token + grep 'COMMUNE_SYNAPSE_ADMIN_TOKEN' .env - name: E2E Tests env: From 840927e383465f34d438f1cfb8f78650226a2509 Mon Sep 17 00:00:00 2001 From: mikoto Date: Wed, 14 Feb 2024 21:57:34 +0000 Subject: [PATCH 13/15] why isn't .env being read? --- Justfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Justfile b/Justfile index 57e8a42..d73b370 100644 --- a/Justfile +++ b/Justfile @@ -65,7 +65,7 @@ clear: stop docker volume rm commune_synapse_database || true # Runs all the tests from the `test` package. Optionally runs a single one if name pattern is provided -e2e *args='': +e2e *args='': dotenv cargo test --package test -- --nocapture --test-threads=1 $1 # Builds the Server binary used in the Docker Image From bdc35508297e087da8e846be035c6c14f54d22f8 Mon Sep 17 00:00:00 2001 From: mikoto Date: Wed, 14 Feb 2024 22:11:15 +0000 Subject: [PATCH 14/15] ... --- .github/workflows/ci.yml | 4 ++-- Justfile | 2 +- crates/test/src/matrix/events.rs | 39 -------------------------------- 3 files changed, 3 insertions(+), 42 deletions(-) delete mode 100644 crates/test/src/matrix/events.rs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0b4a44c..a5c6fd1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,7 @@ jobs: - name: Use Test Homeserver run: | - mkdir -p ./docker/synapse/media_store + mkdir -p ./docker/synapse cp ./crates/test/fixtures/synapse/* ./docker/synapse - name: Run Docker Containers @@ -77,7 +77,7 @@ jobs: - name: Retrieve Admin Access Token run: | just get_access_token - grep 'COMMUNE_SYNAPSE_ADMIN_TOKEN' .env + grep 'COMMUNE_SYNAPSE_ADMIN_TOKEN' .env >> $GITHUB_ENV - name: E2E Tests env: diff --git a/Justfile b/Justfile index d73b370..57e8a42 100644 --- a/Justfile +++ b/Justfile @@ -65,7 +65,7 @@ clear: stop docker volume rm commune_synapse_database || true # Runs all the tests from the `test` package. Optionally runs a single one if name pattern is provided -e2e *args='': dotenv +e2e *args='': cargo test --package test -- --nocapture --test-threads=1 $1 # Builds the Server binary used in the Docker Image diff --git a/crates/test/src/matrix/events.rs b/crates/test/src/matrix/events.rs deleted file mode 100644 index 433ecda..0000000 --- a/crates/test/src/matrix/events.rs +++ /dev/null @@ -1,39 +0,0 @@ -#[cfg(test)] -mod tests { - use std::sync::Once; - - use matrix::{ - admin::resources::room::{MessagesQuery, OrderBy}, - ruma_common::{RoomId, ServerName}, - ruma_events::AnyStateEvent, - }; - use rand::Rng; - use tokio::sync::OnceCell; - - #[tokio::test] - async fn send_room_message() { - let Test { client, .. } = TEST.get_or_init(util::init).await; - - // first join - let result = join_helper().await; - let rooms: Vec<_> = result.iter().map(|r| &r.0).collect(); - tracing::info!(?rooms, "joining all guests"); - - // check whether all guests are in the room and joined the expected room - for (room_id, guests, resps) in result { - let mut resp = AdminRoomService::get_members(&admin, &room_id) - .await - .unwrap(); - resp.members.sort(); - - assert!(resps.iter().all(|r| r.is_ok())); - let resps: Vec<_> = resps.into_iter().flatten().collect(); - - assert!(resps.iter().all(|r| r.room_id == *room_id)); - - for guest in guests { - assert!(resp.members.contains(&guest)); - } - } - } -} From d226052d40002970f3650f11f7a09f8519bd0a96 Mon Sep 17 00:00:00 2001 From: mikoto Date: Wed, 14 Feb 2024 22:32:48 +0000 Subject: [PATCH 15/15] ... --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a5c6fd1..ede1006 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,7 +77,7 @@ jobs: - name: Retrieve Admin Access Token run: | just get_access_token - grep 'COMMUNE_SYNAPSE_ADMIN_TOKEN' .env >> $GITHUB_ENV + grep 'COMMUNE_SYNAPSE_ADMIN_TOKEN' .env | sed "s/'//g" >> $GITHUB_ENV - name: E2E Tests env: