Skip to content

Commit

Permalink
Update/add flake bot labels (#2942)
Browse files Browse the repository at this point in the history
  • Loading branch information
keyonghan authored Jul 20, 2023
1 parent dcdd9af commit 43fb69c
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 21 deletions.
43 changes: 26 additions & 17 deletions app_dart/lib/src/request_handlers/flaky_handler_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@ import '../../protos.dart' as pb;

// String constants.
const String kFlakeLabel = 'c: flake';
const String kFrameworkLabel = 'framework';
const String kToolLabel = 'tool';
const String kEngineLabel = 'engine';
const String kWebLabel = 'platform-web';
const String kFrameworkLabel = 'team-framework';
const String kToolLabel = 'team-tool';
const String kEngineLabel = 'team-engine';
const String kWebLabel = 'team-web';
const String kInfraLabel = 'team-infra';
const String kAndroidLabel = 'team-android';
const String kIosLabel = 'team-ios';
const String kReleaseLabel = 'team-release';
const String kEcosystemLabel = 'team-ecosystem';
const String kP0Label = 'P0';
const String kP1Label = 'P1';
const String kP2Label = 'P2';
Expand Down Expand Up @@ -408,19 +413,18 @@ String _issueBuilderLink(String? builder) {
}

String? getTeamLabelFromTeam(Team? team) {
switch (team) {
case Team.framework:
return kFrameworkLabel;
case Team.engine:
return kEngineLabel;
case Team.tool:
return kToolLabel;
case Team.web:
return kWebLabel;
case Team.unknown:
case null:
return null;
}
return switch (team) {
Team.framework => kFrameworkLabel,
Team.engine => kEngineLabel,
Team.tool => kToolLabel,
Team.web => kWebLabel,
Team.infra => kInfraLabel,
Team.android => kAndroidLabel,
Team.ios => kIosLabel,
Team.release => kReleaseLabel,
Team.plugins => kEcosystemLabel,
Team.unknown || null => null,
};
}

enum BuilderType {
Expand All @@ -441,6 +445,11 @@ enum Team {
engine,
tool,
web,
infra,
android,
ios,
release,
plugins,
unknown,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ void main() {
// Verify issue label is added correctly.
captured = verify(mockIssuesService.addLabelsToIssue(captureAny, captureAny, captureAny)).captured;
expect(captured.length, 3);
expect(captured[2], ['framework']);
expect(captured[2], ['team-framework']);

// Verify tree is created correctly.
captured = verify(mockGitService.createTree(captureAny, captureAny)).captured;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ const String expectedSemanticsIntegrationTestResponseAssignee = 'HansMuller';
const List<String> expectedSemanticsIntegrationTestResponseLabels = <String>[
'c: flake',
'P0',
'framework',
'team-framework',
];
const String expectedSemanticsIntegrationTestCiYamlContent = '''
# Describes the targets run in continuous integration environment.
Expand Down Expand Up @@ -342,7 +342,7 @@ const String expectedAnalyzeTestResponseAssignee = 'HansMuller';
const List<String> expectedAnalyzeTestResponseLabels = <String>[
'c: flake',
'P0',
'framework',
'team-framework',
];

final List<BuilderStatistic> frameworkTestResponse = <BuilderStatistic>[
Expand Down Expand Up @@ -374,7 +374,7 @@ const String expectedFrameworkTestResponseAssignee = 'HansMuller';
const List<String> expectedFrameworkTestResponseLabels = <String>[
'c: flake',
'P0',
'framework',
'team-framework',
];

String gitHubEncode(String source) {
Expand Down
9 changes: 9 additions & 0 deletions app_dart/test/request_handlers/flaky_handler_utiles_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,13 @@ abc_test.sh @ghi @flutter/framework
});
});
});
group('Gets team label', () {
test('returns correct label when matched', () async {
expect(getTeamLabelFromTeam(Team.infra), kInfraLabel);
});

test('returns null when not matched', () async {
expect(getTeamLabelFromTeam(Team.unknown), null);
});
});
}

0 comments on commit 43fb69c

Please sign in to comment.