Merge branch 'stable-3.3' into master * stable-3.3: Update README of setup_local_env Stop broadcasting accounts cache eviction Fix broken link to websession-broker Change-Id: I1eeb3ba4514e19cc086ccfc8af2d8e1fc5bbb713
diff --git a/setup_local_env/README.md b/setup_local_env/README.md index 441f98d..5b99996 100644 --- a/setup_local_env/README.md +++ b/setup_local_env/README.md
@@ -20,7 +20,7 @@ Simplest setup with all default values and cleanup previous deployment ```bash -sh setup_local_env/setup.sh --release-war-file /path/to/release.war --multisite-plugin-file /path/to/multi-site.jar +sh setup_local_env/setup.sh --release-war-file /path/to/gerrit.war --multisite-lib-file /path/to/multi-site.jar ``` Cleanup the previous deployments @@ -32,13 +32,13 @@ Help ```bash -Usage: sh setup.sh [--option ] +Usage: sh ./setup.sh [--option ] [--release-war-file] Location to release.war file -[--multisite-plugin-file] Location to plugin multi-site.jar file +[--multisite-lib-file] Location to lib multi-site.jar file [--new-deployment] Cleans up previous gerrit deployment and re-installs it. default true -[--get-websession-plugin] Download websession-flatfile plugin from CI lastSuccessfulBuild; default true +[--get-websession-plugin] Download websession-broker plugin from CI lastSuccessfulBuild; default true [--deployment-location] Base location for the test deployment; default /tmp [--gerrit-canonical-host] The default host for Gerrit to be accessed through; default localhost @@ -54,6 +54,8 @@ [--replication-type] Options [file,ssh]; default ssh [--replication-ssh-user] SSH user for the replication plugin; default $(whoami) +[--replication-delay] Replication delay across the two instances in seconds + [--just-cleanup-env] Cleans up previous deployment; default false [--enabled-https] Enabled https; default true
diff --git a/setup_local_env/setup.sh b/setup_local_env/setup.sh index aa0eb7b..d4718ba 100755 --- a/setup_local_env/setup.sh +++ b/setup_local_env/setup.sh
@@ -342,7 +342,7 @@ fi if [ $DOWNLOAD_WEBSESSION_PLUGIN = "true" ];then echo "Downloading websession-broker plugin $GERRIT_BRANCH" - wget $GERRIT_CI/plugin-websession-broker-bazel-master-$GERRIT_BRANCH/$LAST_BUILD/websession-broker/websession-broker.jar \ + wget $GERRIT_CI/plugin-websession-broker-bazel-$GERRIT_BRANCH/$LAST_BUILD/websession-broker/websession-broker.jar \ -O $DEPLOYMENT_LOCATION/websession-broker.jar || { echo >&2 "Cannot download websession-broker plugin: Check internet connection. Abort\ ing"; exit 1; } wget $GERRIT_CI/plugin-healthcheck-bazel-$GERRIT_BRANCH/$LAST_BUILD/healthcheck/healthcheck.jar \
diff --git a/src/main/java/com/googlesource/gerrit/plugins/multisite/cache/CachePatternMatcher.java b/src/main/java/com/googlesource/gerrit/plugins/multisite/cache/CachePatternMatcher.java index acf8df0..b8521a3 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/multisite/cache/CachePatternMatcher.java +++ b/src/main/java/com/googlesource/gerrit/plugins/multisite/cache/CachePatternMatcher.java
@@ -26,8 +26,7 @@ @Singleton class CachePatternMatcher { private static final List<String> DEFAULT_PATTERNS = - ImmutableList.of( - "accounts", "^groups.*", "ldap_groups", "ldap_usernames", "projects", "sshkeys"); + ImmutableList.of("^groups.*", "ldap_groups", "ldap_usernames", "projects", "sshkeys"); private final Pattern pattern;
diff --git a/src/test/java/com/googlesource/gerrit/plugins/multisite/cache/CacheEvictionHandlerTest.java b/src/test/java/com/googlesource/gerrit/plugins/multisite/cache/CacheEvictionHandlerTest.java new file mode 100644 index 0000000..67be583 --- /dev/null +++ b/src/test/java/com/googlesource/gerrit/plugins/multisite/cache/CacheEvictionHandlerTest.java
@@ -0,0 +1,48 @@ +// Copyright (C) 2020 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.googlesource.gerrit.plugins.multisite.cache; + +import static org.mockito.Mockito.verifyZeroInteractions; + +import com.google.common.cache.RemovalCause; +import com.google.common.cache.RemovalNotification; +import com.google.gerrit.extensions.registration.DynamicSet; +import com.googlesource.gerrit.plugins.multisite.Configuration; +import java.util.concurrent.Executor; +import org.eclipse.jgit.lib.Config; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; + +@RunWith(MockitoJUnitRunner.class) +public class CacheEvictionHandlerTest { + + @Mock private Executor executorMock; + private CachePatternMatcher defaultCacheMatcher = + new CachePatternMatcher(new Configuration(new Config(), new Config())); + + @Test + public void shouldNotPublishAccountsCacheEvictions() { + + final CacheEvictionHandler<String, String> handler = + new CacheEvictionHandler<>(DynamicSet.emptySet(), executorMock, defaultCacheMatcher); + + handler.onRemoval( + "test", "accounts", RemovalNotification.create("test", "accounts", RemovalCause.EXPLICIT)); + + verifyZeroInteractions(executorMock); + } +}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/multisite/cache/CachePattenMatcherTest.java b/src/test/java/com/googlesource/gerrit/plugins/multisite/cache/CachePattenMatcherTest.java index 052a9ae..b35e862 100644 --- a/src/test/java/com/googlesource/gerrit/plugins/multisite/cache/CachePattenMatcherTest.java +++ b/src/test/java/com/googlesource/gerrit/plugins/multisite/cache/CachePattenMatcherTest.java
@@ -37,7 +37,6 @@ CachePatternMatcher matcher = new CachePatternMatcher(configurationMock); for (String cache : ImmutableList.of( - "accounts", "groups", "groups_byinclude", "groups_byname", @@ -55,6 +54,7 @@ } for (String cache : ImmutableList.of( + "accounts", "adv_bases", "change_kind", "change_notes",