Skip to content

Commit abd72ae

Browse files
author
ron
committed
workaround for integration_test running 2x flutter/flutter#67090. There is a LOT of extra work being done because
of this, all useless. Luckily, only current impact is to protect writing cePEQSummary so it does not appear twice in dynamo.
1 parent cb83276 commit abd72ae

10 files changed

Lines changed: 43 additions & 72 deletions

File tree

‎ceFlutter/integration_test/project_test.dart‎

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ https://github.com/flutter/flutter/wiki/Running-Flutter-Driver-tests-with-Web
1818
*/
1919
// check app_state.. that'd be good..
2020
// https://blog.gskinner.com/archives/2021/06/flutter-a-deep-dive-into-integration_test-library.html
21+
// https://github.com/flutter/flutter/tree/master/packages/flutter/test/material
2122

2223
// Gold standard for testing ingest and summary frame for ariCETester/ceFlutterTester
2324
// XXX Category should show ["7,000,000", "12,840", "2,500", "11,001"] in ceFlutter
@@ -534,10 +535,8 @@ void main() {
534535

535536
final Finder ariLink = find.byKey( Key( repo ));
536537
await tester.tap( ariLink );
537-
print( "pumping" );
538-
await tester.pumpAndSettle( Duration( seconds: 5 ));
539-
print( "pumping" );
540-
await tester.pumpAndSettle( Duration( seconds: 3 ));
538+
await pumpSettle( tester, 5, verbose: true );
539+
await pumpSettle( tester, 3, verbose: true );
541540

542541
expect( await verifyOnProjectPage( tester ), true );
543542

@@ -568,20 +567,16 @@ void main() {
568567

569568
final Finder ariLink = find.byKey( Key( repo ));
570569
await tester.tap( ariLink );
571-
print( "pumping" );
572-
await tester.pumpAndSettle( Duration( seconds: 5 ));
573-
print( "pumping" );
574-
await tester.pumpAndSettle( Duration( seconds: 3 ));
570+
await pumpSettle( tester, 5, verbose: true );
571+
await pumpSettle( tester, 3, verbose: true );
575572

576573
expect( await verifyEmptyProjectPage( tester ), true );
577574

578575
final Finder updateButton = find.byKey( const Key( 'Update PEQ Summary?' ));
579576
expect( updateButton, findsOneWidget );
580577
await tester.tap( updateButton );
581-
print( "Long pump" );
582-
await pumpSettle( tester, 85 );
583-
print( "short pump" );
584-
await pumpSettle( tester, 4 );
578+
await pumpSettle( tester, 85, verbose: true );
579+
await pumpSettle( tester, 4, verbose: true );
585580

586581
// Make sure it all shows up
587582
expect( await peqSummaryTabFraming( tester ), true );
@@ -591,7 +586,7 @@ void main() {
591586
await logout( tester );
592587

593588
report( 'Project contents, ingest' );
594-
});
589+
}, semanticsEnabled: false );
595590

596591
testWidgets('Project frame coherence', skip:skip, (WidgetTester tester) async {
597592

@@ -603,10 +598,8 @@ void main() {
603598

604599
final Finder ariLink = find.byKey( Key( repo ));
605600
await tester.tap( ariLink );
606-
print( "pumping" );
607-
await tester.pumpAndSettle( Duration( seconds: 5 ));
608-
print( "pumping" );
609-
await tester.pumpAndSettle( Duration( seconds: 3 ));
601+
await pumpSettle( tester, 5, verbose: true );
602+
await pumpSettle( tester, 3, verbose: true );
610603

611604
expect( await verifyOnProjectPage( tester ), true );
612605

‎ceFlutter/integration_test/utils.dart‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ Future<bool> restart( WidgetTester tester ) async {
4444

4545
// pumpAndSettle interacts poorly with drag (and maybe others?) as of 5/2022.
4646
// When a duration is included, the test exits early.
47-
Future<bool> pumpSettle( WidgetTester tester, int delaySecs ) async {
47+
Future<bool> pumpSettle( WidgetTester tester, int delaySecs, {bool verbose = false} ) async {
4848

49+
if( verbose ) { print( "pumping, delay: " + delaySecs.toString() ); }
4950
await tester.pumpAndSettle();
5051
await Future.delayed(Duration(seconds: delaySecs));
5152
await tester.pumpAndSettle();

‎ceFlutter/lib/app_state_container.dart‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ class _AppStateContainerState extends State<AppStateContainer> {
198198
state.attributeController.dispose();
199199
state.confirmationCodeController.dispose();
200200
super.dispose();
201+
print( "Container dispose" );
201202
}
202203

203204

‎ceFlutter/lib/ingest.dart‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,18 +1082,9 @@ Future<void> updatePEQAllocations( repoName, context, container ) async {
10821082
print( "Ingest todos finished processing. Update Dynamo." );
10831083
// XXX Skip this if no change (say, on a series of notices).
10841084
if( appState.myPEQSummary != null ) {
1085-
10861085
String psum = json.encode( appState.myPEQSummary );
10871086
String postData = '{ "Endpoint": "PutPSum", "NewPSum": $psum }';
10881087
await updateDynamo( context, container, postData, "PutPSum" );
1089-
1090-
// XXX Integration testing causes 2 writes to dynamo per update. psum.id is rebuilt as part of that(!)
1091-
// Leave this in place until integration testing framework is fixed. See 6/2022 bug.
1092-
// XXX the testing fwk writes second summary after 3 seconds. Crazy.
1093-
print( "XXX waiting 5s for integration test fwk to finish being bad" );
1094-
await Future.delayed(Duration(seconds: 5));
1095-
print( "XXX done" );
1096-
await cleanSummary( context, container );
10971088
}
10981089

10991090
// unlock, set ingested

‎ceFlutter/lib/main.dart‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class _CESplashPageState extends State<CESplashPage> {
6969
@override
7070
void dispose() {
7171
super.dispose();
72+
print( "Main dispose" );
7273
}
7374

7475
void _startTimer( attempts ) {

‎ceFlutter/lib/screens/login_page.dart‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class _CELoginState extends State<CELoginPage> {
3030
@override
3131
void dispose() {
3232
super.dispose();
33+
print( "LP Disposessed!" );
3334
}
3435

3536

‎ceFlutter/lib/screens/project_page.dart‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class _CEProjectState extends State<CEProjectPage> {
3939
@override
4040
void dispose() {
4141
super.dispose();
42+
print( "PP Disposessed!" );
4243
}
4344

4445

‎ceFlutter/lib/utils_load.dart‎

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -215,44 +215,6 @@ Future<String> fetchString( context, container, postData, shortName ) async {
215215
}
216216
}
217217

218-
// XXX workaround, related to ingest integration testing framework bug 6/2022
219-
Future<bool> cleanSummary( context, container ) async {
220-
final appState = container.state;
221-
bool retVal = false;
222-
223-
print( "In cleanSummary" );
224-
225-
var shortName = "GetEntries";
226-
var postData = {"Endpoint": shortName, "tableName": "CEPEQSummary", "query": {"GHRepo": appState.myPEQSummary.ghRepo} };
227-
var response = await postIt( shortName, json.encode( postData ), container );
228-
229-
if (response.statusCode == 201) {
230-
//print( utf8.decode(response.bodyBytes ) );
231-
final summaries = json.decode(utf8.decode(response.bodyBytes));
232-
233-
// Repair dup from testing fwk. Just keep 1.
234-
print( "Summary count: " + summaries.length.toString() );
235-
assert( summaries.length == 1 || summaries.length == 2 );
236-
if( summaries.length > 1 ) {
237-
final badId = summaries[0]["PEQSummaryId"] == appState.myPEQSummary.id ? summaries[1]["PEQSummaryId"] : summaries[0]["PEQSummaryId"];
238-
239-
shortName = "RemoveEntries";
240-
postData = {"Endpoint": shortName, "tableName": "CEPEQSummary", "ids": [[badId]] };
241-
response = await postIt( shortName, json.encode( postData ), container );
242-
243-
if (response.statusCode == 201) { retVal = true; }
244-
}
245-
else { retVal = true; }
246-
}
247-
248-
if( !retVal ) {
249-
bool didReauth = await checkFailure( response, shortName, context, container );
250-
if( didReauth ) { return await cleanSummary( context, container ); }
251-
}
252-
253-
return retVal;
254-
}
255-
256218
// This is primarily an ingest utility.
257219
Future<bool> updateDynamo( context, container, postData, shortName, { peqId = -1 } ) async {
258220
final appState = container.state;

‎ceFlutter/testCEFlutter.py‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,6 @@ def runTest( testName, override, noBuild = True, optimized = False ):
128128
tmpSum = "\n"
129129
tmpSum += runCmd( cmd, grepFilter )
130130

131-
# XXX As of 5/2022, new chrome interacts poorly with Ubuntu. Bash is losing it's mind after a test, basically locking terminal.
132-
# reset in-between cmds helps. Lin only. Slows things down.
133-
# cmd = "/usr/bin/reset"
134-
#runCmd( cmd, [] )
135-
136131
return tmpSum
137132

138133

‎ops/aws/lambdaHandlers/awsDynamo.js‎

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,9 +1082,34 @@ async function updateColProj( update ) {
10821082

10831083

10841084

1085-
// Overwrites any existing record
1085+
// Overwrites any existing record by ID.
1086+
// XXX Due to https://github.com/flutter/flutter/issues/67090, if repo exists already but with different id, don't write.
10861087
async function putPSum( psum ) {
1088+
1089+
// XXX START workaround: Remove this once issue 67090 is resolved
10871090
const params = {
1091+
TableName: 'CEPEQSummary',
1092+
FilterExpression: 'GHRepo = :ghr',
1093+
ExpressionAttributeValues: { ":ghr": psum.ghRepo },
1094+
Limit: 99,
1095+
};
1096+
let gPromise = paginatedScan( params );
1097+
let skip = false;
1098+
await gPromise.then((ps) => {
1099+
for( const eps of ps ) {
1100+
if( eps.PEQSummaryId != psum.id ) {
1101+
// Oops. We have an existing summary for repo with a different ID. Don't write this new, second copy.
1102+
assert( eps.Allocations.length == psum.allocations.length );
1103+
console.log( "Found duplicate repo, will not write current.", eps.PEQSummaryId.toString(), psum.id, psum.ghRepo, eps.Allocations.length.toString() );
1104+
skip = true;
1105+
}
1106+
1107+
}
1108+
});
1109+
if( skip ) { return success( true ); }
1110+
// XXX END
1111+
1112+
const paramsP = {
10881113
TableName: 'CEPEQSummary',
10891114
Item: {
10901115
"PEQSummaryId": psum.id,
@@ -1098,7 +1123,7 @@ async function putPSum( psum ) {
10981123

10991124
console.log( "PEQSummary put", psum.id.toString());
11001125

1101-
let promise = bsdb.put( params ).promise();
1126+
let promise = bsdb.put( paramsP ).promise();
11021127
return promise.then(() => success( true ));
11031128
}
11041129

0 commit comments

Comments
 (0)