You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just got this test failure when working on unrelated code (#683):
Running test...
00:10 +1123 ~6: /Users/chrisbobbe/dev/zulip-flutter/test/notifications/display_test.dart: NotificationDisplayManager open find account among several
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following AccountAlreadyExistsException was thrown running a test:
Instance of 'AccountAlreadyExistsException'
When the exception was thrown, this was the stack:
#0 TestGlobalStore.doInsertAccount (file:///Users/chrisbobbe/dev/zulip-flutter/test/model/test_store.dart:101:7)
#1 GlobalStore.insertAccount (package:zulip/model/store.dart:180:27)
#2 TestGlobalStore.add (file:///Users/chrisbobbe/dev/zulip-flutter/test/model/test_store.dart:84:11)
#3 main.<anonymous closure>.<anonymous closure> (file:///Users/chrisbobbe/dev/zulip-flutter/test/notifications/display_test.dart:900:39)
<asynchronous suspension>
#4 testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:189:15)
<asynchronous suspension>
#5 TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:1027:5)
<asynchronous suspension>
<asynchronous suspension>
(elided one frame from package:stack_trace)
The test description was:
find account among several
════════════════════════════════════════════════════════════════════════════════════════════════════
00:10 +1123 ~6 -1: /Users/chrisbobbe/dev/zulip-flutter/test/notifications/display_test.dart: NotificationDisplayManager open find account among several [E]
Test failed. See exception logs above.
The test description was: find account among several
To run this test again: /Users/chrisbobbe/.local/lib/flutter/bin/cache/dart-sdk/bin/dart test /Users/chrisbobbe/dev/zulip-flutter/test/notifications/display_test.dart -p vm --plain-name 'NotificationDisplayManager open find account among several'
The bug is in the way we auto-generate email addresses for example User objects:
/// A random email address, different from previously generated ones.String_nextEmail() =>'mail${_lastEmailSuffix += Random().nextInt(1000)}@example.com';
int _lastEmailSuffix =1000;
If that Random().nextInt(1000) comes up with zero, then this email address will match the previous email address. That's what happened in the notifications test code, which failed on trying to add accounts for two users with the same email address:
final user1 = eg.user();
final user2 = eg.user();
final accounts = [
eg.account(id:1001, realmUrl: realmUrlA, user: user1),
eg.account(id:1002, realmUrl: realmUrlA, user: user2),
eg.account(id:1003, realmUrl: realmUrlB, user: user1),
eg.account(id:1004, realmUrl: realmUrlB, user: user2),
];
for (final account in accounts) {
await testBinding.globalStore.add(account, eg.initialSnapshot());
}
I just got this test failure when working on unrelated code (#683):
The bug is in the way we auto-generate email addresses for example
User
objects:If that
Random().nextInt(1000)
comes up with zero, then this email address will match the previous email address. That's what happened in the notifications test code, which failed on trying to add accounts for two users with the same email address:Here's the fix:
(which I see is already what
_nextUserId
,_nextStreamId
, and_nextMessageId
do).The text was updated successfully, but these errors were encountered: