AbstractQueryChangesTest: Add test coverage for destination: predicate
Bug: Issue 8604 Change-Id: Ie8d58511a95003a90869e5922f4792889d972bfd
This commit is contained in:
parent
c3c70c563b
commit
603c45636e
@ -2108,12 +2108,37 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
|
||||
|
||||
@Test
|
||||
public void userDestination() throws Exception {
|
||||
TestRepository<Repo> repo = createProject("repo");
|
||||
insert(repo, newChange(repo));
|
||||
TestRepository<Repo> repo1 = createProject("repo1");
|
||||
Change change1 = insert(repo1, newChange(repo1));
|
||||
TestRepository<Repo> repo2 = createProject("repo2");
|
||||
Change change2 = insert(repo2, newChange(repo2));
|
||||
|
||||
assertThatQueryException("destination:foo")
|
||||
.hasMessageThat()
|
||||
.isEqualTo("Unknown named destination: foo");
|
||||
|
||||
String destination1 = "refs/heads/master\trepo1";
|
||||
String destination2 = "refs/heads/master\trepo2";
|
||||
String destination3 = "refs/heads/master\trepo1\nrefs/heads/master\trepo2";
|
||||
String destination4 = "refs/heads/master\trepo3";
|
||||
String destination5 = "refs/heads/other\trepo1";
|
||||
|
||||
TestRepository<Repo> allUsers = new TestRepository<>(repoManager.openRepository(allUsersName));
|
||||
String refsUsers = RefNames.refsUsers(userId);
|
||||
allUsers.branch(refsUsers).commit().add("destinations/destination1", destination1).create();
|
||||
allUsers.branch(refsUsers).commit().add("destinations/destination2", destination2).create();
|
||||
allUsers.branch(refsUsers).commit().add("destinations/destination3", destination3).create();
|
||||
allUsers.branch(refsUsers).commit().add("destinations/destination4", destination4).create();
|
||||
allUsers.branch(refsUsers).commit().add("destinations/destination5", destination5).create();
|
||||
|
||||
Ref userRef = allUsers.getRepository().exactRef(refsUsers);
|
||||
assertThat(userRef).isNotNull();
|
||||
|
||||
assertQuery("destination:destination1", change1);
|
||||
assertQuery("destination:destination2", change2);
|
||||
assertQuery("destination:destination3", change2, change1);
|
||||
assertQuery("destination:destination4");
|
||||
assertQuery("destination:destination5");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user