Skip to content

Commit

Permalink
Include classes touched by parent for testing
Browse files Browse the repository at this point in the history
When deciding if a test should be re-run we should also re-run the test if class level methods touched the changed class.

Fixes #27821
  • Loading branch information
stuartwdouglas committed May 18, 2023
1 parent 5a2347f commit 0a9b721
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,20 @@
public class TestClassUsages implements Serializable {

private final Map<ClassAndMethod, Set<String>> classNames = new HashMap<>();
private final Map<String, Set<String>> classLevel = new HashMap<>();

public synchronized void updateTestData(String currentclass, UniqueId test, Set<String> touched) {
classNames.put(new ClassAndMethod(currentclass, test), touched);
Set<String> aggregate = touched;
var extra = classLevel.get(currentclass);
if (extra != null) {
aggregate.addAll(extra);
}
classNames.put(new ClassAndMethod(currentclass, test), aggregate);
}

public synchronized void updateTestData(String currentclass, Set<String> touched) {
classNames.put(new ClassAndMethod(currentclass, null), touched);
classLevel.put(currentclass, touched);
}

public synchronized void merge(TestClassUsages newData) {
Expand Down

0 comments on commit 0a9b721

Please sign in to comment.