-
Notifications
You must be signed in to change notification settings - Fork 275
Closed
Description
Took another stab at upgrading off rxdart 0.23.1, but unfortunately still getting some failing tests. Here's a repro/comparison (could probably be minimized further but not sure which parts are relevant).
import 'package:meta/meta.dart';
import 'package:moor/ffi.dart';
import 'package:moor/moor.dart';
import 'package:rxdart/rxdart.dart';
import 'package:test/test.dart';
class TestDb extends GeneratedDatabase {
TestDb() : super(SqlTypeSystem.withDefaults(), VmDatabase.memory());
@override final List<TableInfo> allTables = const [];
@override final int schemaVersion = 1;
}
Future<void> testCase({
@required Stream<int> Function() createOuter,
@required Stream<int> Function() createInner,
}) async {
final log = <int>[];
final timeout = Duration(milliseconds: 100);
final a = createOuter();
final b = a.switchMap((_) => createInner());
b.listen(log.add);
await b.first.then(log.add)
.timeout(timeout, onTimeout: () => fail('1st should complete'));
expect(log, [2, 2]);
b.listen(log.add);
await b.first.then(log.add)
.timeout(timeout, onTimeout: () => fail('2nd should complete'));
expect(log, [2, 2, 2, 2]);
}
void main() {
group('rxdart upgrade', () {
test("moor", () async {
final db = TestDb();
Stream<int> selectInt(int i) => db
.customSelect('select $i a')
.map((row) => row.read<int>('a'))
.watchSingle();
await testCase(
createOuter: () => selectInt(1),
createInner: () => selectInt(2),
);
});
test("rxdart", () async {
final outer = BehaviorSubject<int>();
final tc = testCase(
createOuter: () => outer,
createInner: () {
final inner = BehaviorSubject<int>();
Future.delayed(Duration(milliseconds: 10)).then((_) => inner.add(2));
return inner;
}
);
await Future.delayed(Duration(milliseconds: 10));
outer.add(1);
await tc;
});
});
}- rxdart 0.23.1: Both tests pass
- rxdart 0.24.0 and 0.24.1: Both tests fail with "2nd should complete"
- rxdart 0.25.0, 0.26.0, and 0.27.0: Only the moor test fails
- All the tests were done with moor 4.3.1, but I also spot checked moor 3.4.0 + rxdart 0.27.0 and I get the same result.
Since this began after upgrading rxdart I've started by creating an issue here, but @simolus3 might be able to help determine if this is a moor bug.
#477 and #500 might have some context from the last time we tried to upgrade off rxdart 0.23.1.
I looked around for similar issues since last time and came #511 looks similar. The 1st repro in that issue still times out with rxdart 0.27.0, even though the 2nd repro looks fixed.
Metadata
Metadata
Assignees
Labels
No labels