aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-server
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2018-06-20 10:05:38 +0200
committerSonarTech <sonartech@sonarsource.com>2018-07-13 20:21:28 +0200
commitd98c3ab5b4bc3615b10ca984681b809e98556450 (patch)
treeb5b29f35f898cc044fd13a7189504ee3fc0e578c /server/sonar-server
parent0c4bdce520ccca20bd5e1b92a7c5d05821b53960 (diff)
downloadsonarqube-d98c3ab5b4bc3615b10ca984681b809e98556450.tar.gz
sonarqube-d98c3ab5b4bc3615b10ca984681b809e98556450.zip
SONAR-10898 Number of CE workers not taken into account in all nodes
Diffstat (limited to 'server/sonar-server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/ce/http/CeHttpClient.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/ce/http/CeHttpClientImpl.java38
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/ce/http/CeHttpClientTest.java25
3 files changed, 0 insertions, 65 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/ce/http/CeHttpClient.java b/server/sonar-server/src/main/java/org/sonar/server/ce/http/CeHttpClient.java
index 5bb79bdf3a9..26c7662cc03 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/ce/http/CeHttpClient.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/ce/http/CeHttpClient.java
@@ -27,6 +27,4 @@ public interface CeHttpClient {
Optional<ProtobufSystemInfo.SystemInfo> retrieveSystemInfo();
void changeLogLevel(LoggerLevel level);
-
- void refreshCeWorkerCount();
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/ce/http/CeHttpClientImpl.java b/server/sonar-server/src/main/java/org/sonar/server/ce/http/CeHttpClientImpl.java
index 10be9371722..b6f04b6682a 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/ce/http/CeHttpClientImpl.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/ce/http/CeHttpClientImpl.java
@@ -123,44 +123,6 @@ public class CeHttpClientImpl implements CeHttpClient {
}
}
- @Override
- public void refreshCeWorkerCount() {
- call(RefreshCeWorkerCountActionClient.INSTANCE);
- }
-
- private enum RefreshCeWorkerCountActionClient implements ActionClient<Void> {
- INSTANCE;
-
- @Override
- public String getPath() {
- return "refreshWorkerCount";
- }
-
- @Override
- public Void getDefault() {
- return null;
- }
-
- @Override
- public Void call(String url) throws Exception {
- okhttp3.Request request = new okhttp3.Request.Builder()
- .post(RequestBody.create(null, new byte[0]))
- .url(url)
- .build();
- try (okhttp3.Response response = new OkHttpClient().newCall(request).execute()) {
- if (response.code() != 200) {
- throw new IOException(
- String.format(
- "Failed to trigger refresh of CE Worker count. Code was '%s' and response was '%s' for url '%s'",
- response.code(),
- response.body().string(),
- url));
- }
- return null;
- }
- }
- }
-
private <T> T call(ActionClient<T> actionClient) {
try (DefaultProcessCommands commands = DefaultProcessCommands.secondary(ipcSharedDir, COMPUTE_ENGINE.getIpcIndex())) {
if (commands.isUp()) {
diff --git a/server/sonar-server/src/test/java/org/sonar/server/ce/http/CeHttpClientTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/http/CeHttpClientTest.java
index bd918c6782d..fc21c004270 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/ce/http/CeHttpClientTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/ce/http/CeHttpClientTest.java
@@ -133,31 +133,6 @@ public class CeHttpClientTest {
underTest.changeLogLevel(LoggerLevel.INFO);
}
- @Test
- public void refreshCeWorkerCount_throws_ISE_if_http_error() {
- String message = "blah";
- server.enqueue(new MockResponse().setResponseCode(500).setBody(message));
- // initialize registration of process
- setUpWithHttpUrl(ProcessId.COMPUTE_ENGINE);
-
- expectedException.expect(IllegalStateException.class);
- expectedException.expectMessage("Failed to call HTTP server of process " + ProcessId.COMPUTE_ENGINE);
- expectedException.expectCause(hasType(IOException.class)
- .andMessage(format("Failed to trigger refresh of CE Worker count. Code was '500' and response was 'blah' for url " +
- "'http://%s:%s/refreshWorkerCount'", server.getHostName(), server.getPort())));
-
- underTest.refreshCeWorkerCount();
- }
-
- @Test
- public void refreshCeWorkerCount_does_not_fail_when_http_code_is_200() {
- server.enqueue(new MockResponse().setResponseCode(200));
-
- setUpWithHttpUrl(ProcessId.COMPUTE_ENGINE);
-
- underTest.refreshCeWorkerCount();
- }
-
private void setUpWithHttpUrl(ProcessId processId) {
try (DefaultProcessCommands processCommands = DefaultProcessCommands.secondary(ipcSharedDir, processId.getIpcIndex())) {
processCommands.setUp();