refactor: migrate integration tests to more stable setup
Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf> Signed-off-by: The one with the braid <the-one@with-the-braid.cf>
This commit is contained in:
parent
3fb134dfb2
commit
c2e8ecfdff
|
|
@ -76,23 +76,26 @@ e2ee_test:
|
||||||
DOCKER_DRIVER: overlay2
|
DOCKER_DRIVER: overlay2
|
||||||
# Disable TLS since we're running inside local network.
|
# Disable TLS since we're running inside local network.
|
||||||
DOCKER_TLS_CERTDIR: ""
|
DOCKER_TLS_CERTDIR: ""
|
||||||
|
HOMESERVER: docker
|
||||||
dependencies: []
|
dependencies: []
|
||||||
parallel:
|
parallel:
|
||||||
matrix:
|
matrix:
|
||||||
- HOMESERVER:
|
- HOMESERVER_IMPLEMENTATION:
|
||||||
- synapse
|
- synapse
|
||||||
- dendrite
|
- dendrite
|
||||||
- conduit
|
- conduit
|
||||||
before_script:
|
before_script:
|
||||||
- scripts/integration-prepare-alpine.sh
|
- scripts/integration-prepare-alpine.sh
|
||||||
# create Synapse instance
|
# deploy homeserver instance
|
||||||
- scripts/integration-server-$HOMESERVER.sh
|
- scripts/integration-server-$HOMESERVER_IMPLEMENTATION.sh
|
||||||
|
script:
|
||||||
|
# create test user environment variables
|
||||||
|
- source scripts/integration-create-environment-variables.sh
|
||||||
# properly set the homeserver IP and create test users
|
# properly set the homeserver IP and create test users
|
||||||
- scripts/integration-prepare-homeserver.sh
|
- scripts/integration-prepare-homeserver.sh
|
||||||
# setup OLM
|
# setup OLM
|
||||||
- scripts/prepare.sh
|
- scripts/prepare.sh
|
||||||
script:
|
- scripts/test_driver.sh
|
||||||
- ./scripts/test_driver.sh
|
|
||||||
timeout: 10m
|
timeout: 10m
|
||||||
|
|
||||||
dry-run:
|
dry-run:
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
export USER1_NAME="alice"
|
||||||
|
export USER1_PW="AliceInWonderland"
|
||||||
|
export USER2_NAME="bob"
|
||||||
|
export USER2_PW="JoWirSchaffenDas"
|
||||||
|
export USER3_NAME="trudy"
|
||||||
|
export USER3_PW="HaveIBeenPwned"
|
||||||
|
|
@ -1,18 +1,44 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
IP_ADDRESS="$(drill docker | grep -m 1 -P "\d+\.\d+\.\d+.\d+" | awk -F ' ' '{print $NF}')"
|
if [ -z $HOMESERVER ]; then
|
||||||
|
echo "Please ensure HOMESERVER environment variable is set to the IP or hostname of the homeserver."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -z $USER1_NAME ]; then
|
||||||
|
echo "Please ensure USER1_NAME environment variable is set to first user name."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -z $USER1_PW ]; then
|
||||||
|
echo "Please ensure USER1_PW environment variable is set to first user password."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -z $USER2_NAME ]; then
|
||||||
|
echo "Please ensure USER2_NAME environment variable is set to second user name."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -z $USER2_PW ]; then
|
||||||
|
echo "Please ensure USER2_PW environment variable is set to second user password."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -z $USER3_NAME ]; then
|
||||||
|
echo "Please ensure USER3_NAME environment variable is set to third user name."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -z $USER3_PW ]; then
|
||||||
|
echo "Please ensure USER3_PW environment variable is set to third user password."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Homeserver IP found at $IP_ADDRESS."
|
echo "Waiting for homeserver to be available... (GET http://$HOMESERVER/_matrix/client/v3/login)"
|
||||||
|
|
||||||
echo "Waiting for homeserver to be available..."
|
while ! curl -XGET "http://$HOMESERVER/_matrix/client/v3/login" >/dev/null 2>/dev/null; do
|
||||||
|
|
||||||
while ! curl -XGET "http://$IP_ADDRESS/_matrix/client/v3/login" >/dev/null 2>/dev/null; do
|
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Homeserver is up."
|
echo "Homeserver is up."
|
||||||
|
|
||||||
sed -i "s/localhost/$IP_ADDRESS/g" test_driver/test_config.dart
|
# create users
|
||||||
|
|
||||||
curl -fS --retry 3 -XPOST -d '{"username":"alice", "password":"AliceInWonderland", "inhibit_login":true, "auth": {"type":"m.login.dummy"}}' "http://$IP_ADDRESS/_matrix/client/r0/register"
|
curl -fS --retry 3 -XPOST -d '{"username":"'"$USER1_NAME"'", "password":"'"$USER1_PW"'", "inhibit_login":true, "auth": {"type":"m.login.dummy"}}' "http://$HOMESERVER/_matrix/client/r0/register"
|
||||||
curl -fS --retry 3 -XPOST -d '{"username":"bob", "password":"JoWirSchaffenDas", "inhibit_login":true, "auth": {"type":"m.login.dummy"}}' "http://$IP_ADDRESS/_matrix/client/r0/register"
|
curl -fS --retry 3 -XPOST -d '{"username":"'"$USER2_NAME"'", "password":"'"$USER2_PW"'", "inhibit_login":true, "auth": {"type":"m.login.dummy"}}' "http://$HOMESERVER/_matrix/client/r0/register"
|
||||||
curl -fS --retry 3 -XPOST -d '{"username":"trudy", "password":"HaveIBeenPwned", "inhibit_login":true, "auth": {"type":"m.login.dummy"}}' "http://$IP_ADDRESS/_matrix/client/r0/register"
|
curl -fS --retry 3 -XPOST -d '{"username":"'"$USER3_NAME"'", "password":"'"$USER3_PW"'", "inhibit_login":true, "auth": {"type":"m.login.dummy"}}' "http://$HOMESERVER/_matrix/client/r0/register"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
if which flutter >/dev/null; then
|
if which flutter >/dev/null; then
|
||||||
flutter pub run test_driver/matrixsdk_test.dart -p vm
|
flutter --no-version-check test test_driver/matrixsdk_test.dart --dart-define=HOMESERVER=$HOMESERVER --dart-define=USER1_NAME=$USER1_NAME --dart-define=USER2_NAME=$USER2_NAME --dart-define=USER3_NAME=$USER3_NAME --dart-define=USER1_PW=$USER1_PW --dart-define=USER2_PW=$USER2_PW --dart-define=USER3_PW=$USER3_PW
|
||||||
else
|
else
|
||||||
dart pub run test_driver/matrixsdk_test.dart -p vm
|
dart run -D HOMESERVER=$HOMESERVER -D USER1_NAME=$USER1_NAME -D USER2_NAME=$USER2_NAME -D USER3_NAME=$USER3_NAME -D USER1_PW=$USER1_PW -D USER2_PW=$USER2_PW -D USER3_PW=$USER3_PW test_driver/matrixsdk_test.dart -p vm
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -44,22 +44,27 @@ void main() => group('Integration tests', () {
|
||||||
olm.Account();
|
olm.Account();
|
||||||
Logs().i('[LibOlm] Enabled');
|
Logs().i('[LibOlm] Enabled');
|
||||||
|
|
||||||
|
final homeserverUri = Uri.parse(homeserver);
|
||||||
|
Logs().i('++++ Using homeserver $homeserverUri ++++');
|
||||||
|
|
||||||
Logs().i('++++ Login Alice at ++++');
|
Logs().i('++++ Login Alice at ++++');
|
||||||
testClientA = Client('TestClientA', databaseBuilder: getDatabase);
|
testClientA = Client('TestClientA', databaseBuilder: getDatabase);
|
||||||
await testClientA.checkHomeserver(Uri.parse(TestUser.homeserver));
|
await testClientA.checkHomeserver(homeserverUri);
|
||||||
await testClientA.login(LoginType.mLoginPassword,
|
await testClientA.login(
|
||||||
identifier: AuthenticationUserIdentifier(
|
LoginType.mLoginPassword,
|
||||||
user: TestUser.username.localpart!),
|
identifier: AuthenticationUserIdentifier(user: Users.user1.name),
|
||||||
password: TestUser.password);
|
password: Users.user1.password,
|
||||||
|
);
|
||||||
expect(testClientA.encryptionEnabled, true);
|
expect(testClientA.encryptionEnabled, true);
|
||||||
|
|
||||||
Logs().i('++++ Login Bob ++++');
|
Logs().i('++++ Login Bob ++++');
|
||||||
testClientB = Client('TestClientB', databaseBuilder: getDatabase);
|
testClientB = Client('TestClientB', databaseBuilder: getDatabase);
|
||||||
await testClientB.checkHomeserver(Uri.parse(TestUser.homeserver));
|
await testClientB.checkHomeserver(homeserverUri);
|
||||||
await testClientB.login(LoginType.mLoginPassword,
|
await testClientB.login(
|
||||||
identifier: AuthenticationUserIdentifier(
|
LoginType.mLoginPassword,
|
||||||
user: TestUser.username2.localpart!),
|
identifier: AuthenticationUserIdentifier(user: Users.user2.name),
|
||||||
password: TestUser.password2);
|
password: Users.user2.password,
|
||||||
|
);
|
||||||
expect(testClientB.encryptionEnabled, true);
|
expect(testClientB.encryptionEnabled, true);
|
||||||
|
|
||||||
Logs().i('++++ (Alice) Leave all rooms ++++');
|
Logs().i('++++ (Alice) Leave all rooms ++++');
|
||||||
|
|
@ -86,32 +91,32 @@ void main() => group('Integration tests', () {
|
||||||
}
|
}
|
||||||
|
|
||||||
Logs().i('++++ Check if own olm device is verified by default ++++');
|
Logs().i('++++ Check if own olm device is verified by default ++++');
|
||||||
expect(testClientA.userDeviceKeys, contains(TestUser.username));
|
expect(testClientA.userDeviceKeys, contains(testClientA.userID));
|
||||||
expect(testClientA.userDeviceKeys[TestUser.username]!.deviceKeys,
|
expect(testClientA.userDeviceKeys[testClientA.userID]!.deviceKeys,
|
||||||
contains(testClientA.deviceID));
|
contains(testClientA.deviceID));
|
||||||
expect(
|
expect(
|
||||||
testClientA.userDeviceKeys[TestUser.username]!
|
testClientA.userDeviceKeys[testClientA.userID]!
|
||||||
.deviceKeys[testClientA.deviceID!]!.verified,
|
.deviceKeys[testClientA.deviceID!]!.verified,
|
||||||
isTrue);
|
isTrue);
|
||||||
expect(
|
expect(
|
||||||
!testClientA.userDeviceKeys[TestUser.username]!
|
!testClientA.userDeviceKeys[testClientA.userID]!
|
||||||
.deviceKeys[testClientA.deviceID!]!.blocked,
|
.deviceKeys[testClientA.deviceID!]!.blocked,
|
||||||
isTrue);
|
isTrue);
|
||||||
expect(testClientB.userDeviceKeys, contains(TestUser.username2));
|
expect(testClientB.userDeviceKeys, contains(testClientB.userID));
|
||||||
expect(testClientB.userDeviceKeys[TestUser.username2]!.deviceKeys,
|
expect(testClientB.userDeviceKeys[testClientB.userID]!.deviceKeys,
|
||||||
contains(testClientB.deviceID));
|
contains(testClientB.deviceID));
|
||||||
expect(
|
expect(
|
||||||
testClientB.userDeviceKeys[TestUser.username2]!
|
testClientB.userDeviceKeys[testClientB.userID]!
|
||||||
.deviceKeys[testClientB.deviceID!]!.verified,
|
.deviceKeys[testClientB.deviceID!]!.verified,
|
||||||
isTrue);
|
isTrue);
|
||||||
expect(
|
expect(
|
||||||
!testClientB.userDeviceKeys[TestUser.username2]!
|
!testClientB.userDeviceKeys[testClientB.userID]!
|
||||||
.deviceKeys[testClientB.deviceID!]!.blocked,
|
.deviceKeys[testClientB.deviceID!]!.blocked,
|
||||||
isTrue);
|
isTrue);
|
||||||
|
|
||||||
Logs().i('++++ (Alice) Create room and invite Bob ++++');
|
Logs().i('++++ (Alice) Create room and invite Bob ++++');
|
||||||
await testClientA.startDirectChat(
|
await testClientA.startDirectChat(
|
||||||
TestUser.username2,
|
testClientB.userID!,
|
||||||
enableEncryption: false,
|
enableEncryption: false,
|
||||||
);
|
);
|
||||||
await Future.delayed(Duration(seconds: 1));
|
await Future.delayed(Duration(seconds: 1));
|
||||||
|
|
@ -132,52 +137,52 @@ void main() => group('Integration tests', () {
|
||||||
expect(
|
expect(
|
||||||
room.client.encryption!.keyManager
|
room.client.encryption!.keyManager
|
||||||
.getOutboundGroupSession(room.id),
|
.getOutboundGroupSession(room.id),
|
||||||
null);
|
isNull);
|
||||||
|
|
||||||
Logs().i('++++ (Alice) Check known olm devices ++++');
|
Logs().i('++++ (Alice) Check known olm devices ++++');
|
||||||
expect(testClientA.userDeviceKeys, contains(TestUser.username2));
|
expect(testClientA.userDeviceKeys, contains(testClientB.userID));
|
||||||
expect(testClientA.userDeviceKeys[TestUser.username2]!.deviceKeys,
|
expect(testClientA.userDeviceKeys[testClientB.userID]!.deviceKeys,
|
||||||
contains(testClientB.deviceID));
|
contains(testClientB.deviceID));
|
||||||
expect(
|
expect(
|
||||||
testClientA.userDeviceKeys[TestUser.username2]!
|
testClientA.userDeviceKeys[testClientB.userID]!
|
||||||
.deviceKeys[testClientB.deviceID!]!.verified,
|
.deviceKeys[testClientB.deviceID!]!.verified,
|
||||||
isFalse);
|
isFalse);
|
||||||
expect(
|
expect(
|
||||||
testClientA.userDeviceKeys[TestUser.username2]!
|
testClientA.userDeviceKeys[testClientB.userID]!
|
||||||
.deviceKeys[testClientB.deviceID!]!.blocked,
|
.deviceKeys[testClientB.deviceID!]!.blocked,
|
||||||
isFalse);
|
isFalse);
|
||||||
expect(testClientB.userDeviceKeys, contains(TestUser.username));
|
expect(testClientB.userDeviceKeys, contains(testClientA.userID));
|
||||||
expect(testClientB.userDeviceKeys[TestUser.username]!.deviceKeys,
|
expect(testClientB.userDeviceKeys[testClientA.userID]!.deviceKeys,
|
||||||
contains(testClientA.deviceID));
|
contains(testClientA.deviceID));
|
||||||
expect(
|
expect(
|
||||||
testClientB.userDeviceKeys[TestUser.username]!
|
testClientB.userDeviceKeys[testClientA.userID]!
|
||||||
.deviceKeys[testClientA.deviceID!]!.verified,
|
.deviceKeys[testClientA.deviceID!]!.verified,
|
||||||
isFalse);
|
isFalse);
|
||||||
expect(
|
expect(
|
||||||
testClientB.userDeviceKeys[TestUser.username]!
|
testClientB.userDeviceKeys[testClientA.userID]!
|
||||||
.deviceKeys[testClientA.deviceID!]!.blocked,
|
.deviceKeys[testClientA.deviceID!]!.blocked,
|
||||||
isFalse);
|
isFalse);
|
||||||
await Future.wait([
|
await Future.wait([
|
||||||
testClientA.updateUserDeviceKeys(),
|
testClientA.updateUserDeviceKeys(),
|
||||||
testClientB.updateUserDeviceKeys(),
|
testClientB.updateUserDeviceKeys(),
|
||||||
]);
|
]);
|
||||||
await testClientA.userDeviceKeys[TestUser.username2]!
|
await testClientA.userDeviceKeys[testClientB.userID]!
|
||||||
.deviceKeys[testClientB.deviceID!]!
|
.deviceKeys[testClientB.deviceID!]!
|
||||||
.setVerified(true);
|
.setVerified(true);
|
||||||
|
|
||||||
Logs().i('++++ Check if own olm device is verified by default ++++');
|
Logs().i('++++ Check if own olm device is verified by default ++++');
|
||||||
expect(testClientA.userDeviceKeys, contains(TestUser.username));
|
expect(testClientA.userDeviceKeys, contains(testClientA.userID));
|
||||||
expect(testClientA.userDeviceKeys[TestUser.username]!.deviceKeys,
|
expect(testClientA.userDeviceKeys[testClientA.userID]!.deviceKeys,
|
||||||
contains(testClientA.deviceID));
|
contains(testClientA.deviceID));
|
||||||
expect(
|
expect(
|
||||||
testClientA.userDeviceKeys[TestUser.username]!
|
testClientA.userDeviceKeys[testClientA.userID]!
|
||||||
.deviceKeys[testClientA.deviceID!]!.verified,
|
.deviceKeys[testClientA.deviceID!]!.verified,
|
||||||
isTrue);
|
isTrue);
|
||||||
expect(testClientB.userDeviceKeys, contains(TestUser.username2));
|
expect(testClientB.userDeviceKeys, contains(testClientB.userID));
|
||||||
expect(testClientB.userDeviceKeys[TestUser.username2]!.deviceKeys,
|
expect(testClientB.userDeviceKeys[testClientB.userID]!.deviceKeys,
|
||||||
contains(testClientB.deviceID));
|
contains(testClientB.deviceID));
|
||||||
expect(
|
expect(
|
||||||
testClientB.userDeviceKeys[TestUser.username2]!
|
testClientB.userDeviceKeys[testClientB.userID]!
|
||||||
.deviceKeys[testClientB.deviceID!]!.verified,
|
.deviceKeys[testClientB.deviceID!]!.verified,
|
||||||
isTrue);
|
isTrue);
|
||||||
|
|
||||||
|
|
@ -198,11 +203,13 @@ void main() => group('Integration tests', () {
|
||||||
expect(
|
expect(
|
||||||
testClientA.encryption!.olmManager
|
testClientA.encryption!.olmManager
|
||||||
.olmSessions[testClientB.identityKey]!.length,
|
.olmSessions[testClientB.identityKey]!.length,
|
||||||
1);
|
olmLengthMatcher,
|
||||||
|
);
|
||||||
expect(
|
expect(
|
||||||
testClientB.encryption!.olmManager
|
testClientB.encryption!.olmManager
|
||||||
.olmSessions[testClientA.identityKey]!.length,
|
.olmSessions[testClientA.identityKey]!.length,
|
||||||
1);
|
olmLengthMatcher,
|
||||||
|
);
|
||||||
expect(
|
expect(
|
||||||
testClientA.encryption!.olmManager
|
testClientA.encryption!.olmManager
|
||||||
.olmSessions[testClientB.identityKey]!.first.sessionId,
|
.olmSessions[testClientB.identityKey]!.first.sessionId,
|
||||||
|
|
@ -223,11 +230,13 @@ void main() => group('Integration tests', () {
|
||||||
expect(
|
expect(
|
||||||
testClientA.encryption!.olmManager
|
testClientA.encryption!.olmManager
|
||||||
.olmSessions[testClientB.identityKey]!.length,
|
.olmSessions[testClientB.identityKey]!.length,
|
||||||
1);
|
olmLengthMatcher,
|
||||||
|
);
|
||||||
expect(
|
expect(
|
||||||
testClientB.encryption!.olmManager
|
testClientB.encryption!.olmManager
|
||||||
.olmSessions[testClientA.identityKey]!.length,
|
.olmSessions[testClientA.identityKey]!.length,
|
||||||
1);
|
olmLengthMatcher,
|
||||||
|
);
|
||||||
expect(
|
expect(
|
||||||
testClientA.encryption!.olmManager
|
testClientA.encryption!.olmManager
|
||||||
.olmSessions[testClientB.identityKey]!.first.sessionId,
|
.olmSessions[testClientB.identityKey]!.first.sessionId,
|
||||||
|
|
@ -255,11 +264,12 @@ void main() => group('Integration tests', () {
|
||||||
expect(
|
expect(
|
||||||
testClientA.encryption!.olmManager
|
testClientA.encryption!.olmManager
|
||||||
.olmSessions[testClientB.identityKey]!.length,
|
.olmSessions[testClientB.identityKey]!.length,
|
||||||
1);
|
olmLengthMatcher,
|
||||||
|
);
|
||||||
expect(
|
expect(
|
||||||
testClientB.encryption!.olmManager
|
testClientB.encryption!.olmManager
|
||||||
.olmSessions[testClientA.identityKey]!.length,
|
.olmSessions[testClientA.identityKey]!.length,
|
||||||
1);
|
olmLengthMatcher);
|
||||||
expect(
|
expect(
|
||||||
room.client.encryption!.keyManager
|
room.client.encryption!.keyManager
|
||||||
.getOutboundGroupSession(room.id)!
|
.getOutboundGroupSession(room.id)!
|
||||||
|
|
@ -289,18 +299,19 @@ void main() => group('Integration tests', () {
|
||||||
Logs().i('++++ Login Bob in another client ++++');
|
Logs().i('++++ Login Bob in another client ++++');
|
||||||
final testClientC =
|
final testClientC =
|
||||||
Client('TestClientC', databaseBuilder: getDatabase);
|
Client('TestClientC', databaseBuilder: getDatabase);
|
||||||
await testClientC.checkHomeserver(Uri.parse(TestUser.homeserver));
|
await testClientC.checkHomeserver(homeserverUri);
|
||||||
// We can't sign in using the displayname, since that breaks e2ee on dendrite: https://github.com/matrix-org/dendrite/issues/2914
|
// We can't sign in using the displayname, since that breaks e2ee on dendrite: https://github.com/matrix-org/dendrite/issues/2914
|
||||||
await testClientC.login(LoginType.mLoginPassword,
|
await testClientC.login(
|
||||||
identifier: AuthenticationUserIdentifier(
|
LoginType.mLoginPassword,
|
||||||
user: TestUser.username2.localpart!),
|
identifier: AuthenticationUserIdentifier(user: Users.user2.name),
|
||||||
password: TestUser.password2);
|
password: Users.user2.password,
|
||||||
|
);
|
||||||
await Future.delayed(Duration(seconds: 3));
|
await Future.delayed(Duration(seconds: 3));
|
||||||
|
|
||||||
Logs().i(
|
Logs().i(
|
||||||
"++++ (Alice) Send again encrypted message: '$testMessage4' ++++");
|
"++++ (Alice) Send again encrypted message: '$testMessage4' ++++");
|
||||||
await room.sendTextEvent(testMessage4);
|
await room.sendTextEvent(testMessage4);
|
||||||
await Future.delayed(Duration(seconds: 5));
|
await Future.delayed(Duration(seconds: 7));
|
||||||
expect(
|
expect(
|
||||||
testClientA.encryption!.olmManager
|
testClientA.encryption!.olmManager
|
||||||
.olmSessions[testClientB.identityKey]!.length,
|
.olmSessions[testClientB.identityKey]!.length,
|
||||||
|
|
@ -317,11 +328,11 @@ void main() => group('Integration tests', () {
|
||||||
expect(
|
expect(
|
||||||
testClientA.encryption!.olmManager
|
testClientA.encryption!.olmManager
|
||||||
.olmSessions[testClientC.identityKey]!.length,
|
.olmSessions[testClientC.identityKey]!.length,
|
||||||
1);
|
olmLengthMatcher);
|
||||||
expect(
|
expect(
|
||||||
testClientC.encryption!.olmManager
|
testClientC.encryption!.olmManager
|
||||||
.olmSessions[testClientA.identityKey]!.length,
|
.olmSessions[testClientA.identityKey]!.length,
|
||||||
1);
|
olmLengthMatcher);
|
||||||
expect(
|
expect(
|
||||||
testClientA.encryption!.olmManager
|
testClientA.encryption!.olmManager
|
||||||
.olmSessions[testClientC.identityKey]!.first.sessionId,
|
.olmSessions[testClientC.identityKey]!.first.sessionId,
|
||||||
|
|
@ -354,11 +365,13 @@ void main() => group('Integration tests', () {
|
||||||
expect(
|
expect(
|
||||||
testClientA.encryption!.olmManager
|
testClientA.encryption!.olmManager
|
||||||
.olmSessions[testClientB.identityKey]!.length,
|
.olmSessions[testClientB.identityKey]!.length,
|
||||||
1);
|
olmLengthMatcher,
|
||||||
|
);
|
||||||
expect(
|
expect(
|
||||||
testClientB.encryption!.olmManager
|
testClientB.encryption!.olmManager
|
||||||
.olmSessions[testClientA.identityKey]!.length,
|
.olmSessions[testClientA.identityKey]!.length,
|
||||||
1);
|
olmLengthMatcher,
|
||||||
|
);
|
||||||
expect(
|
expect(
|
||||||
testClientA.encryption!.olmManager
|
testClientA.encryption!.olmManager
|
||||||
.olmSessions[testClientB.identityKey]!.first.sessionId,
|
.olmSessions[testClientB.identityKey]!.first.sessionId,
|
||||||
|
|
@ -366,7 +379,7 @@ void main() => group('Integration tests', () {
|
||||||
.olmSessions[testClientA.identityKey]!.first.sessionId);
|
.olmSessions[testClientA.identityKey]!.first.sessionId);
|
||||||
|
|
||||||
// This does not work on conduit because of a server bug: https://gitlab.com/famedly/conduit/-/issues/325
|
// This does not work on conduit because of a server bug: https://gitlab.com/famedly/conduit/-/issues/325
|
||||||
if (Platform.environment['HOMESERVER'] != 'conduit') {
|
if (Platform.environment['HOMESERVER_IMPLEMENTATION'] != 'conduit') {
|
||||||
expect(
|
expect(
|
||||||
room.client.encryption!.keyManager
|
room.client.encryption!.keyManager
|
||||||
.getOutboundGroupSession(room.id)!
|
.getOutboundGroupSession(room.id)!
|
||||||
|
|
@ -406,3 +419,14 @@ void main() => group('Integration tests', () {
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
}, timeout: Timeout(Duration(minutes: 6)));
|
}, timeout: Timeout(Duration(minutes: 6)));
|
||||||
|
|
||||||
|
Object get olmLengthMatcher {
|
||||||
|
return
|
||||||
|
// workarounding weird Dendrite bug
|
||||||
|
Platform.environment['HOMESERVER_IMPLEMENTATION'] != 'dendrite'
|
||||||
|
? 1
|
||||||
|
: predicate(
|
||||||
|
[1, 2].contains,
|
||||||
|
'is either 1 or two',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,36 @@
|
||||||
class TestUser {
|
abstract class Users {
|
||||||
static const String homeserver = 'http://localhost';
|
const Users._();
|
||||||
static const String username = '@alice:famedlysdk.test';
|
|
||||||
static const String username2 = '@bob:famedlysdk.test';
|
static const user1 = User(
|
||||||
static const String displayname = 'Alice';
|
String.fromEnvironment(
|
||||||
static const String displayname2 = 'Bob';
|
'USER1_NAME',
|
||||||
static const String password = 'AliceInWonderland';
|
defaultValue: 'alice',
|
||||||
static const String password2 = 'JoWirSchaffenDas';
|
),
|
||||||
|
String.fromEnvironment(
|
||||||
|
'USER1_PW',
|
||||||
|
defaultValue: 'AliceInWonderland',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
static const user2 = User(
|
||||||
|
String.fromEnvironment(
|
||||||
|
'USER2_NAME',
|
||||||
|
defaultValue: 'bob',
|
||||||
|
),
|
||||||
|
String.fromEnvironment(
|
||||||
|
'USER2_PW',
|
||||||
|
defaultValue: 'JoWirSchaffenDas',
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class User {
|
||||||
|
final String name;
|
||||||
|
final String password;
|
||||||
|
|
||||||
|
const User(this.name, this.password);
|
||||||
|
}
|
||||||
|
|
||||||
|
const homeserver = 'http://${const String.fromEnvironment(
|
||||||
|
'HOMESERVER',
|
||||||
|
defaultValue: 'localhost',
|
||||||
|
)}';
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue