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 { ...@@ -129,9 +129,16 @@ class FlutterCompactFormatter {
} }
break; break;
case 'error': case 'error':
final String error = decoded['error'];
final String stackTrace = decoded['stackTrace'];
if (originalResult != null) { if (originalResult != null) {
originalResult.errorMessage = decoded['error']; originalResult.errorMessage = error;
originalResult.stackTrace = decoded['stackTrace']; originalResult.stackTrace = stackTrace;
} else {
if (error != null)
stderr.writeln(error);
if (stackTrace != null)
stderr.writeln(stackTrace);
} }
break; break;
case 'print': case 'print':
......
...@@ -50,6 +50,7 @@ Stream<String> runAndGetStdout(String executable, List<String> arguments, { ...@@ -50,6 +50,7 @@ Stream<String> runAndGetStdout(String executable, List<String> arguments, {
environment: environment, environment: environment,
); );
stderr.addStream(process.stderr);
final Stream<String> lines = process.stdout.transform(utf8.decoder).transform(const LineSplitter()); final Stream<String> lines = process.stdout.transform(utf8.decoder).transform(const LineSplitter());
await for (String line in lines) { await for (String line in lines) {
yield line; yield line;
......
...@@ -148,9 +148,11 @@ Future<void> _runSmokeTests() async { ...@@ -148,9 +148,11 @@ Future<void> _runSmokeTests() async {
Future<bq.BigqueryApi> _getBigqueryApi() async { Future<bq.BigqueryApi> _getBigqueryApi() async {
// TODO(dnfield): How will we do this on LUCI? // TODO(dnfield): How will we do this on LUCI?
final String privateKey = Platform.environment['GCLOUD_SERVICE_ACCOUNT_KEY']; 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; return null;
} }
try {
final auth.ServiceAccountCredentials accountCredentials = auth.ServiceAccountCredentials( //.fromJson(credentials); final auth.ServiceAccountCredentials accountCredentials = auth.ServiceAccountCredentials( //.fromJson(credentials);
'flutter-ci-test-reporter@flutter-infra.iam.gserviceaccount.com', 'flutter-ci-test-reporter@flutter-infra.iam.gserviceaccount.com',
auth.ClientId.serviceAccount('114390419920880060881.apps.googleusercontent.com'), auth.ClientId.serviceAccount('114390419920880060881.apps.googleusercontent.com'),
...@@ -159,6 +161,11 @@ Future<bq.BigqueryApi> _getBigqueryApi() async { ...@@ -159,6 +161,11 @@ Future<bq.BigqueryApi> _getBigqueryApi() async {
final List<String> scopes = <String>[bq.BigqueryApi.BigqueryInsertdataScope]; final List<String> scopes = <String>[bq.BigqueryApi.BigqueryInsertdataScope];
final http.Client client = await auth.clientViaServiceAccount(accountCredentials, scopes); final http.Client client = await auth.clientViaServiceAccount(accountCredentials, scopes);
return bq.BigqueryApi(client); return bq.BigqueryApi(client);
} catch (e) {
print('Failed to get BigQuery API client.');
print(e);
return null;
}
} }
Future<void> _runToolTests() async { 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