Add test to ensure all patch-sets of a visible change get advertised

During Ref Advertisement, visible changes adverise refs/changes/../meta,
and all refs/changes/../i when i is the number of patch-set. All
patch-sets get advertised.

Change-Id: If88e68c72e01bcdab4b624f5681ac616cad2f7f1
This commit is contained in:
Gal Paikin
2021-02-02 16:32:14 +01:00
parent ea897cd754
commit 8b1c98a126

View File

@@ -402,6 +402,39 @@ public class RefAdvertisementIT extends AbstractDaemonTest {
// tree-tag not visible. See comment in subsetOfBranchesVisibleIncludingHead.
}
@Test
public void uploadPackSubsetOfBranchesVisibleAllPatchsets() throws Exception {
projectOperations
.project(project)
.forUpdate()
.add(allow(Permission.READ).ref("refs/heads/master").group(REGISTERED_USERS))
.update();
PushOneCommit.Result pushResult =
pushFactory.create(admin.newIdent(), testRepo).to("refs/for/master");
pushResult.assertOkStatus();
String firstPatchSetRef = RefNames.patchSetRef(pushResult.getPatchSetId());
pushResult = amendChange(pushResult.getChangeId());
pushResult.assertOkStatus();
String secondPatchSetRef = RefNames.patchSetRef(pushResult.getPatchSetId());
assertUploadPackRefs(
"HEAD",
psRef1,
metaRef1,
psRef3,
metaRef3,
RefNames.changeMetaRef(pushResult.getChange().getId()),
firstPatchSetRef,
// include all patchsets of the visible changes
secondPatchSetRef,
"refs/heads/master",
"refs/tags/master-tag");
// tree-tag not visible. See comment in subsetOfBranchesVisibleIncludingHead.
}
@Test
public void uploadPackSubsetOfBranchesAndEditsVisibleWithViewPrivateChanges() throws Exception {
projectOperations