Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip priority bump for already bringup true target in Flake Bot #3400

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class UpdateExistingFlakyIssue extends ApiRequestHandler<Body> {
GithubService gitHub,
RepositorySlug slug, {
required Bucket bucket,
required bool bringup,
required BuilderStatistic statistic,
required Issue existingIssue,
required CiYaml ciYaml,
Expand All @@ -97,6 +98,10 @@ class UpdateExistingFlakyIssue extends ApiRequestHandler<Body> {
final IssueUpdateBuilder updateBuilder =
IssueUpdateBuilder(statistic: statistic, threshold: _threshold, existingIssue: existingIssue, bucket: bucket);
await gitHub.createComment(slug, issueNumber: existingIssue.number, body: updateBuilder.issueUpdateComment);
// No need to bump priority and reassign if this is already marked as `bringup: true`.
if (bringup) {
return;
}
await gitHub.replaceLabelsForIssue(slug, issueNumber: existingIssue.number, labels: updateBuilder.issueLabels);
if (existingIssue.assignee == null && !updateBuilder.isBelow) {
final String testOwnerContent = await gitHub.getFileContent(
Expand Down Expand Up @@ -150,6 +155,7 @@ class UpdateExistingFlakyIssue extends ApiRequestHandler<Body> {
gitHub,
slug,
bucket: Bucket.prod,
bringup: builderFlakyMap[statistic.name]!,
statistic: statistic,
existingIssue: nameToExistingIssue[statistic.name]!,
ciYaml: ciYaml,
Expand All @@ -166,6 +172,7 @@ class UpdateExistingFlakyIssue extends ApiRequestHandler<Body> {
gitHub,
slug,
bucket: Bucket.staging,
bringup: builderFlakyMap[statistic.name]!,
statistic: statistic,
existingIssue: nameToExistingIssue[statistic.name]!,
ciYaml: ciYaml,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ void main() {
.single as Map<String, dynamic>;

// Verify comment is created correctly.
List<dynamic> captured = verify(mockIssuesService.createComment(captureAny, captureAny, captureAny)).captured;
final List<dynamic> captured =
verify(mockIssuesService.createComment(captureAny, captureAny, captureAny)).captured;
expect(captured.length, 6);
expect(captured[0].toString(), Config.flutterSlug.toString());
expect(captured[1], existingIssueNumber);
Expand All @@ -280,18 +281,14 @@ void main() {
expect(captured[4], existingIssueNumber);
expect(captured[5], expectedStagingCiyamlTestIssueComment);

// Verify labels are applied correctly.
captured = verify(
// Verify no labels are applied for already `bringup: true` target.
verifyNever(
mockGitHubClient.request(
captureAny,
captureAny,
body: captureAnyNamed('body'),
),
).captured;
expect(captured.length, 6);
expect(captured[0].toString(), 'PUT');
expect(captured[1], '/repos/${Config.flutterSlug.fullName}/issues/$existingIssueNumber/labels');
expect(captured[2], GitHubJson.encode(<String>['some random label', 'P0']));
);

expect(result['Status'], 'success');
});
Expand Down