Extend test runner command to update test flaky status (#86513)
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:args/command_runner.dart';
|
||||
|
||||
import '../framework/cocoon.dart';
|
||||
|
||||
class UploadMetricsCommand extends Command<void> {
|
||||
UploadMetricsCommand() {
|
||||
argParser.addOption('results-file', help: 'Test results JSON to upload to Cocoon.');
|
||||
argParser.addOption(
|
||||
'service-account-token-file',
|
||||
help: 'Authentication token for uploading results.',
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String get name => 'upload-metrics';
|
||||
|
||||
@override
|
||||
String get description => '[Flutter infrastructure] Upload metrics data to Cocoon';
|
||||
|
||||
@override
|
||||
Future<void> run() async {
|
||||
final String resultsPath = argResults!['results-file'] as String;
|
||||
final String? serviceAccountTokenFile = argResults!['service-account-token-file'] as String?;
|
||||
|
||||
final Cocoon cocoon = Cocoon(serviceAccountTokenPath: serviceAccountTokenFile);
|
||||
return cocoon.sendResultsPath(resultsPath);
|
||||
}
|
||||
}
|
||||
50
dev/devicelab/lib/command/upload_results.dart
Normal file
50
dev/devicelab/lib/command/upload_results.dart
Normal file
@@ -0,0 +1,50 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:args/command_runner.dart';
|
||||
|
||||
import '../framework/cocoon.dart';
|
||||
|
||||
class UploadResultsCommand extends Command<void> {
|
||||
UploadResultsCommand() {
|
||||
argParser.addOption('results-file', help: 'Test results JSON to upload to Cocoon.');
|
||||
argParser.addOption(
|
||||
'service-account-token-file',
|
||||
help: 'Authentication token for uploading results.',
|
||||
);
|
||||
argParser.addOption('test-flaky', help: 'Flag to show whether the test is flaky');
|
||||
argParser.addOption(
|
||||
'git-branch',
|
||||
help: '[Flutter infrastructure] Git branch of the current commit. LUCI\n'
|
||||
'checkouts run in detached HEAD state, so the branch must be passed.',
|
||||
);
|
||||
argParser.addOption('luci-builder', help: '[Flutter infrastructure] Name of the LUCI builder being run on.');
|
||||
argParser.addOption('test-status', help: 'Test status: Succeeded|Failed');
|
||||
}
|
||||
|
||||
@override
|
||||
String get name => 'upload-metrics';
|
||||
|
||||
@override
|
||||
String get description => '[Flutter infrastructure] Upload results data to Cocoon';
|
||||
|
||||
@override
|
||||
Future<void> run() async {
|
||||
final String? resultsPath = argResults!['results-file'] as String?;
|
||||
final String? serviceAccountTokenFile = argResults!['service-account-token-file'] as String?;
|
||||
final bool? isTestFlaky = argResults!['test-flaky'] as bool?;
|
||||
final String? gitBranch = argResults!['git-branch'] as String?;
|
||||
final String? builderName = argResults!['luci-builder'] as String?;
|
||||
final String? testStatus = argResults!['test-status'] as String?;
|
||||
|
||||
final Cocoon cocoon = Cocoon(serviceAccountTokenPath: serviceAccountTokenFile);
|
||||
return cocoon.sendResultsPath(
|
||||
resultsPath: resultsPath,
|
||||
isTestFlaky: isTestFlaky,
|
||||
gitBranch: gitBranch,
|
||||
builderName: builderName,
|
||||
testStatus: testStatus,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user