Unverified Commit b9f013c0 authored by Dan Field's avatar Dan Field Committed by GitHub

Make sure test reporter prints out stderr, and disables Bigquery for non-contributors (#29073)

* print stderr to stderr, no bq if not contributor

* let test continue of bigquery fails
parent 837b330f
......@@ -129,9 +129,16 @@ class FlutterCompactFormatter {
}
break;
case 'error':
final String error = decoded['error'];
final String stackTrace = decoded['stackTrace'];
if (originalResult != null) {
originalResult.errorMessage = decoded['error'];
originalResult.stackTrace = decoded['stackTrace'];
originalResult.errorMessage = error;
originalResult.stackTrace = stackTrace;
} else {
if (error != null)
stderr.writeln(error);
if (stackTrace != null)
stderr.writeln(stackTrace);
}
break;
case 'print':
......
......@@ -50,6 +50,7 @@ Stream<String> runAndGetStdout(String executable, List<String> arguments, {
environment: environment,
);
stderr.addStream(process.stderr);
final Stream<String> lines = process.stdout.transform(utf8.decoder).transform(const LineSplitter());
await for (String line in lines) {
yield line;
......
......@@ -148,17 +148,24 @@ Future<void> _runSmokeTests() async {
Future<bq.BigqueryApi> _getBigqueryApi() async {
// TODO(dnfield): How will we do this on LUCI?
final String privateKey = Platform.environment['GCLOUD_SERVICE_ACCOUNT_KEY'];
if (privateKey == null || privateKey.isEmpty) {
// If we're on Cirrus and a non-collaborator is doing this, we can't get the key.
if (privateKey == null || privateKey.isEmpty || privateKey.startsWith('ENCRYPTED[')) {
return null;
}
try {
final auth.ServiceAccountCredentials accountCredentials = auth.ServiceAccountCredentials( //.fromJson(credentials);
'flutter-ci-test-reporter@flutter-infra.iam.gserviceaccount.com',
auth.ClientId.serviceAccount('114390419920880060881.apps.googleusercontent.com'),
'-----BEGIN PRIVATE KEY-----\n$privateKey\n-----END PRIVATE KEY-----\n',
);
final List<String> scopes = <String>[bq.BigqueryApi.BigqueryInsertdataScope];
final http.Client client = await auth.clientViaServiceAccount(accountCredentials, scopes);
return bq.BigqueryApi(client);
} catch (e) {
print('Failed to get BigQuery API client.');
print(e);
return null;
}
final auth.ServiceAccountCredentials accountCredentials = auth.ServiceAccountCredentials( //.fromJson(credentials);
'flutter-ci-test-reporter@flutter-infra.iam.gserviceaccount.com',
auth.ClientId.serviceAccount('114390419920880060881.apps.googleusercontent.com'),
'-----BEGIN PRIVATE KEY-----\n$privateKey\n-----END PRIVATE KEY-----\n',
);
final List<String> scopes = <String>[bq.BigqueryApi.BigqueryInsertdataScope];
final http.Client client = await auth.clientViaServiceAccount(accountCredentials, scopes);
return bq.BigqueryApi(client);
}
Future<void> _runToolTests() async {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment