Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into feature/describe-rate-limit
Browse files Browse the repository at this point in the history
  • Loading branch information
steffendsommer committed Nov 17, 2017
2 parents 9db99d6 + a0e7b2a commit d764357
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Sources/RateLimiter.swift → Sources/Gatekeeper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public struct Rate {
}
}

public struct RateLimiter: Middleware {
public struct Gatekeeper: Middleware {
internal var cache: CacheProtocol

internal let limit: Int
Expand Down
18 changes: 9 additions & 9 deletions Tests/GatekeeperTests/GatekeeperTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import Foundation

class GatekeeperTests: XCTestCase {
static var allTests = [
("testRateLimiter", testRateLimiter),
("testRateLimiterNoPeer", testRateLimiterNoPeer),
("testRateLimiterCountRefresh", testRateLimiterCountRefresh),
("testGateKeeper", testGateKeeper),
("testGateKeeperNoPeer", testGateKeeperNoPeer),
("testGateKeeperCountRefresh", testGateKeeperCountRefresh),
("testRefreshIntervalValues", testRefreshIntervalValues),
]

func testRateLimiter() {
let middleware = RateLimiter(rate: Rate(10, per: .second))
func testGateKeeper() {
let middleware = Gatekeeper(rate: Rate(10, per: .second))
let request = getHTTPSRequest()

for i in 1...11 {
Expand All @@ -38,8 +38,8 @@ class GatekeeperTests: XCTestCase {
}
}

func testRateLimiterNoPeer() {
let middleware = RateLimiter(rate: Rate(100, per: .second))
func testGateKeeperNoPeer() {
let middleware = Gatekeeper(rate: Rate(100, per: .second))
let request = getHTTPRequest()

do {
Expand All @@ -57,8 +57,8 @@ class GatekeeperTests: XCTestCase {
}
}

func testRateLimiterCountRefresh() {
let middleware = RateLimiter(rate: Rate(100, per: .second))
func testGateKeeperCountRefresh() {
let middleware = Gatekeeper(rate: Rate(100, per: .second))
let request = getHTTPSRequest()

for _ in 0..<50 {
Expand Down

0 comments on commit d764357

Please sign in to comment.