DEV: Add test case for /srv/status probers (#9259)

This commit is contained in:
Kane York 2020-03-23 22:28:07 -07:00 committed by GitHub
parent 4452817ed0
commit 58ae0d4bd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -79,10 +79,18 @@ describe Middleware::RequestTracker do
Middleware::RequestTracker.log_request(data)
# /srv/status is never a tracked view because content-type is text/plain
data = Middleware::RequestTracker.get_data(env(
"HTTP_USER_AGENT" => "kube-probe/1.18",
"REQUEST_URI" => "/srv/status?shutdown_ok=1",
), ["200", { "Content-Type" => 'text/plain' }], 0.1)
Middleware::RequestTracker.log_request(data)
ApplicationRequest.write_cache!
expect(ApplicationRequest.http_total.first.count).to eq(3)
expect(ApplicationRequest.http_2xx.first.count).to eq(3)
expect(ApplicationRequest.http_total.first.count).to eq(4)
expect(ApplicationRequest.http_2xx.first.count).to eq(4)
expect(ApplicationRequest.page_view_anon.first.count).to eq(2)
expect(ApplicationRequest.page_view_crawler.first.count).to eq(1)