Skip to content

Conversation

@keyonghan
Copy link
Contributor

@keyonghan keyonghan commented Jul 28, 2021

This PR uses cocoon's existing functionality to obtain ownership data based on builder configs defined in .ci.yaml, and creates a support to validate test ownership.

This PR also adds support for Firebaselab tests.

A companion recipe change: https://flutter-review.googlesource.com/c/recipes/+/16300.

This is part of flutter/flutter#87144

@google-cla google-cla bot added the cla: yes label Jul 28, 2021
@chunhtai
Copy link
Contributor

One thing I am worry about this approach is that is may be a pain to migrate TESTOWNERS format, also one can break the presubmit by changing the script without knowing.

Otherwise it looks good

@keyonghan
Copy link
Contributor Author

One thing I am worry about this approach is that is may be a pain to migrate TESTOWNERS format, also one can break the presubmit by changing the script without knowing.

That's true, but I don't think we have a short plan to finish ownership info for shards tests or any big format migration. On the other hand, we have seen people adding tests without adding ownership over time, which causes pain to the infra team.

The main reason I put it under cocoon is we can extend the functionality to support other repos in the future. One way to avoid any unknown breakage is put it under flutter/<repo>, but we need separate supports for different repos and need to maintain multiple set of codes.

For now, I added more unit tests for other types to cover all scenarios to try avoiding breakage change from cocoon side without knowing.

We need to revisit the logic when we have ownership for shard tests, or when we expand the logic to other repos.

Copy link
Contributor

@CaseyHillers CaseyHillers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to Chun-Heng's comment about testability. You should add an integration test that ensures this is testing the tip of tree to prevent breakages landing here

Future<List<String>> remoteCheck(String repo, String ref) async {
final HttpClient client = HttpClient();
final Uri ciYamlUrl = Uri.https('raw.githubusercontent.com', 'flutter/$repo/$ref/.ci.yaml');
final HttpClientRequest ciYamlRequest = await client.getUrl(ciYamlUrl);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the other bin scripts get ciYaml from a network request. Should we refactor this into a utility so they can all share that logic?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used existing utils function instead. Also updated bing/generate_jspb.dart.

+1 to Chun-Heng's comment about testability. You should add an integration test that ensures this is testing the tip of tree to prevent breakages landing here

https://flutter-review.googlesource.com/c/recipes/+/16300 is ready to accept trigger from cocoon. Will create a new builder once the recipe cl is in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't know we have integration tests here. Just created one instead.

import 'dart:convert';
import 'dart:io';

import 'package:cocoon_service/src/request_handlers/flaky_handler_utils.dart';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move some the getTestowner code out to a more generic util file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to do that in a separate PR.


import '../../protos.dart';
import '../foundation/typedefs.dart';
import '../request_handlers/flaky_handler_utils.dart';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is weird dependency, I will probably move the methods here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I know, but don't wanna to make this PR too complex.
Created flutter/flutter#87287 to refactor.

}
break;
}
case BuilderType.firebaselab:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not related to this pr, Do we want to file mark flaky pr for firebaselab test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about that, but i guess we still want to have ownership for those tests.

Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


for (final String line in lines) {
final List<String> words = line.trim().split(' ');
// e.g. words = ['/xxx/xxx/xxx_test.dart', '@stuartmorgan' '@flutter/tool']
Copy link
Contributor

@chunhtai chunhtai Jul 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This does not seem like a good example

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed as this is not necessary here.

@keyonghan keyonghan added the waiting for tree to go green Merge PR when tree becomes green via fluttergithubbot label Jul 29, 2021
@fluttergithubbot fluttergithubbot merged commit 658457f into flutter:master Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting for tree to go green Merge PR when tree becomes green via fluttergithubbot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants