Skip to content

Commit

Permalink
tests(helpers) make host and port of Zipkin configurable (#8626)
Browse files Browse the repository at this point in the history
Move zipkin default host and port into spec/helpers and update plugin test to use those.
  • Loading branch information
ADD-SP committed May 16, 2022
1 parent 82fa99d commit 46eeef8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions spec/03-plugins/34-zipkin/zipkin_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ local to_hex = require "resty.string".to_hex

local fmt = string.format

local ZIPKIN_HOST = os.getenv("ZIPKIN_HOST") or "127.0.0.1"
local ZIPKIN_PORT = 9411
local ZIPKIN_HOST = helpers.zipkin_host
local ZIPKIN_PORT = helpers.zipkin_port
local GRPCBIN_HOST = "127.0.0.1"
local GRPCBIN_PORT = 15002

Expand Down
12 changes: 11 additions & 1 deletion spec/helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ local MOCK_UPSTREAM_SSL_PORT = 15556
local MOCK_UPSTREAM_STREAM_PORT = 15557
local MOCK_UPSTREAM_STREAM_SSL_PORT = 15558
local MOCK_GRPC_UPSTREAM_PROTO_PATH = "./spec/fixtures/grpc/hello.proto"
local ZIPKIN_HOST = os.getenv("KONG_SPEC_TEST_ZIPKIN_HOST") or "localhost"
local ZIPKIN_PORT = tonumber(os.getenv("KONG_SPEC_TEST_ZIPKIN_PORT")) or 9411
local REDIS_HOST = os.getenv("KONG_SPEC_TEST_REDIS_HOST") or "localhost"
local REDIS_PORT = tonumber(os.getenv("KONG_SPEC_TEST_REDIS_PORT") or 6379)
local REDIS_SSL_PORT = tonumber(os.getenv("KONG_SPEC_TEST_REDIS_SSL_PORT") or 6380)
Expand Down Expand Up @@ -2816,7 +2818,12 @@ end
-- @field mock_upstream_stream_port
-- @field mock_upstream_stream_ssl_port
-- @field mock_grpc_upstream_proto_path
-- @field redis_host The hostname for a Redis instance if available. Port should be `6379`.
-- @field redis_host The host for Redis, it can be set by env KONG_SPEC_TEST_REDIS_HOST.
-- @field redis_port The port (SSL disabled) for Redis, it can be set by env KONG_SPEC_TEST_REDIS_PORT.
-- @field redis_ssl_port The port (SSL enabled) for Redis, it can be set by env KONG_SPEC_TEST_REDIS_SSL_PORT.
-- @field redis_ssl_sni The server name for Redis, it can be set by env KONG_SPEC_TEST_REDIS_SSL_SNI.
-- @field zipkin_host The host for Zipkin service, it can be set by env KONG_SPEC_TEST_ZIPKIN_HOST.
-- @field zipkin_port the port for Zipkin service, it can be set by env KONG_SPEC_TEST_ZIPKIN_PORT.

----------
-- Exposed
Expand Down Expand Up @@ -2858,6 +2865,9 @@ end
mock_upstream_stream_ssl_port = MOCK_UPSTREAM_STREAM_SSL_PORT,
mock_grpc_upstream_proto_path = MOCK_GRPC_UPSTREAM_PROTO_PATH,

zipkin_host = ZIPKIN_HOST,
zipkin_port = ZIPKIN_PORT,

redis_host = REDIS_HOST,
redis_port = REDIS_PORT,
redis_ssl_port = REDIS_SSL_PORT,
Expand Down

0 comments on commit 46eeef8

Please sign in to comment.