-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add basic YAML configuration support * Redo multi-document support and get tests running * Fix incorrect config filename in tests * Get tests passing * Add deprecation message to get-* commands * Remove set deprecation messages from get commands * Get tests working with deprecated commands * Don't apply global rate limit during Jails test * Add full support for new config format * Add changes to CLI * Update unit tests to use new Deprecated method names * Finish updating unit tests to use Deprecated method names * Remove wayward Println * Add JSON tags and flags to indicate if deprecated fields are in use * Add deprecated to main.go function names * Fix incorrect Kind in e2e jail config YAML * Add deletion tests for new CLI * Persist useDeprecated flags to Redis * Separate config files per test * Fix deprecated tests using wrong applyGuardianConfig() * Set GlobalRateLimit and GlobalSettings for deprecated Set* tests * Add GlobalRateLimit and GlobalSettings to more tests * Avoid running E2E tests in parallel * Update CLI help and fix get command bug Added a deprecated note to the CLI help for the deprecated CLI interface. Fixed Fetch*Configs() initializing slice with len instead of cap * Implement easy CR changes and add working stdin `apply` * Avoid using opaque structs as map keys * Make unit tests use paths instead of URLs * Fix get RateLimit not printing * Use distinct YAML spec keys to simplify decoding * Fix incorrect spec key for TestDeleteRateLimit * Cycle through available Redis DBs when testing * Remove deprecated RedisConfStore methods and fields and update unit tests * Readability/style changes for CR * Fix incorrect metric reporting method Co-authored-by: Will Alexander <[email protected]>
- Loading branch information
1 parent
37cbced
commit effed86
Showing
37 changed files
with
2,026 additions
and
952 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: "v0" | ||
kind: GlobalRateLimit | ||
name: GlobalRateLimit | ||
description: GlobalRateLimit | ||
globalRateLimitSpec: | ||
limit: | ||
count: 5 | ||
duration: 1s | ||
enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: "v0" | ||
kind: GlobalSettings | ||
name: GlobalSettings | ||
description: GlobalSettings | ||
globalSettingsSpec: | ||
reportOnly: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: "v0" | ||
kind: GlobalRateLimit | ||
name: GlobalRateLimit | ||
description: GlobalRateLimit | ||
globalRateLimitSpec: | ||
limit: | ||
count: 5 | ||
duration: 1m | ||
enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: "v0" | ||
kind: GlobalSettings | ||
name: GlobalSettings | ||
description: GlobalSettings | ||
globalSettingsSpec: | ||
reportOnly: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
version: "v0" | ||
kind: Jail | ||
name: "/foo/bar" | ||
description: "/foo/bar" | ||
jailSpec: | ||
limit: | ||
count: 10 | ||
duration: 10s | ||
enabled: true | ||
conditions: | ||
path: "/foo/bar" | ||
banDuration: 30s # Keep this duration short as it's used in tests | ||
--- | ||
version: "v0" | ||
kind: Jail | ||
name: "/foo/baz" | ||
description: "/foo/baz" | ||
jailSpec: | ||
limit: | ||
count: 5 | ||
duration: 1m | ||
enabled: false | ||
conditions: | ||
path: "/foo/baz" | ||
banDuration: 30s # Keep this duration short as it's used in tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: "v0" | ||
kind: GlobalRateLimit | ||
name: GlobalRateLimit | ||
description: GlobalRateLimit | ||
globalRateLimitSpec: | ||
limit: | ||
count: 5 | ||
duration: 1m | ||
enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: "v0" | ||
kind: GlobalSettings | ||
name: GlobalSettings | ||
description: GlobalSettings | ||
globalSettingsSpec: | ||
reportOnly: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
version: "v0" | ||
kind: RateLimit | ||
name: "/foo/bar" | ||
description: "/foo/bar" | ||
rateLimitSpec: | ||
limit: | ||
count: 10 | ||
duration: 1m | ||
enabled: true | ||
conditions: | ||
path: "/foo/bar" | ||
--- | ||
version: "v0" | ||
kind: RateLimit | ||
name: "/foo/baz" | ||
description: "/foo/baz" | ||
rateLimitSpec: | ||
limit: | ||
count: 5 | ||
duration: 1m | ||
enabled: false | ||
conditions: | ||
path: "/foo/baz" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: "v0" | ||
kind: GlobalRateLimit | ||
name: GlobalRateLimit | ||
description: GlobalRateLimit | ||
globalRateLimitSpec: | ||
limit: | ||
count: 5 | ||
duration: 1m | ||
enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: "v0" | ||
kind: GlobalSettings | ||
name: GlobalSettings | ||
description: GlobalSettings | ||
globalSettingsSpec: | ||
reportOnly: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: "v0" | ||
kind: GlobalRateLimit | ||
name: GlobalRateLimit | ||
description: GlobalRateLimit | ||
globalRateLimitSpec: | ||
limit: | ||
count: 5 | ||
duration: 1m | ||
enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: "v0" | ||
kind: GlobalSettings | ||
name: GlobalSettings | ||
description: GlobalSettings | ||
globalSettingsSpec: | ||
reportOnly: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
version: "v0" | ||
kind: Jail | ||
name: "/foo/bar" | ||
description: "/foo/bar" | ||
jailSpec: | ||
limit: | ||
count: 10 | ||
duration: 10s | ||
enabled: true | ||
conditions: | ||
path: "/foo/bar" | ||
banDuration: 30s # Keep this duration short as it's used in tests | ||
--- | ||
version: "v0" | ||
kind: Jail | ||
name: "/foo/baz" | ||
description: "/foo/baz" | ||
jailSpec: | ||
limit: | ||
count: 5 | ||
duration: 1m | ||
enabled: false | ||
conditions: | ||
path: "/foo/baz" | ||
banDuration: 30s # Keep this duration short as it's used in tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: "v0" | ||
kind: GlobalRateLimit | ||
name: GlobalRateLimit | ||
description: GlobalRateLimit | ||
globalRateLimitSpec: | ||
limit: | ||
count: 100 | ||
duration: 1s | ||
enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: "v0" | ||
kind: GlobalSettings | ||
name: GlobalSettings | ||
description: GlobalSettings | ||
globalSettingsSpec: | ||
reportOnly: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
version: "v0" | ||
kind: RateLimit | ||
name: "/foo/bar" | ||
description: "/foo/bar" | ||
rateLimitSpec: | ||
limit: | ||
count: 10 | ||
duration: 1m | ||
enabled: true | ||
conditions: | ||
path: "/foo/bar" | ||
--- | ||
version: "v0" | ||
kind: RateLimit | ||
name: "/foo/baz" | ||
description: "/foo/baz" | ||
rateLimitSpec: | ||
limit: | ||
count: 5 | ||
duration: 1m | ||
enabled: false | ||
conditions: | ||
path: "/foo/baz" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
jails: | ||
- route: "/foo/bar" | ||
jail: | ||
limit: | ||
duration: 10s | ||
enabled: true | ||
count: 10 | ||
banDuration: 30s # Keep this duration short as it's used in tests | ||
- route: "/foo/baz" | ||
jail: | ||
limit: | ||
duration: 1m | ||
enabled: false | ||
count: 5 | ||
banDuration: 30s # Keep this duration short as it's used in tests |
11 changes: 11 additions & 0 deletions
11
e2e/config/TestRemoveRouteRateLimitsDeprecated/routeratelimitconfig.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
route_rate_limits: | ||
- route: "/foo/bar" | ||
limit: | ||
duration: 1m | ||
enabled: true | ||
count: 10 | ||
- route: "/foo/baz" | ||
limit: | ||
duration: 1m | ||
enabled: false | ||
count: 5 |
11 changes: 11 additions & 0 deletions
11
e2e/config/TestRouteRateLimitDeprecated/routeratelimitconfig.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
route_rate_limits: | ||
- route: "/foo/bar" | ||
limit: | ||
duration: 1m | ||
enabled: true | ||
count: 10 | ||
- route: "/foo/baz" | ||
limit: | ||
duration: 1m | ||
enabled: false | ||
count: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
jails: | ||
- route: "/foo/bar" | ||
jail: | ||
limit: | ||
duration: 10s | ||
enabled: true | ||
count: 10 | ||
banDuration: 30s # Keep this duration short as it's used in tests | ||
- route: "/foo/baz" | ||
jail: | ||
limit: | ||
duration: 1m | ||
enabled: false | ||
count: 5 | ||
banDuration: 30s # Keep this duration short as it's used in tests |
11 changes: 11 additions & 0 deletions
11
e2e/config/TestSetRouteRateLimitsDeprecated/routeratelimitconfig.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
route_rate_limits: | ||
- route: "/foo/bar" | ||
limit: | ||
duration: 1m | ||
enabled: true | ||
count: 10 | ||
- route: "/foo/baz" | ||
limit: | ||
duration: 1m | ||
enabled: false | ||
count: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: "v0" | ||
kind: GlobalRateLimit | ||
name: GlobalRateLimit | ||
description: GlobalRateLimit | ||
globalRateLimitSpec: | ||
limit: | ||
count: 5 | ||
duration: 1s | ||
enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: "v0" | ||
kind: GlobalSettings | ||
name: GlobalSettings | ||
description: GlobalSettings | ||
globalSettingsSpec: | ||
reportOnly: false |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.