fix: coverage_without_olm tests

The coverage calculation is currently broken in dart/test, see
https://github.com/dart-lang/test/issues/1698 for reference.
This commit is contained in:
Nicolas Werner 2022-08-15 13:03:06 +02:00
parent f08d38ef6d
commit 4ac1615ad6
16 changed files with 23 additions and 91 deletions

View File

@ -50,17 +50,17 @@ coverage_without_olm:
script:
- dart pub get
- ./scripts/test.sh
coverage: /^\s*lines\.*:\s*\d+.\d+\%/
#coverage: /^\s*lines\.*:\s*\d+.\d+\%/ <- broken see https://github.com/dart-lang/test/issues/1698
artifacts:
when: always
paths:
- coverage/
- coverage.xml
#- coverage/
#- coverage.xml
- TEST-report.xml
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
#coverage_report:
# coverage_format: cobertura
# path: coverage.xml
junit: TEST-report.xml
e2ee_test:

View File

@ -14,7 +14,9 @@ if which flutter >/dev/null; then
flutter pub global run remove_from_coverage:remove_from_coverage -f coverage/lcov.info -r '\.g\.dart$'
else
dart pub global activate junitreport
dart test --coverage=coverage --file-reporter='json:TEST-report.json'
# Test coverage using dart only is broken: https://github.com/dart-lang/test/issues/1698
#dart test --coverage=coverage --file-reporter='json:TEST-report.json'
dart test --file-reporter='json:TEST-report.json'
TEST_CODE=$?
# junit report
@ -22,15 +24,15 @@ else
# remove shell escapes since those are invalid xml
sed 's/&#x1B;//g' -i TEST-report.xml
# coverage
dart pub global activate coverage
# coverage -> broken see https://github.com/dart-lang/test/issues/1698
#dart pub global activate coverage
reporton="--report-on=lib/"
if [ -n "$NO_OLM" ]; then reporton="--report-on=lib/src --report-on=lib/msc_extensions"; fi
#reporton="--report-on=lib/"
#if [ -n "$NO_OLM" ]; then reporton="--report-on=lib/src --report-on=lib/msc_extensions"; fi
dart pub global run coverage:format_coverage -i coverage/ --lcov -o coverage/lcov.info $reporton
dart pub global activate remove_from_coverage
dart pub global run remove_from_coverage:remove_from_coverage -f coverage/lcov.info -r '\.g\.dart$'
#dart pub global run coverage:format_coverage -i coverage/ --lcov -o coverage/lcov.info $reporton
#dart pub global activate remove_from_coverage
#dart pub global run remove_from_coverage:remove_from_coverage -f coverage/lcov.info -r '\.g\.dart$'
fi
# coverage html report

View File

@ -255,10 +255,5 @@ void main() {
if (!olmEnabled) return;
await client.dispose(closeDatabase: true);
});
// see https://github.com/dart-lang/test/issues/1698
test('KeyVerification dummy test', () async {
await Future.delayed(Duration(seconds: 1));
});
});
}

View File

@ -117,10 +117,5 @@ void main() {
if (!olmEnabled) return;
await client.dispose(closeDatabase: true);
});
// see https://github.com/dart-lang/test/issues/1698
test('KeyVerification dummy test', () async {
await Future.delayed(Duration(seconds: 1));
});
});
}

View File

@ -102,10 +102,5 @@ void main() {
if (!olmEnabled) return;
await client.dispose(closeDatabase: true);
});
// see https://github.com/dart-lang/test/issues/1698
test('KeyVerification dummy test', () async {
await Future.delayed(Duration(seconds: 1));
});
});
}

View File

@ -120,10 +120,5 @@ void main() {
await client.dispose(closeDatabase: true);
await otherClient.dispose(closeDatabase: true);
});
// see https://github.com/dart-lang/test/issues/1698
test('KeyVerification dummy test', () async {
await Future.delayed(Duration(seconds: 1));
});
});
}

View File

@ -572,10 +572,5 @@ void main() {
if (!olmEnabled) return;
await client.dispose(closeDatabase: false);
});
// see https://github.com/dart-lang/test/issues/1698
test('KeyVerification dummy test', () async {
await Future.delayed(Duration(seconds: 1));
});
});
}

View File

@ -400,10 +400,5 @@ void main() {
await matrix.dispose(closeDatabase: true);
});
// see https://github.com/dart-lang/test/issues/1698
test('KeyVerification dummy test', () async {
await Future.delayed(Duration(seconds: 1));
});
});
}

View File

@ -241,7 +241,7 @@ void main() async {
true);
await client1.encryption!.keyVerificationManager.cleanup();
await client2.encryption!.keyVerificationManager.cleanup();
}, skip: skip);
});
test('ask SSSS start', () async {
client1.userDeviceKeys[client1.userID]!.masterKey!
@ -257,7 +257,7 @@ void main() async {
await req1.cancel();
await client1.encryption!.keyVerificationManager.cleanup();
}, skip: skip);
});
test('ask SSSS end', () async {
FakeMatrixApi.calledEndpoints.clear();
@ -379,7 +379,7 @@ void main() async {
await client1.encryption!.keyVerificationManager.cleanup();
await client2.encryption!.keyVerificationManager.cleanup();
}, skip: skip);
});
test('reject verification', () async {
FakeMatrixApi.calledEndpoints.clear();
@ -412,7 +412,7 @@ void main() async {
await client1.encryption!.keyVerificationManager.cleanup();
await client2.encryption!.keyVerificationManager.cleanup();
}, skip: skip);
});
test('reject sas', () async {
FakeMatrixApi.calledEndpoints.clear();
@ -488,7 +488,7 @@ void main() async {
await client1.encryption!.keyVerificationManager.cleanup();
await client2.encryption!.keyVerificationManager.cleanup();
}, skip: skip);
});
test('other device accepted', () async {
FakeMatrixApi.calledEndpoints.clear();
@ -536,11 +536,6 @@ void main() async {
'/client/v3/rooms/!1234%3AfakeServer.notExisting/send/m.key.verification.cancel'));
await client1.encryption!.keyVerificationManager.cleanup();
await client2.encryption!.keyVerificationManager.cleanup();
}, skip: skip);
// see https://github.com/dart-lang/test/issues/1698
test('KeyVerification dummy test', () async {
await Future.delayed(Duration(seconds: 1));
}, skip: skip != 'false' ? 'false' : 'No need for dummy');
});
}, skip: skip);
}

View File

@ -264,10 +264,5 @@ void main() {
if (!olmEnabled) return;
await client.dispose(closeDatabase: true);
});
// see https://github.com/dart-lang/test/issues/1698
test('KeyVerification dummy test', () async {
await Future.delayed(Duration(seconds: 1));
});
});
}

View File

@ -120,10 +120,5 @@ void main() {
if (!olmEnabled) return;
await client.dispose(closeDatabase: false);
});
// see https://github.com/dart-lang/test/issues/1698
test('KeyVerification dummy test', () async {
await Future.delayed(Duration(seconds: 1));
});
});
}

View File

@ -496,10 +496,5 @@ void main() {
if (!olmEnabled) return;
await client.dispose(closeDatabase: true);
});
// see https://github.com/dart-lang/test/issues/1698
test('KeyVerification dummy test', () async {
await Future.delayed(Duration(seconds: 1));
});
});
}

View File

@ -73,10 +73,5 @@ void main() {
expect(shrinkedImage.blurhash, 'L75NyU5kvvbx^7AF#kSgZxOZ%5NE',
reason: 'Unexpected scaled image blur');
});
// see https://github.com/dart-lang/test/issues/1698
test('KeyVerification dummy test', () async {
await Future.delayed(Duration(seconds: 1));
});
});
}

View File

@ -1662,10 +1662,5 @@ void main() {
expect(event.onlyEmotes, false);
expect(event.numberEmotes, 2);
});
// see https://github.com/dart-lang/test/issues/1698
test('KeyVerification dummy test', () async {
await Future.delayed(Duration(milliseconds: 400));
});
});
}

View File

@ -41,10 +41,5 @@ void main() {
expect(data.tryGet<Map<String, dynamic>>('pam')?.tryGet<String>('beep'),
null);
});
// see https://github.com/dart-lang/test/issues/1698
test('KeyVerification dummy test', () async {
await Future.delayed(Duration(milliseconds: 400));
});
});
}

View File

@ -65,10 +65,5 @@ void main() {
);
expect(matrixException.error, MatrixError.M_UNKNOWN);
});
// see https://github.com/dart-lang/test/issues/1698
test('KeyVerification dummy test', () async {
await Future.delayed(Duration(milliseconds: 400));
});
});
}