Merge branch 'stable-3.2' into stable-3.3
* stable-3.2: Set version to 3.2.5.1 Disk cache metrics require cache.enableDiskStatMetrics Set version to 2.14.22 ElasticContainer: Upgrade V6_8 to elasticsearch 6.8.13 Upgrade testcontainers to 1.15.0 Update git submodules Workaround Gitiles bug on All-Users visibility Validate Gerrit changes on stable-2.15 with Jenkins Set version to 2.15.22-SNAPSHOT Set version to 3.0.16-SNAPSHOT Set version to 2.15.21 Set version to 3.0.15 Set version to 2.16.26-SNAPSHOT Set version to 2.16.25 Set version to 3.1.11-SNAPSHOT Set version to 3.1.10 Workaround Gitiles bug on All-Users visibility Workaround Gitiles bug on All-Users visibility Workaround Gitiles bug on All-Users visibility Workaround Gitiles bug on All-Users visibility Set version to 3.2.6-SNAPSHOT Set version to 3.2.5 Workaround Gitiles bug on All-Users visibility Set version to 2.15.21-SNAPSHOT Set version to 2.15.20 Fetch JGit documentation from the archive site Remove generation for c.g.gwtexpui.* JavaDoc Set version to 3.2.5-SNAPSHOT Set version to 3.2.4 Set version to 3.1.10-SNAPSHOT Set version to 3.1.9 Set version to 3.0.15-SNAPSHOT Set version to 2.16.25-SNAPSHOT Set version to 3.0.14 Set version to 2.16.24 Make PermissionBackend#ForRef authoritative Validate Gerrit changes on stable-2.15 with Jenkins Fix tests for stable-2.15 branch Make PermissionBackend#ForRef authoritative Make PermissionBackend#ForRef authoritative Make PermissionBackend#ForRef authoritative Verify hostname when sending emails via SMTP server with SMTPSClient Make PermissionBackend#ForRef authoritative Docs: Clarify that 'm' push option sets patch set description Change-Id: I5f9d527fc82a92cfd1ee5aead34532c2054e9d81
This commit is contained in:
@@ -17,8 +17,11 @@ java_library(
|
||||
"//lib:junit",
|
||||
"//lib/guice",
|
||||
"//lib/httpcomponents:httpcore",
|
||||
"//lib/jackson:jackson-annotations",
|
||||
"//lib/log:api",
|
||||
"//lib/testcontainers",
|
||||
"//lib/testcontainers:docker-java-api",
|
||||
"//lib/testcontainers:docker-java-transport",
|
||||
"//lib/testcontainers:testcontainers-elasticsearch",
|
||||
],
|
||||
)
|
||||
|
@@ -19,6 +19,7 @@ import org.junit.AssumptionViolatedException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.testcontainers.elasticsearch.ElasticsearchContainer;
|
||||
import org.testcontainers.utility.DockerImageName;
|
||||
|
||||
/* Helper class for running ES integration tests in docker container */
|
||||
public class ElasticContainer extends ElasticsearchContainer {
|
||||
@@ -39,7 +40,7 @@ public class ElasticContainer extends ElasticsearchContainer {
|
||||
private static String getImageName(ElasticVersion version) {
|
||||
switch (version) {
|
||||
case V6_8:
|
||||
return "blacktop/elasticsearch:6.8.12";
|
||||
return "blacktop/elasticsearch:6.8.13";
|
||||
case V7_0:
|
||||
return "blacktop/elasticsearch:7.0.1";
|
||||
case V7_1:
|
||||
@@ -63,7 +64,9 @@ public class ElasticContainer extends ElasticsearchContainer {
|
||||
}
|
||||
|
||||
private ElasticContainer(ElasticVersion version) {
|
||||
super(getImageName(version));
|
||||
super(
|
||||
DockerImageName.parse(getImageName(version))
|
||||
.asCompatibleSubstituteFor("docker.elastic.co/elasticsearch/elasticsearch"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -48,6 +48,7 @@ import com.google.gerrit.server.CurrentUser;
|
||||
import com.google.gerrit.server.account.GroupMembership;
|
||||
import com.google.gerrit.server.account.ListGroupMembership;
|
||||
import com.google.gerrit.server.config.AllProjectsName;
|
||||
import com.google.gerrit.server.config.AllUsersName;
|
||||
import com.google.gerrit.server.git.meta.MetaDataUpdate;
|
||||
import com.google.gerrit.server.index.SingleVersionModule.SingleVersionListener;
|
||||
import com.google.gerrit.server.project.ProjectCache;
|
||||
@@ -63,6 +64,7 @@ import com.google.inject.Guice;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Optional;
|
||||
import org.eclipse.jgit.junit.TestRepository;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
@@ -90,6 +92,18 @@ public class RefControlTest {
|
||||
assertWithMessage("not owner").that(u.isOwner()).isFalse();
|
||||
}
|
||||
|
||||
private void assertAllRefsAreVisible(ProjectControl u) {
|
||||
assertWithMessage("all refs visible")
|
||||
.that(u.allRefsAreVisible(Collections.emptySet()))
|
||||
.isTrue();
|
||||
}
|
||||
|
||||
private void assertAllRefsAreNotVisible(ProjectControl u) {
|
||||
assertWithMessage("all refs NOT visible")
|
||||
.that(u.allRefsAreVisible(Collections.emptySet()))
|
||||
.isFalse();
|
||||
}
|
||||
|
||||
private void assertNotOwner(String ref, ProjectControl u) {
|
||||
assertWithMessage("NOT OWN " + ref).that(u.controlForRef(ref).isOwner()).isFalse();
|
||||
}
|
||||
@@ -181,6 +195,7 @@ public class RefControlTest {
|
||||
private final Project.NameKey parentKey = Project.nameKey("parent");
|
||||
|
||||
@Inject private AllProjectsName allProjectsName;
|
||||
@Inject private AllUsersName allUsersName;
|
||||
@Inject private InMemoryRepositoryManager repoManager;
|
||||
@Inject private MetaDataUpdate.Server metaDataUpdateFactory;
|
||||
@Inject private ProjectCache projectCache;
|
||||
@@ -271,6 +286,32 @@ public class RefControlTest {
|
||||
assertAdminsAreOwnersAndDevsAreNot();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void allRefsAreVisibleForRegularProject() throws Exception {
|
||||
projectOperations
|
||||
.project(localKey)
|
||||
.forUpdate()
|
||||
.add(allow(READ).ref("refs/*").group(DEVS))
|
||||
.add(allow(READ).ref("refs/groups/*").group(DEVS))
|
||||
.add(allow(READ).ref("refs/users/default").group(DEVS))
|
||||
.update();
|
||||
|
||||
assertAllRefsAreVisible(user(localKey, DEVS));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void allRefsAreNotVisibleForAllUsers() throws Exception {
|
||||
projectOperations
|
||||
.project(allUsersName)
|
||||
.forUpdate()
|
||||
.add(allow(READ).ref("refs/*").group(DEVS))
|
||||
.add(allow(READ).ref("refs/groups/*").group(DEVS))
|
||||
.add(allow(READ).ref("refs/users/default").group(DEVS))
|
||||
.update();
|
||||
|
||||
assertAllRefsAreNotVisible(user(allUsersName, DEVS));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void branchDelegation1() throws Exception {
|
||||
projectOperations
|
||||
|
Reference in New Issue
Block a user