Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import specs.TestJsonSpec;

import javax.annotation.Nullable;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Iterator;
import java.util.Objects;
import java.util.Spliterator;
Expand Down Expand Up @@ -126,13 +128,13 @@ private Span createSpan(JsonNode testCase) {
}
JsonNode httpJson = contextJson.get("http");
if (httpJson != null) {
JsonNode urlJson = httpJson.get("url");
if (urlJson != null) {
String urlValue = getTextValueOrNull(httpJson, "url");
if (urlValue != null) {
Url url = context.getHttp().getInternalUrl();
url.withHostname(getTextValueOrNull(urlJson, "host"));
JsonNode portJson = urlJson.get("port");
if (portJson != null) {
url.withPort(portJson.intValue());
try {
url.fillFrom(new URI(urlValue));
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,7 @@
"type": "elasticsearch"
},
"http": {
"url": {
"host": "my-cluster.com",
"port": 9200
}
"url": "https://my-cluster.com:9200"
}
}
},
Expand All @@ -153,10 +150,7 @@
"body": "Text message"
},
"http": {
"url": {
"host": "my-broker.com",
"port": 8888
}
"url": "https://my-broker.com:8888"
}
}
},
Expand All @@ -173,10 +167,7 @@
"subtype": "http",
"context": {
"http": {
"url": {
"host": "my-cluster.com",
"port": 9200
}
"url": "http://my-cluster.com:9200"
}
}
},
Expand All @@ -185,7 +176,7 @@
"type": "http",
"name": "my-cluster.com:9200"
},
"failure_message": "If `context.http.url` exists, output should be `${context.http.url.host}:${context.http.url.port}"
"failure_message": "If `context.http.url` exists, output should be `${context.http.url}`"
},
{
"span": {
Expand All @@ -194,19 +185,16 @@
"subtype": "http",
"context": {
"http": {
"url": {
"host": "my-cluster.com",
"port": -1
}
"url": "https://my-cluster.com"
}
}
},
"expected_resource": "my-cluster.com",
"expected_resource": "my-cluster.com:443",
"expected_service_target": {
"type": "http",
"name": "my-cluster.com"
"name": "my-cluster.com:443"
},
"failure_message": "Negative `context.http.url.port` should be omitted from output"
"failure_message": "`context.http.url` without an explicit default HTTPS port, output should be reported as `${context.http.url}:443`"
},
{
"span": {
Expand All @@ -215,18 +203,16 @@
"subtype": "http",
"context": {
"http": {
"url": {
"host": "my-cluster.com"
}
"url": "http://my-cluster.com"
}
}
},
"expected_resource": "my-cluster.com",
"expected_resource": "my-cluster.com:80",
"expected_service_target": {
"type": "http",
"name": "my-cluster.com"
"name": "my-cluster.com:80"
},
"failure_message": "If `context.http.url.port` does not exist, output should be `${context.http.url.host}`"
"failure_message": "`context.http.url` without an explicit default HTTP port, output should be reported as `${context.http.url}:80`"
},
{
"span": {
Expand Down