Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

increment version for bug fix

  • Loading branch information...
commit 7c032a3fec80eda79fd6c6b5c752ee5576677f79 1 parent 3537047
@dannycoates authored
Showing with 40 additions and 2 deletions.
  1. +1 −1  package.json
  2. +39 −1 test/endpoint_test.js
View
2  package.json
@@ -1,6 +1,6 @@
{
"name": "poolee",
- "version": "0.4.2",
+ "version": "0.4.3",
"description": "HTTP pool and load balancer",
"homepage": "http://github.com/dannycoates/poolee",
"author": "Danny Coates <dannycoates@gmail.com>",
View
40 test/endpoint_test.js
@@ -335,7 +335,8 @@ describe("Endpoint", function () {
it("maintains the correct pending count when requestCount 'overflows'", function () {
var e = new Endpoint(http, '127.0.0.1', 6969)
e.successes = (Math.pow(2, 52) / 2) - 250
- e.failures = (Math.pow(2, 52) / 2) - 250
+ e.failures = (Math.pow(2, 52) / 2) - 251
+ e.filtered = 1
e.requestCount = Math.pow(2, 52)
e.setPending()
assert.equal(e.pending, 500)
@@ -354,6 +355,43 @@ describe("Endpoint", function () {
})
//
+ // resetCounters
+ //
+ //////////////////////////////////////////////////////////////////////////////
+
+ describe("resetCounters()", function () {
+
+ it("sets successes, failures and filtered to 0", function () {
+ var e = new Endpoint(http, '127.0.0.1', 6969)
+ e.successes = (Math.pow(2, 52) / 2) - 250
+ e.failures = (Math.pow(2, 52) / 2) - 251
+ e.filtered = 1
+ e.requestCount = Math.pow(2, 52)
+ e.resetCounters()
+ assert.equal(e.successes, 0)
+ assert.equal(e.failures, 0)
+ assert.equal(e.filtered, 0)
+ })
+
+ it("sets requestCount = pending", function () {
+ var e = new Endpoint(http, '127.0.0.1', 6969)
+ e.pending = 500
+ e.requestRate = 400
+ e.requestCount = Math.pow(2, 52)
+ e.resetCounters()
+ assert.equal(e.requestCount, 500)
+ })
+
+ it("sets requestsLastCheck = requestRate - pending", function () {
+ var e = new Endpoint(http, '127.0.0.1', 6969)
+ e.pending = 500
+ e.requestRate = 600
+ e.resetCounters()
+ assert.equal(e.requestsLastCheck, 100)
+ })
+ })
+
+ //
// setHealthy
//
//////////////////////////////////////////////////////////////////////////////

0 comments on commit 7c032a3

Please sign in to comment.
Something went wrong with that request. Please try again.