Skip to content

Commit 46eeef8

Browse files
authored
tests(helpers) make host and port of Zipkin configurable (#8626)
Move zipkin default host and port into spec/helpers and update plugin test to use those.
1 parent 82fa99d commit 46eeef8

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

spec/03-plugins/34-zipkin/zipkin_spec.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ local to_hex = require "resty.string".to_hex
55

66
local fmt = string.format
77

8-
local ZIPKIN_HOST = os.getenv("ZIPKIN_HOST") or "127.0.0.1"
9-
local ZIPKIN_PORT = 9411
8+
local ZIPKIN_HOST = helpers.zipkin_host
9+
local ZIPKIN_PORT = helpers.zipkin_port
1010
local GRPCBIN_HOST = "127.0.0.1"
1111
local GRPCBIN_PORT = 15002
1212

spec/helpers.lua

+11-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ local MOCK_UPSTREAM_SSL_PORT = 15556
2121
local MOCK_UPSTREAM_STREAM_PORT = 15557
2222
local MOCK_UPSTREAM_STREAM_SSL_PORT = 15558
2323
local MOCK_GRPC_UPSTREAM_PROTO_PATH = "./spec/fixtures/grpc/hello.proto"
24+
local ZIPKIN_HOST = os.getenv("KONG_SPEC_TEST_ZIPKIN_HOST") or "localhost"
25+
local ZIPKIN_PORT = tonumber(os.getenv("KONG_SPEC_TEST_ZIPKIN_PORT")) or 9411
2426
local REDIS_HOST = os.getenv("KONG_SPEC_TEST_REDIS_HOST") or "localhost"
2527
local REDIS_PORT = tonumber(os.getenv("KONG_SPEC_TEST_REDIS_PORT") or 6379)
2628
local REDIS_SSL_PORT = tonumber(os.getenv("KONG_SPEC_TEST_REDIS_SSL_PORT") or 6380)
@@ -2816,7 +2818,12 @@ end
28162818
-- @field mock_upstream_stream_port
28172819
-- @field mock_upstream_stream_ssl_port
28182820
-- @field mock_grpc_upstream_proto_path
2819-
-- @field redis_host The hostname for a Redis instance if available. Port should be `6379`.
2821+
-- @field redis_host The host for Redis, it can be set by env KONG_SPEC_TEST_REDIS_HOST.
2822+
-- @field redis_port The port (SSL disabled) for Redis, it can be set by env KONG_SPEC_TEST_REDIS_PORT.
2823+
-- @field redis_ssl_port The port (SSL enabled) for Redis, it can be set by env KONG_SPEC_TEST_REDIS_SSL_PORT.
2824+
-- @field redis_ssl_sni The server name for Redis, it can be set by env KONG_SPEC_TEST_REDIS_SSL_SNI.
2825+
-- @field zipkin_host The host for Zipkin service, it can be set by env KONG_SPEC_TEST_ZIPKIN_HOST.
2826+
-- @field zipkin_port the port for Zipkin service, it can be set by env KONG_SPEC_TEST_ZIPKIN_PORT.
28202827

28212828
----------
28222829
-- Exposed
@@ -2858,6 +2865,9 @@ end
28582865
mock_upstream_stream_ssl_port = MOCK_UPSTREAM_STREAM_SSL_PORT,
28592866
mock_grpc_upstream_proto_path = MOCK_GRPC_UPSTREAM_PROTO_PATH,
28602867

2868+
zipkin_host = ZIPKIN_HOST,
2869+
zipkin_port = ZIPKIN_PORT,
2870+
28612871
redis_host = REDIS_HOST,
28622872
redis_port = REDIS_PORT,
28632873
redis_ssl_port = REDIS_SSL_PORT,

0 commit comments

Comments
 (0)