|
8 | 8 |
|
9 | 9 | package org.opensearch.remotestore;
|
10 | 10 |
|
| 11 | +import org.opensearch.client.Client; |
| 12 | +import org.opensearch.cluster.metadata.RepositoryMetadata; |
| 13 | +import org.opensearch.common.settings.Settings; |
| 14 | +import org.opensearch.core.common.unit.ByteSizeValue; |
11 | 15 | import org.opensearch.plugins.Plugin;
|
12 | 16 | import org.opensearch.test.OpenSearchIntegTestCase;
|
13 | 17 | import org.opensearch.test.disruption.NetworkDisruption;
|
@@ -94,4 +98,68 @@ public void testMultiNodeClusterRandomNodeRecoverNetworkIsolation() {
|
94 | 98 |
|
95 | 99 | internalCluster().clearDisruptionScheme();
|
96 | 100 | }
|
| 101 | + |
| 102 | + public void testMultiNodeClusterRandomNodeRecoverNetworkIsolationPostNonRestrictedSettingsUpdate() { |
| 103 | + Set<String> nodesInOneSide = internalCluster().startNodes(3).stream().collect(Collectors.toCollection(HashSet::new)); |
| 104 | + Set<String> nodesInAnotherSide = internalCluster().startNodes(3).stream().collect(Collectors.toCollection(HashSet::new)); |
| 105 | + ensureStableCluster(6); |
| 106 | + |
| 107 | + NetworkDisruption networkDisruption = new NetworkDisruption( |
| 108 | + new NetworkDisruption.TwoPartitions(nodesInOneSide, nodesInAnotherSide), |
| 109 | + NetworkDisruption.DISCONNECT |
| 110 | + ); |
| 111 | + internalCluster().setDisruptionScheme(networkDisruption); |
| 112 | + |
| 113 | + networkDisruption.startDisrupting(); |
| 114 | + |
| 115 | + final Client client = client(nodesInOneSide.iterator().next()); |
| 116 | + RepositoryMetadata repositoryMetadata = client.admin() |
| 117 | + .cluster() |
| 118 | + .prepareGetRepositories(REPOSITORY_NAME) |
| 119 | + .get() |
| 120 | + .repositories() |
| 121 | + .get(0); |
| 122 | + Settings.Builder updatedSettings = Settings.builder().put(repositoryMetadata.settings()).put("chunk_size", new ByteSizeValue(20)); |
| 123 | + updatedSettings.remove("system_repository"); |
| 124 | + |
| 125 | + client.admin() |
| 126 | + .cluster() |
| 127 | + .preparePutRepository(repositoryMetadata.name()) |
| 128 | + .setType(repositoryMetadata.type()) |
| 129 | + .setSettings(updatedSettings) |
| 130 | + .get(); |
| 131 | + |
| 132 | + ensureStableCluster(3, nodesInOneSide.stream().findAny().get()); |
| 133 | + networkDisruption.stopDisrupting(); |
| 134 | + |
| 135 | + ensureStableCluster(6); |
| 136 | + |
| 137 | + internalCluster().clearDisruptionScheme(); |
| 138 | + } |
| 139 | + |
| 140 | + public void testNodeRestartPostNonRestrictedSettingsUpdate() throws Exception { |
| 141 | + internalCluster().startClusterManagerOnlyNode(); |
| 142 | + internalCluster().startNodes(3); |
| 143 | + |
| 144 | + final Client client = client(); |
| 145 | + RepositoryMetadata repositoryMetadata = client.admin() |
| 146 | + .cluster() |
| 147 | + .prepareGetRepositories(REPOSITORY_NAME) |
| 148 | + .get() |
| 149 | + .repositories() |
| 150 | + .get(0); |
| 151 | + Settings.Builder updatedSettings = Settings.builder().put(repositoryMetadata.settings()).put("chunk_size", new ByteSizeValue(20)); |
| 152 | + updatedSettings.remove("system_repository"); |
| 153 | + |
| 154 | + client.admin() |
| 155 | + .cluster() |
| 156 | + .preparePutRepository(repositoryMetadata.name()) |
| 157 | + .setType(repositoryMetadata.type()) |
| 158 | + .setSettings(updatedSettings) |
| 159 | + .get(); |
| 160 | + |
| 161 | + internalCluster().restartRandomDataNode(); |
| 162 | + |
| 163 | + ensureStableCluster(4); |
| 164 | + } |
97 | 165 | }
|
0 commit comments