diff options
author | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2021-03-18 12:07:45 +0100 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2021-03-19 13:30:31 +0100 |
commit | a831f99cb087121e74e4ed6adb496db78909d2c3 (patch) | |
tree | 0f6d4f4a8a8b811bc915f88647d8573c8e82db11 /clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DatabaseHandlerTest.java | |
parent | 0b563fff5e00b45df8550e197961b6c5d868c0ff (diff) |
Inhibit ZooKeeper connections until our local Slobrok mirror is ready.
Otherwise, if there are transient Slobrok issues during CC startup and
we end up winning the election, we risk publishing a cluster state where
the entire cluster appears down (since we do not have any knowledge of
Slobrok node mapping state). This will adversely affect availability for
all the obvious reasons.
Diffstat (limited to 'clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DatabaseHandlerTest.java')
-rw-r--r-- | clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DatabaseHandlerTest.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DatabaseHandlerTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DatabaseHandlerTest.java index 9c0a94309a5..7f664e65dc0 100644 --- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DatabaseHandlerTest.java +++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/DatabaseHandlerTest.java @@ -10,6 +10,7 @@ import org.junit.Test; import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.eq; @@ -65,11 +66,22 @@ public class DatabaseHandlerTest { } DatabaseHandler createHandler() throws Exception { - return new DatabaseHandler(mockDbFactory, mockTimer, databaseAddress, 0, monitor); + var handler = new DatabaseHandler(mockDbFactory, mockTimer, databaseAddress, 0, monitor); + handler.setConnectionEstablishmentIsAllowed(true); + return handler; } } @Test + public void can_not_connect_to_database_if_connectivity_is_not_allowed() throws Exception { + Fixture f = new Fixture(); + DatabaseHandler handler = f.createHandler(); + handler.setConnectionEstablishmentIsAllowed(false); + handler.doNextZooKeeperTask(f.createMockContext()); + assertTrue(handler.isClosed()); // No connectivity allowed yet + } + + @Test public void can_store_latest_cluster_state_bundle() throws Exception { Fixture f = new Fixture(); DatabaseHandler handler = f.createHandler(); |