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: Bye bye SS proxy, hello Synapse \o/ #3983

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 2 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ jobs:
# run several docker containers with the same networking stack so the hostname 'postgres'
# maps to the postgres container, etc.
services:
# sliding sync needs a postgres container
# synapse needs a postgres container
postgres:
# Docker Hub image
image: postgres
Expand All @@ -353,21 +353,10 @@ jobs:
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
# run sliding sync and point it at the postgres container and synapse container.
# the postgres container needs to be above this to make sure it has started prior to this service.
slidingsync:
image: "ghcr.io/matrix-org/sliding-sync:v0.99.11" # keep in sync with ./coverage.yml
env:
SYNCV3_SERVER: "http://synapse:8008"
SYNCV3_SECRET: "SUPER_CI_SECRET"
SYNCV3_BINDADDR: ":8118"
SYNCV3_DB: "user=postgres password=postgres dbname=syncv3 sslmode=disable host=postgres"
ports:
- 8118:8118
# tests need a synapse: this is a service and not michaelkaye/setup-matrix-synapse@main as the
# latter does not provide networking for services to communicate with it.
synapse:
image: ghcr.io/matrix-org/synapse-service:5b6a75935e560945f69af72e9768bbaac10c9b4f # keep in sync with ./coverage.yml
image: ghcr.io/matrix-org/synapse-service:v1.114.0 # keep in sync with ./coverage.yml
env:
SYNAPSE_COMPLEMENT_DATABASE: sqlite
SERVER_NAME: synapse
Expand Down
14 changes: 1 addition & 13 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
# run several docker containers with the same networking stack so the hostname 'postgres'
# maps to the postgres container, etc.
services:
# sliding sync needs a postgres container
postgres:
# Docker Hub image
image: postgres
Expand All @@ -47,21 +46,10 @@ jobs:
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
# run sliding sync and point it at the postgres container and synapse container.
# the postgres container needs to be above this to make sure it has started prior to this service.
slidingsync:
image: "ghcr.io/matrix-org/sliding-sync:v0.99.11" # keep in sync with ./ci.yml
env:
SYNCV3_SERVER: "http://synapse:8008"
SYNCV3_SECRET: "SUPER_CI_SECRET"
SYNCV3_BINDADDR: ":8118"
SYNCV3_DB: "user=postgres password=postgres dbname=syncv3 sslmode=disable host=postgres"
ports:
- 8118:8118
# tests need a synapse: this is a service and not michaelkaye/setup-matrix-synapse@main as the
# latter does not provide networking for services to communicate with it.
synapse:
image: ghcr.io/matrix-org/synapse-service:5b6a75935e560945f69af72e9768bbaac10c9b4f # keep in sync with ./ci.yml
image: ghcr.io/matrix-org/synapse-service:v1.114.0 # keep in sync with ./ci.yml
env:
SYNAPSE_COMPLEMENT_DATABASE: sqlite
SERVER_NAME: synapse
Expand Down
2 changes: 1 addition & 1 deletion testing/matrix-sdk-integration-testing/assets/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM docker.io/matrixdotorg/synapse:latest
FROM docker.io/matrixdotorg/synapse:v1.114.0
ADD ci-start.sh /ci-start.sh
RUN chmod 770 /ci-start.sh
ENTRYPOINT /ci-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,6 @@ services:
volumes:
- db:/var/lib/postgresql/data

sliding-sync-proxy:
image: ghcr.io/matrix-org/sliding-sync:v0.99.11
depends_on:
synapse:
condition: service_started
postgres:
condition: service_healthy
environment:
SYNCV3_SERVER: http://synapse:8008
SYNCV3_SECRET: SUPER_SECRET
SYNCV3_BINDADDR: ":8338"
SYNCV3_DB: "user=postgres password=postgres dbname=syncv3 sslmode=disable host=postgres"
ports:
- 8338:8338

volumes:
synapse:
db:
15 changes: 6 additions & 9 deletions testing/matrix-sdk-integration-testing/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use matrix_sdk::{
};
use once_cell::sync::Lazy;
use rand::Rng as _;
use reqwest::Url;
use tempfile::{tempdir, TempDir};
use tokio::{sync::Mutex, time::sleep};

Expand Down Expand Up @@ -75,21 +74,19 @@ impl TestClientBuilder {
self
}

pub fn http_proxy(mut self, url: String) -> Self {
self.http_proxy = Some(url);
self
}

fn common_client_builder(&self) -> ClientBuilder {
let homeserver_url =
option_env!("HOMESERVER_URL").unwrap_or("http://localhost:8228").to_owned();
let sliding_sync_proxy_url =
option_env!("SLIDING_SYNC_PROXY_URL").unwrap_or("http://localhost:8338").to_owned();

let mut client_builder = Client::builder()
.user_agent("matrix-sdk-integration-tests")
.homeserver_url(homeserver_url)
// Disable MSC4186 for the integration tests as, at the time of writing
// (2024-07-15), we use a Synapse version that doesn't support MSC4186.
.sliding_sync_version_builder(VersionBuilder::Proxy {
url: Url::parse(&sliding_sync_proxy_url)
.expect("Sliding sync proxy URL is invalid"),
})
.sliding_sync_version_builder(VersionBuilder::Native)
.with_encryption_settings(self.encryption_settings)
.request_config(RequestConfig::short_retry());

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// mod notification_client;
// mod room;
mod notification_client;
mod room;
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// TODO: Remove this once all tests are re-enabled.
#![allow(unused)]

use std::sync::Arc;

use anyhow::{ensure, Result};
Expand Down Expand Up @@ -28,6 +31,7 @@ use tracing::warn;
use crate::helpers::TestClientBuilder;

#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
#[ignore]
async fn test_notification() -> Result<()> {
// Create new users for each test run, to avoid conflicts with invites existing
// from previous runs.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// TODO: Remove this once all tests are re-enabled.
#![allow(unused)]

use std::{
sync::{Arc, Mutex as StdMutex},
time::Duration,
Expand Down Expand Up @@ -31,6 +34,7 @@ use matrix_sdk::{
space::SpaceRoomJoinRule,
RoomId,
},
sliding_sync::VersionBuilder,
Client, RoomInfo, RoomMemberships, RoomState, SlidingSyncList, SlidingSyncMode,
};
use matrix_sdk_base::sliding_sync::http;
Expand Down Expand Up @@ -118,6 +122,7 @@ async fn test_left_room() -> Result<()> {
}

#[tokio::test]
#[ignore]
async fn test_room_avatar_group_conversation() -> Result<()> {
let alice = TestClientBuilder::new("alice").use_sqlite().build().await?;
let bob = TestClientBuilder::new("bob").use_sqlite().build().await?;
Expand Down Expand Up @@ -268,12 +273,11 @@ async fn test_joined_user_can_create_push_context_with_room_list_service() -> Re

// And a new device for Alice that uses sliding sync,
let hs = alice.homeserver();
let sliding_sync_version = alice.sliding_sync_version();
let alice_id = alice.user_id().unwrap().localpart().to_owned();

let alice = Client::builder()
.homeserver_url(hs)
.sliding_sync_version(sliding_sync_version)
.sliding_sync_version_builder(VersionBuilder::Native)
.build()
.await
.unwrap();
Expand Down Expand Up @@ -354,6 +358,7 @@ impl UpdateObserver {
}

#[tokio::test]
#[ignore]
async fn test_room_notification_count() -> Result<()> {
use tokio::time::timeout;

Expand Down Expand Up @@ -715,6 +720,7 @@ impl wiremock::Respond for &CustomResponder {
}

#[tokio::test]
#[ignore]
async fn test_delayed_decryption_latest_event() -> Result<()> {
let server = MockServer::start().await;

Expand Down Expand Up @@ -902,6 +908,7 @@ async fn test_delayed_invite_response_and_sent_message_decryption() -> Result<()
}

#[tokio::test]
#[ignore]
async fn test_room_info_notable_update_deduplication() -> Result<()> {
let alice = TestClientBuilder::new("alice").use_sqlite().build().await?;
let bob = TestClientBuilder::new("bob").use_sqlite().build().await?;
Expand Down Expand Up @@ -990,6 +997,7 @@ async fn test_room_info_notable_update_deduplication() -> Result<()> {
}

#[tokio::test]
#[ignore]
async fn test_room_preview() -> Result<()> {
let alice = TestClientBuilder::new("alice").use_sqlite().build().await?;
let bob = TestClientBuilder::new("bob").use_sqlite().build().await?;
Expand Down
Loading