@@ -2036,8 +2036,45 @@ class ConfigTest extends DDSpecification {
20362036 ! config. perfMetricsEnabled
20372037 }
20382038
2039- def " trace_agent_url overrides either host and port or unix domain" () {
2039+ def " trace_agent_url overrides default host and port or unix domain" () {
20402040 setup :
2041+ if (configuredUrl != null ) {
2042+ System . setProperty(PREFIX + TRACE_AGENT_URL , configuredUrl)
2043+ } else {
2044+ System . clearProperty(PREFIX + TRACE_AGENT_URL )
2045+ }
2046+
2047+ when :
2048+ def config = new Config ()
2049+
2050+ then :
2051+ config. agentUrl == expectedUrl
2052+ config. agentHost == expectedHost
2053+ config. agentPort == expectedPort
2054+ config. agentUnixDomainSocket == expectedUnixDomainSocket
2055+
2056+ where :
2057+ // spotless:off
2058+ configuredUrl | expectedUrl | expectedHost | expectedPort | expectedUnixDomainSocket
2059+ null | " http://localhost:8126" | " localhost" | 8126 | null
2060+ " " | " http://localhost:8126" | " localhost" | 8126 | null
2061+ " http://localhost:1234" | " http://localhost:1234" | " localhost" | 1234 | null
2062+ " http://somehost" | " http://somehost:8126" | " somehost" | 8126 | null
2063+ " http://somehost:80" | " http://somehost:80" | " somehost" | 80 | null
2064+ " https://somehost:8143" | " https://somehost:8143" | " somehost" | 8143 | null
2065+ " unix:///another/socket/path" | " unix:///another/socket/path" | " localhost" | 8126 | " /another/socket/path"
2066+ " unix:///another%2Fsocket%2Fpath" | " unix:///another%2Fsocket%2Fpath" | " localhost" | 8126 | " /another/socket/path"
2067+ " http:" | " http://localhost:8126" | " localhost" | 8126 | null
2068+ " unix:" | " http://localhost:8126" | " localhost" | 8126 | null
2069+ " 1234" | " http://localhost:8126" | " localhost" | 8126 | null
2070+ " :1234" | " http://localhost:8126" | " localhost" | 8126 | null
2071+ // spotless:on
2072+ }
2073+
2074+ def " trace_agent_url overrides configured host and port or unix domain" () {
2075+ setup :
2076+ System . setProperty(PREFIX + AGENT_HOST , " test-host" )
2077+ System . setProperty(PREFIX + TRACE_AGENT_PORT , " 8888" )
20412078 System . setProperty(PREFIX + AGENT_UNIX_DOMAIN_SOCKET , " /path/to/socket" )
20422079 if (configuredUrl != null ) {
20432080 System . setProperty(PREFIX + TRACE_AGENT_URL , configuredUrl)
@@ -2056,19 +2093,19 @@ class ConfigTest extends DDSpecification {
20562093
20572094 where :
20582095 // spotless:off
2059- configuredUrl | expectedUrl | expectedHost | expectedPort | expectedUnixDomainSocket
2060- null | " http://localhost:8126 " | " localhost " | 8126 | " /path/to/socket"
2061- " " | " http://localhost:8126 " | " localhost " | 8126 | " /path/to/socket"
2062- " http://localhost:1234" | " http://localhost:1234" | " localhost" | 1234 | " /path/to/socket"
2063- " http://somehost" | " http://somehost:8126 " | " somehost" | 8126 | " /path/to/socket"
2064- " http://somehost:80" | " http://somehost:80" | " somehost" | 80 | " /path/to/socket"
2065- " https://somehost:8143" | " https://somehost:8143" | " somehost" | 8143 | " /path/to/socket"
2066- " unix:///another/socket/path" | " http ://localhost:8126 " | " localhost" | 8126 | " /another/socket/path"
2067- " unix:///another%2Fsocket%2Fpath" | " http ://localhost:8126 " | " localhost" | 8126 | " /another/socket/path"
2068- " http:" | " http://localhost:8126 " | " localhost " | 8126 | " /path/to/socket"
2069- " unix:" | " http://localhost:8126 " | " localhost " | 8126 | " /path/to/socket"
2070- " 1234" | " http://localhost:8126 " | " localhost " | 8126 | " /path/to/socket"
2071- " :1234" | " http://localhost:8126 " | " localhost " | 8126 | " /path/to/socket"
2096+ configuredUrl | expectedUrl | expectedHost | expectedPort | expectedUnixDomainSocket
2097+ null | " http://test-host:8888 " | " test-host " | 8888 | " /path/to/socket"
2098+ " " | " http://test-host:8888 " | " test-host " | 8888 | " /path/to/socket"
2099+ " http://localhost:1234" | " http://localhost:1234" | " localhost" | 1234 | " /path/to/socket"
2100+ " http://somehost" | " http://somehost:8888 " | " somehost" | 8888 | " /path/to/socket"
2101+ " http://somehost:80" | " http://somehost:80" | " somehost" | 80 | " /path/to/socket"
2102+ " https://somehost:8143" | " https://somehost:8143" | " somehost" | 8143 | " /path/to/socket"
2103+ " unix:///another/socket/path" | " unix :///another/socket/path " | " localhost" | 8126 | " /another/socket/path"
2104+ " unix:///another%2Fsocket%2Fpath" | " unix :///another%2Fsocket%2Fpath " | " localhost" | 8126 | " /another/socket/path"
2105+ " http:" | " http://test-host:8888 " | " test-host " | 8888 | " /path/to/socket"
2106+ " unix:" | " http://test-host:8888 " | " test-host " | 8888 | " /path/to/socket"
2107+ " 1234" | " http://test-host:8888 " | " test-host " | 8888 | " /path/to/socket"
2108+ " :1234" | " http://test-host:8888 " | " test-host " | 8888 | " /path/to/socket"
20722109 // spotless:on
20732110 }
20742111
0 commit comments