CreateBranch: Test creation of a conflicting branch
If a branch refs/heads/test exists it's not possible to create another branch under that namespace (e.g. refs/heads/test/foo). Add a test for this to increase the test coverage of the CreateBranch REST endpoint. Signed-off-by: Edwin Kempin <ekempin@google.com> Change-Id: Id6d004e802775bf1d8ebb34860ebe5554157a2bc
This commit is contained in:
@@ -140,6 +140,20 @@ public class CreateBranchIT extends AbstractDaemonTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void conflictingBranchAlreadyExists_Conflict() throws Exception {
|
||||
assertCreateSucceeds(testBranch);
|
||||
BranchNameKey testBranch2 = BranchNameKey.create(project, testBranch.branch() + "/foo/bar");
|
||||
assertCreateFails(
|
||||
testBranch2,
|
||||
ResourceConflictException.class,
|
||||
"Cannot create branch \""
|
||||
+ testBranch2.branch()
|
||||
+ "\" since it conflicts with branch \""
|
||||
+ testBranch.branch()
|
||||
+ "\"");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createBranchByProjectOwner() throws Exception {
|
||||
grantOwner();
|
||||
|
||||
Reference in New Issue
Block a user