Skip to content

Commit 74f83a1

Browse files
authored
fix: use correct issue link on flaky suppression (#4980)
- bonus: update melos script to fetch all (including no-pub workspace) dart packages fixes: flutter/flutter#183518
1 parent ad73c50 commit 74f83a1

5 files changed

Lines changed: 59 additions & 6 deletions

File tree

app_dart/lib/src/request_handlers/file_flaky_issue_and_pr.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ final class FileFlakyIssueAndPR extends ApiRequestHandler {
159159
testName: builderDetail.statistic.name,
160160
email: 'fluttergithubbot',
161161
repository: slug,
162+
issueLink: issue.htmlUrl,
162163
action: SuppressingAction.suppress,
163164
note: 'flaky test rate: $threshold',
164165
);

app_dart/lib/src/service/test_suppression.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ class TestSuppression {
102102
final newSuppression = SuppressedTest(
103103
name: testName,
104104
repository: repository.fullName,
105-
issueLink: issueLink ?? 'BUG',
105+
issueLink:
106+
issueLink ??
107+
'BUG: You have found a bug! Please report to https://www.github.com/flutter/flutter/issues/new',
106108
isSuppressed: true,
107109
createTimestamp: now,
108110
updates: [updateEntry],

app_dart/test/request_handlers/file_flaky_issue_and_pr_test.dart

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ void main() {
229229
.hasTestName('Mac_android android_semantics_integration_test')
230230
.hasRepository('flutter/flutter')
231231
.hasIsSuppressed(isTrue)
232+
.hasIssueLink(expectedSemanticsIntegrationTestNewIssueURL)
232233
.hasUpdates([
233234
{
234235
'user': 'fluttergithubbot',
@@ -395,6 +396,10 @@ void main() {
395396
);
396397
expect(suppressed.length, 1);
397398
expect(suppressed[0].testName, 'Linux analyze');
399+
expect(
400+
suppressed[0].issueLink,
401+
expectedSemanticsIntegrationTestNewIssueURL,
402+
);
398403

399404
expect(result['Status'], 'success');
400405
},
@@ -435,6 +440,17 @@ void main() {
435440
final issueRequest = captured[1] as IssueRequest;
436441
expect(issueRequest.body, expectedLimitedNumberOfBuildsResponseBody);
437442

443+
// Verify suppression
444+
final suppressed = await SuppressedTest.getSuppressedTests(
445+
firestore,
446+
'flutter/flutter',
447+
);
448+
expect(suppressed.length, 1);
449+
expect(
450+
suppressed[0].issueLink,
451+
expectedSemanticsIntegrationTestNewIssueURL,
452+
);
453+
438454
expect(result['Status'], 'success');
439455
},
440456
);
@@ -482,6 +498,10 @@ void main() {
482498
'flutter/flutter',
483499
);
484500
expect(suppressed.length, 1);
501+
expect(
502+
suppressed[0].issueLink,
503+
expectedSemanticsIntegrationTestNewIssueURL,
504+
);
485505

486506
expect(result['Status'], 'success');
487507
});

app_dart/test/request_handlers/update_suppressed_test_test.dart

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,34 @@ void main() {
378378
);
379379
expect(isSuppressed, isFalse);
380380
});
381+
382+
test('TestSuppression uses default bug link if issueLink is null', () async {
383+
final suppression = TestSuppression(
384+
firestore: firestore,
385+
cache: cache,
386+
now: () => fakeNow,
387+
);
388+
await suppression.updateSuppression(
389+
testName: 'my_test',
390+
email: 'test@example.com',
391+
repository: RepositorySlug('flutter', 'flutter'),
392+
action: SuppressingAction.suppress,
393+
note: 'test note',
394+
issueLink: null,
395+
);
396+
397+
// Verify document created with default bug link
398+
expect(
399+
firestore,
400+
existsInStorage(SuppressedTest.metadata, [
401+
isSuppressedTest
402+
.hasIssueLink(
403+
'BUG: You have found a bug! Please report to https://www.github.com/flutter/flutter/issues/new',
404+
)
405+
.hasTestName('my_test'),
406+
]),
407+
);
408+
});
381409
}
382410

383411
class FakeGithubServiceWithIssue extends FakeGithubService {

pubspec.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ melos:
3737
dev_dependencies:
3838
test: any
3939
scripts:
40+
# If you're using a worktree, this is helpful to remove missing package warnings
41+
pub-get:
42+
steps:
43+
- flutter pub get
44+
- cd cipd_packages/codesign; dart pub get
45+
- cd ../device_doctor; dart pub get
46+
4047
lint:all:
4148
steps:
4249
- analyze
@@ -57,11 +64,6 @@ melos:
5764
run: melos exec dart format . --set-exit-if-changed
5865
description: Run `dart format` checks for all packages.
5966

60-
pub-get:
61-
steps:
62-
- melos exec --no-flutter -- "dart pub get"
63-
- melos exec --flutter -- "flutter pub get"
64-
6567
upgrade: melos exec flutter pub upgrade
6668

6769
test:

0 commit comments

Comments
 (0)