Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1079: Support ability to defer and delegate timing of an integration #1221

Closed
wants to merge 3 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1357,19 +1357,28 @@ void defer(TestInfo testInfo) throws IOException {
assertEquals(1, undeferred, "Missing undeferred message");
assertFalse(authorPr.labelNames().contains("deferred"));

erikj79 marked this conversation as resolved.
Show resolved Hide resolved
// Try integrating as another committer, which should fail since the PR is currently not deferred
var integratorPr = integrator.pullRequest(authorPr.id());
integratorPr.addComment("/integrate");
TestBotRunner.runPeriodicItems(mergeBot);
var nonAuthor = authorPr.comments().stream()
.filter(comment -> comment.body().contains("Only the author")
&& comment.body().contains("is allowed to issue the `integrate` command"))
.count();
assertEquals(1, nonAuthor, "Missing only author can integrate message");

// Defer again
authorPr.addComment("/integrate defer");
TestBotRunner.runPeriodicItems(mergeBot);
assertTrue(authorPr.labelNames().contains("deferred"));

// Try to issue /integrate with an invalid command for a non author
var integratorPr = integrator.pullRequest(authorPr.id());
integratorPr.addComment("/integrate auto");
TestBotRunner.runPeriodicItems(mergeBot);
var invalid = authorPr.comments().stream()
.filter(comment -> comment.body().contains("Only the author"))
.count();
assertEquals(1, invalid, "Missing error message");
assertEquals(2, invalid, "Missing error message");

// Try to integrate by committer
integratorPr.addComment("/integrate");
@@ -1382,14 +1391,15 @@ void defer(TestInfo testInfo) throws IOException {
var headHash = pushedRepo.resolve("HEAD").orElseThrow();
var headCommit = pushedRepo.commits(headHash.hex() + "^.." + headHash.hex()).asList().get(0);

// Author and committer should be the same
// Verify that the author and committer of the change are the correct users
// The number is implied from the order the add* methods of CensusBuilder were called above.
assertEquals("Generated Committer 1", headCommit.author().name());
assertEquals("integrationcommitter1@openjdk.java.net", headCommit.author().email());
assertEquals("Generated Committer 4", headCommit.committer().name());
assertEquals("integrationcommitter4@openjdk.java.net", headCommit.committer().email());
assertTrue(authorPr.labelNames().contains("integrated"));

// Ready label should have been removed
// Ready and deferred labels should have been removed
assertFalse(authorPr.labelNames().contains("ready"));
assertFalse(authorPr.labelNames().contains("deferred"));
}