Skip to content

Commit 1d01932

Browse files
committed
test: degraded network support instructions
1 parent 28d6d12 commit 1d01932

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,4 @@ whisper.cpp/whisper.cpp-*/
8080
.fvm/
8181

8282
integration_test/dendrite/config/jetstream/
83+
integration_test/dendrite/config/logs/

integration_test/README.md

+15-3
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,22 @@ successfully. Also see [PR #1695](https://github.com/matthiasn/lotti/pull/1695)
2323

2424
## Testing with simulated bad network
2525

26-
Install [comcast](https://github.com/tylertreat/Comcast), e.g.:
26+
Install [toxiproxy](https://github.com/Shopify/toxiproxy) and run server:
2727

2828
````shell
29-
$ GOBIN=~/bin/ go install github.com/tylertreat/comcast@latest
29+
$ toxiproxy-server
3030
````
3131

32-
To be continued.
32+
In separate shell:
33+
34+
````shell
35+
$ toxiproxy-cli create -l localhost:18008 -u localhost:8008 dendrite-proxy
36+
$ toxiproxy-cli toxic add -t latency -a latency=1000 dendrite-proxy
37+
$ toxiproxy-cli toxic add -t bandwidth -a rate=100 dendrite-proxy
38+
````
39+
40+
Run the test script against `toxiproxy`;
41+
42+
````shell
43+
$ SLOW_NETWORK=true ./integration_test/run_matrix_tests.sh
44+
````

integration_test/matrix_service_test.dart

+6-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ void main() {
2727
const testPasswordEnv = 'TEST_PASSWORD';
2828
const testSlowNetworkEnv = 'SLOW_NETWORK';
2929

30+
const testSlowNetwork = bool.fromEnvironment(testSlowNetworkEnv);
31+
3032
if (!const bool.hasEnvironment(testUserEnv1)) {
3133
debugPrint('TEST_USER1 not defined!!! Run via run_matrix_tests.sh');
3234
exit(1);
@@ -42,7 +44,9 @@ void main() {
4244

4345
const testHomeServer = bool.hasEnvironment(testServerEnv)
4446
? String.fromEnvironment(testServerEnv)
45-
: 'http://localhost:8008';
47+
: testSlowNetwork
48+
? 'http://localhost:18008'
49+
: 'http://localhost:8008';
4650
const testPassword = bool.hasEnvironment(testPasswordEnv)
4751
? String.fromEnvironment(testPasswordEnv)
4852
: '?Secret123@!';
@@ -59,7 +63,7 @@ void main() {
5963
password: testPassword,
6064
);
6165

62-
const delayFactor = bool.hasEnvironment(testSlowNetworkEnv) ? 10 : 1;
66+
const delayFactor = bool.hasEnvironment(testSlowNetworkEnv) ? 5 : 1;
6367

6468
setUpAll(() async {
6569
setFakeDocumentsPath();

integration_test/run_matrix_tests.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,7 @@ cd ../dendrite/build/docker/config || exit
1515
cd - > /dev/null || exit
1616

1717
fvm flutter test integration_test/matrix_service_test.dart \
18-
--dart-define=TEST_USER1="@$TEST_USER1:localhost" \
19-
--dart-define=TEST_USER2="@$TEST_USER2:localhost"
18+
--dart-define=TEST_USER1="@$TEST_USER1:localhost" \
19+
--dart-define=TEST_USER2="@$TEST_USER2:localhost" \
20+
--dart-define=SLOW_NETWORK="$SLOW_NETWORK"
21+

0 commit comments

Comments
 (0)