Skip to content

Commit

Permalink
Merge pull request #356 from Mashape/fix/travis
Browse files Browse the repository at this point in the history
Fixing tests
  • Loading branch information
subnetmarco committed Jun 25, 2015
2 parents b82c568 + 4b19c62 commit f5e4ca6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions spec/plugins/logging_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ local STUB_GET_URL = spec_helper.STUB_GET_URL
local TCP_PORT = 20777
local UDP_PORT = 20778
local HTTP_PORT = 20779
local HTTP_DELAY_PORT = 20780

local FILE_LOG_PATH = spec_helper.get_env().configuration.nginx_working_dir.."/file_log_spec_output.log"

Expand All @@ -31,7 +32,7 @@ describe("Logging Plugins", function()
spec_helper.insert_fixtures {
api = {
{ name = "tests tcp logging", public_dns = "tcp_logging.com", target_url = "http://mockbin.com" },
{ name = "tests tcp logging2", public_dns = "tcp_logging2.com", target_url = "http://localhost:"..HTTP_PORT },
{ name = "tests tcp logging2", public_dns = "tcp_logging2.com", target_url = "http://localhost:"..HTTP_DELAY_PORT },
{ name = "tests udp logging", public_dns = "udp_logging.com", target_url = "http://mockbin.com" },
{ name = "tests http logging", public_dns = "http_logging.com", target_url = "http://mockbin.com" },
{ name = "tests https logging", public_dns = "https_logging.com", target_url = "http://mockbin.com" },
Expand Down Expand Up @@ -72,7 +73,7 @@ describe("Logging Plugins", function()
end)

it("should log proper latencies", function()
local http_thread = spec_helper.start_http_server(HTTP_PORT) -- Starting the mock TCP server
local http_thread = spec_helper.start_http_server(HTTP_DELAY_PORT) -- Starting the mock TCP server
local tcp_thread = spec_helper.start_tcp_server(TCP_PORT) -- Starting the mock TCP server

-- Making the request
Expand All @@ -88,7 +89,7 @@ describe("Logging Plugins", function()
local log_message = cjson.decode(res)

assert.truthy(log_message.latencies.proxy < 3000)
assert.truthy(log_message.latencies.kong < 20)
assert.truthy(log_message.latencies.kong < 100)
assert.truthy(log_message.latencies.request >= log_message.latencies.kong + log_message.latencies.proxy)

http_thread:join()
Expand Down

0 comments on commit f5e4ca6

Please sign in to comment.