Skip to content

Commit a0c6d96

Browse files
authored
Merge pull request #1712 from matthiasn/ci/matrix_test
ci: run Matrix test with simulated bad network
2 parents b2438b0 + 09fb352 commit a0c6d96

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

.github/workflows/flutter-matrix-test.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ jobs:
2626
cwd: "integration_test/docker"
2727
- name: Run Matrix integration test
2828
uses: GabrielBB/[email protected]
29+
env:
30+
SLOW_NETWORK: true
2931
with:
3032
working-directory: ./integration_test
31-
run: ./run_matrix_tests.sh
33+
run: |
34+
./setup_toxiproxy_docker.sh
35+
./run_matrix_tests.sh

integration_test/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Run the test script against `toxiproxy`;
3939
$ SLOW_NETWORK=true ./run_matrix_tests.sh
4040
````
4141

42-
With the simulated bad network (with added 1000 ms latency and throttled to 100 KB/s), the tests
42+
With the simulated bad network (with added 500 ms latency and throttled to 100 KB/s), the tests
4343
should still complete successfully, it'll just take a bit longer. For example on an M1 Max, it
4444
typically takes around 1m 25s with the bad network simulation, and around 50s with non-degraded
4545
network.

integration_test/matrix_service_test.dart

+5-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ void main() {
2929

3030
const testSlowNetwork = bool.fromEnvironment(testSlowNetworkEnv);
3131

32+
if (testSlowNetwork) {
33+
debugPrint('Testing with degraded network.');
34+
}
35+
3236
if (!const bool.hasEnvironment(testUserEnv1)) {
3337
debugPrint('TEST_USER1 not defined!!! Run via run_matrix_tests.sh');
3438
exit(1);
@@ -63,7 +67,7 @@ void main() {
6367
password: testPassword,
6468
);
6569

66-
const delayFactor = bool.hasEnvironment(testSlowNetworkEnv) ? 5 : 1;
70+
const delayFactor = testSlowNetwork ? 5 : 1;
6771

6872
setUpAll(() async {
6973
setFakeDocumentsPath();

integration_test/setup_toxiproxy_docker.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ cd "$(dirname "$0")" || exit
44

55
cd docker || exit
66
docker compose exec toxiproxy /toxiproxy-cli create -l toxiproxy:18008 -u dendrite:8008 dendrite-proxy
7-
docker compose exec toxiproxy /toxiproxy-cli toxic add -t latency -a latency=1000 dendrite-proxy
7+
docker compose exec toxiproxy /toxiproxy-cli toxic add -t latency -a latency=500 dendrite-proxy
88
docker compose exec toxiproxy /toxiproxy-cli toxic add -t bandwidth -a rate=100 dendrite-proxy
99
cd ..

0 commit comments

Comments
 (0)