summaryrefslogtreecommitdiffstats
path: root/metrics-proxy/src/test
diff options
context:
space:
mode:
authorgjoranv <gv@verizonmedia.com>2019-12-19 13:48:47 +0100
committergjoranv <gv@verizonmedia.com>2019-12-19 13:50:03 +0100
commit04ee7820be149afc75c30b2f52fdbdd542ad5270 (patch)
tree90e969b59099c855a886bbd91e6182d367a9be0e /metrics-proxy/src/test
parentc11e86632533e4e35d393364c7c7e7743566a1fa (diff)
Allow specifying a consumer, and propagate it all the way.
Diffstat (limited to 'metrics-proxy/src/test')
-rw-r--r--metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/application/ApplicationMetricsRetrieverTest.java14
-rw-r--r--metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/application/NodeMetricsClientTest.java7
2 files changed, 12 insertions, 9 deletions
diff --git a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/application/ApplicationMetricsRetrieverTest.java b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/application/ApplicationMetricsRetrieverTest.java
index e2bd5c84dc0..375795fb23e 100644
--- a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/application/ApplicationMetricsRetrieverTest.java
+++ b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/application/ApplicationMetricsRetrieverTest.java
@@ -16,7 +16,7 @@ import java.util.concurrent.TimeoutException;
import static ai.vespa.metricsproxy.TestUtil.getFileContents;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
import static java.util.stream.Collectors.toList;
import static org.junit.Assert.assertEquals;
@@ -51,7 +51,7 @@ public class ApplicationMetricsRetrieverTest {
}
private void verifyRetrievingMetricsFromSingleNode(VespaNodesConfig config, Node node) {
- wireMockRule.stubFor(get(urlEqualTo(config.node(0).path()))
+ wireMockRule.stubFor(get(urlPathEqualTo(config.node(0).path()))
.willReturn(aResponse().withBody(RESPONSE)));
ApplicationMetricsRetriever retriever = new ApplicationMetricsRetriever(config);
@@ -66,9 +66,9 @@ public class ApplicationMetricsRetrieverTest {
Node node0 = new Node(config.node(0));
Node node1 = new Node(config.node(1));
- wireMockRule.stubFor(get(urlEqualTo(config.node(0).path()))
+ wireMockRule.stubFor(get(urlPathEqualTo(config.node(0).path()))
.willReturn(aResponse().withBody(RESPONSE)));
- wireMockRule.stubFor(get(urlEqualTo(config.node(1).path()))
+ wireMockRule.stubFor(get(urlPathEqualTo(config.node(1).path()))
.willReturn(aResponse().withBody(RESPONSE)));
ApplicationMetricsRetriever retriever = new ApplicationMetricsRetriever(config);
@@ -96,7 +96,7 @@ public class ApplicationMetricsRetrieverTest {
Node node0 = new Node(config.node(0));
Node node1 = new Node(config.node(1));
- wireMockRule.stubFor(get(urlEqualTo(config.node(1).path()))
+ wireMockRule.stubFor(get(urlPathEqualTo(config.node(1).path()))
.willReturn(aResponse().withBody(RESPONSE)));
ApplicationMetricsRetriever retriever = new ApplicationMetricsRetriever(config);
@@ -110,7 +110,7 @@ public class ApplicationMetricsRetrieverTest {
public void an_exception_is_thrown_when_retrieving_times_out() {
var config = nodesConfig("/node0");
- wireMockRule.stubFor(get(urlEqualTo(config.node(0).path()))
+ wireMockRule.stubFor(get(urlPathEqualTo(config.node(0).path()))
.willReturn(aResponse()
.withBody(RESPONSE)
.withFixedDelay(10)));
@@ -131,7 +131,7 @@ public class ApplicationMetricsRetrieverTest {
var config = nodesConfig("/node0");
Node node = new Node(config.node(0));
- var delayedStub = wireMockRule.stubFor(get(urlEqualTo(config.node(0).path()))
+ var delayedStub = wireMockRule.stubFor(get(urlPathEqualTo(config.node(0).path()))
.willReturn(aResponse()
.withBody(RESPONSE)
.withFixedDelay(10)));
diff --git a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/application/NodeMetricsClientTest.java b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/application/NodeMetricsClientTest.java
index f953e809f85..d028db93d43 100644
--- a/metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/application/NodeMetricsClientTest.java
+++ b/metrics-proxy/src/test/java/ai/vespa/metricsproxy/http/application/NodeMetricsClientTest.java
@@ -15,12 +15,14 @@ import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
+import java.net.URI;
import java.util.List;
import static ai.vespa.metricsproxy.TestUtil.getFileContents;
+import static ai.vespa.metricsproxy.http.ValuesFetcher.DEFAULT_PUBLIC_CONSUMER_ID;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
import static org.junit.Assert.assertEquals;
@@ -49,7 +51,8 @@ public class NodeMetricsClientTest {
@BeforeClass
public static void setupWireMock() {
node = new Node("id", "localhost", wireMockRule.port(), MetricsHandler.VALUES_PATH);
- wireMockRule.stubFor(get(urlEqualTo(node.metricsUri.getPath()))
+ URI metricsUri = node.metricsUri(DEFAULT_PUBLIC_CONSUMER_ID);
+ wireMockRule.stubFor(get(urlPathEqualTo(metricsUri.getPath()))
.willReturn(aResponse().withBody(RESPONSE)));
}