Skip to content

Commit 37bd398

Browse files
Adrian Coleadriancole
Adrian Cole
authored andcommitted
Revert "Prevent's "Brian's bomb" by manually clearing metrics on each test class"
This reverts commit 3905f14.
1 parent ff76efe commit 37bd398

File tree

5 files changed

+1
-29
lines changed

5 files changed

+1
-29
lines changed

zipkin-server/src/test/java/zipkin/server/ZipkinServerCORSTest.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@
1313
*/
1414
package zipkin.server;
1515

16-
import io.prometheus.client.CollectorRegistry;
1716
import java.io.IOException;
1817
import okhttp3.OkHttpClient;
1918
import okhttp3.Request;
2019
import okhttp3.RequestBody;
2120
import okhttp3.Response;
22-
import org.junit.Before;
2321
import org.junit.Test;
2422
import org.junit.runner.RunWith;
2523
import org.springframework.boot.context.embedded.LocalServerPort;
@@ -49,9 +47,7 @@ public class ZipkinServerCORSTest {
4947
@LocalServerPort int zipkinPort;
5048
OkHttpClient client = new OkHttpClient.Builder().followRedirects(false).build();
5149

52-
@Before public void init() throws IOException {
53-
// prevent "brian's bomb" https://github.com/openzipkin/zipkin/issues/1811
54-
CollectorRegistry.defaultRegistry.clear();
50+
@Test public void shouldAllowConfiguredOrigin() throws IOException {
5551
shouldAllowConfiguredOrigin(getTracesFromOrigin(ALLOWED_ORIGIN));
5652
shouldAllowConfiguredOrigin(postSpansFromOrigin(ALLOWED_ORIGIN));
5753
}

zipkin-server/src/test/java/zipkin/server/ZipkinServerConfigurationTest.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
package zipkin.server;
1515

1616
import com.github.kristofa.brave.Brave;
17-
import io.prometheus.client.CollectorRegistry;
1817
import org.junit.After;
19-
import org.junit.Before;
2018
import org.junit.Test;
2119
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
2220
import org.springframework.boot.actuate.health.HealthAggregator;
@@ -39,11 +37,6 @@
3937
public class ZipkinServerConfigurationTest {
4038
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
4139

42-
@Before public void init() {
43-
// prevent "brian's bomb" https://github.com/openzipkin/zipkin/issues/1811
44-
CollectorRegistry.defaultRegistry.clear();
45-
}
46-
4740
@After public void close() {
4841
context.close();
4942
}

zipkin-server/src/test/java/zipkin/server/ZipkinServerHttpCollectorDisabledTest.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@
1313
*/
1414
package zipkin.server;
1515

16-
import io.prometheus.client.CollectorRegistry;
1716
import okhttp3.OkHttpClient;
1817
import okhttp3.Request;
1918
import okhttp3.RequestBody;
2019
import okhttp3.Response;
21-
import org.junit.Before;
2220
import org.junit.Test;
2321
import org.junit.runner.RunWith;
2422
import org.springframework.boot.context.embedded.LocalServerPort;
@@ -45,11 +43,6 @@ public class ZipkinServerHttpCollectorDisabledTest {
4543
@LocalServerPort int zipkinPort;
4644
OkHttpClient client = new OkHttpClient.Builder().followRedirects(false).build();
4745

48-
@Before public void init() {
49-
// prevent "brian's bomb" https://github.com/openzipkin/zipkin/issues/1811
50-
CollectorRegistry.defaultRegistry.clear();
51-
}
52-
5346
@Test public void httpCollectorEndpointReturns405() throws Exception {
5447
Response response = client.newCall(new Request.Builder()
5548
.url("http://localhost:" + zipkinPort + "/api/v2/spans")

zipkin-server/src/test/java/zipkin/server/ZipkinServerIntegrationTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
package zipkin.server;
1515

1616
import com.jayway.jsonpath.JsonPath;
17-
import io.prometheus.client.CollectorRegistry;
1817
import java.io.IOException;
1918
import java.util.List;
2019
import okhttp3.MediaType;
@@ -64,8 +63,6 @@ public class ZipkinServerIntegrationTest {
6463
OkHttpClient client = new OkHttpClient.Builder().followRedirects(false).build();
6564

6665
@Before public void init() {
67-
// prevent "brian's bomb" https://github.com/openzipkin/zipkin/issues/1811
68-
CollectorRegistry.defaultRegistry.clear();
6966
storage.clear();
7067
metrics.forTransport("http").reset();
7168
}

zipkin-server/src/test/java/zipkin/server/ZipkinServerQueryDisabledTest.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@
1313
*/
1414
package zipkin.server;
1515

16-
import io.prometheus.client.CollectorRegistry;
1716
import java.io.IOException;
1817
import okhttp3.OkHttpClient;
1918
import okhttp3.Request;
2019
import okhttp3.Response;
21-
import org.junit.Before;
2220
import org.junit.Test;
2321
import org.junit.runner.RunWith;
2422
import org.springframework.boot.context.embedded.LocalServerPort;
@@ -45,11 +43,6 @@ public class ZipkinServerQueryDisabledTest {
4543
@LocalServerPort int zipkinPort;
4644
OkHttpClient client = new OkHttpClient.Builder().followRedirects(false).build();
4745

48-
@Before public void init() {
49-
// prevent "brian's bomb" https://github.com/openzipkin/zipkin/issues/1811
50-
CollectorRegistry.defaultRegistry.clear();
51-
}
52-
5346
@Test public void queryRelatedEndpoints404() throws Exception {
5447
assertThat(get("/api/v1/traces").code()).isEqualTo(404);
5548
assertThat(get("/api/v2/traces").code()).isEqualTo(404);

0 commit comments

Comments
 (0)