[TT-11413] Fix apidef GlobalRateLimit migrations#6086
Conversation
|
API Changes --- prev.txt 2024-03-01 14:13:56.205265154 +0000
+++ current.txt 2024-03-01 14:13:53.369236010 +0000
@@ -1203,8 +1203,9 @@
}
type GlobalRateLimit struct {
- Rate float64 `bson:"rate" json:"rate"`
- Per float64 `bson:"per" json:"per"`
+ Disabled bool `bson:"disabled" json:"disabled"`
+ Rate float64 `bson:"rate" json:"rate"`
+ Per float64 `bson:"per" json:"per"`
}
type GoPluginMeta struct { |
|
PR Description updated to latest commit (1e4b48e) |
1e4b48e to
fe494f6
Compare
PR Review
Code feedback:
✨ Review tool usage guide:Overview: With a configuration file, use the following template:
See the review usage page for a comprehensive guide on using this tool. |
PR Code Suggestions
✨ Improve tool usage guide:Overview: With a configuration file, use the following template:
See the improve usage page for a more comprehensive guide on using this tool. |
|
API tests result - mongo44-sha256 env: success ✅ Typebug_fix, enhancement Description
Changes walkthrough
Co-authored-by: Tit Petric [email protected] |
|
API tests result - postgres15-sha256 env: success ✅ Typebug_fix, enhancement Description
Changes walkthrough
Co-authored-by: Tit Petric [email protected] |
|
|
/release to release-5.3 |
|
/release to release-5.3.0 |
|
Working on it! Note that it can take a few minutes. |
1 similar comment
|
Working on it! Note that it can take a few minutes. |
## **Type**
bug_fix, enhancement
___
## **Description**
- Added a `Disabled` boolean field to the `GlobalRateLimit` struct to
explicitly enable or disable global rate limits.
- Modified migration logic to consider the new `Disabled` flag, setting
it to true if either `Per` or `Rate` is less or equal to 0.
- Updated existing tests and added new ones to cover the changes in
global rate limit logic.
- Adjusted OpenAPI Specification (OAS) related code to utilize the new
`Disabled` flag for rate limiting.
___
## **Changes walkthrough**
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>api_definitions.go</strong><dd><code>Add Disabled Flag
to GlobalRateLimit Struct</code>
</dd></summary>
<hr>
apidef/api_definitions.go
<li>Added <code>Disabled</code> field to <code>GlobalRateLimit</code>
struct.<br> <li> This change allows for explicit disabling of global
rate limits.
</details>
</td>
<td><a
href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-9961ccc89a48d32db5b47ba3006315ef52f6e5007fb4b09f8c5d6d299c669d67">+3/-2</a>
</td>
</tr>
<tr>
<td>
<details>
<summary><strong>migration.go</strong><dd><code>Enhance GlobalRateLimit
Migration Logic</code>
</dd></summary>
<hr>
apidef/migration.go
<li>Modified condition to disable global rate limit based on new
<code>Disabled</code> <br>flag.<br> <li> Adjusted logic to set
<code>GlobalRateLimit.Disabled</code> true if <code>Per</code> or
<code>Rate</code> is <br>less or equal to 0.
</details>
</td>
<td><a
href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-e1d9b55a26f9d6225d56d6f0161959217308e5ad4d6934e7d7df4595d9c2a130">+4/-4</a>
</td>
</tr>
<tr>
<td>
<details>
<summary><strong>upstream.go</strong><dd><code>Use GlobalRateLimit
Disabled Flag in RateLimit Struct</code>
</dd></summary>
<hr>
apidef/oas/upstream.go
<li>Updated <code>RateLimit</code> struct methods to use
<code>GlobalRateLimit.Disabled</code> for <br>enabling/disabling rate
limits.
</details>
</td>
<td><a
href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-7b0941c7f37fe5a2a23047e0822a65519ca11c371660f36555b59a60f000e3f4">+2/-2</a>
</td>
</tr>
</table></td></tr><tr><td><strong>Tests</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>migration_test.go</strong><dd><code>Update Tests for
GlobalRateLimit Migration</code>
</dd></summary>
<hr>
apidef/migration_test.go
<li>Updated tests to reflect new <code>Disabled</code> flag logic in
global rate limit.<br> <li> Added test cases for various scenarios of
<code>Per</code> and <code>Rate</code> values.
</details>
</td>
<td><a
href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-d79d77f814074b9e483554e36687e22fda759045141c3b094b039428744ff94c">+26/-3</a>
</td>
</tr>
<tr>
<td>
<details>
<summary><strong>oas_test.go</strong><dd><code>Initialize
GlobalRateLimit Disabled in Tests</code>
</dd></summary>
<hr>
apidef/oas/oas_test.go
- Initialized `GlobalRateLimit.Disabled` to false in test setup.
</details>
</td>
<td><a
href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-74029ee88132d30d6478c96a35f8bb2200e0c8e6f42f2c9b147dc6bb7ce74644">+1/-0</a>
</td>
</tr>
</table></td></tr></tr></tbody></table>
___
> ✨ **PR-Agent usage**:
>Comment `/help` on the PR to get a list of all available PR-Agent tools
and their descriptions
---------
Co-authored-by: Tit Petric <[email protected]>
(cherry picked from commit 5e0b679)
…tions (#6086) [TT-11413] Fix apidef GlobalRateLimit migrations (#6086) ## **Type** bug_fix, enhancement ___ ## **Description** - Added a `Disabled` boolean field to the `GlobalRateLimit` struct to explicitly enable or disable global rate limits. - Modified migration logic to consider the new `Disabled` flag, setting it to true if either `Per` or `Rate` is less or equal to 0. - Updated existing tests and added new ones to cover the changes in global rate limit logic. - Adjusted OpenAPI Specification (OAS) related code to utilize the new `Disabled` flag for rate limiting. ___ ## **Changes walkthrough** <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>api_definitions.go</strong><dd><code>Add Disabled Flag to GlobalRateLimit Struct</code> </dd></summary> <hr> apidef/api_definitions.go <li>Added <code>Disabled</code> field to <code>GlobalRateLimit</code> struct.<br> <li> This change allows for explicit disabling of global rate limits. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-9961ccc89a48d32db5b47ba3006315ef52f6e5007fb4b09f8c5d6d299c669d67">+3/-2</a> </td> </tr> <tr> <td> <details> <summary><strong>migration.go</strong><dd><code>Enhance GlobalRateLimit Migration Logic</code> </dd></summary> <hr> apidef/migration.go <li>Modified condition to disable global rate limit based on new <code>Disabled</code> <br>flag.<br> <li> Adjusted logic to set <code>GlobalRateLimit.Disabled</code> true if <code>Per</code> or <code>Rate</code> is <br>less or equal to 0. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-e1d9b55a26f9d6225d56d6f0161959217308e5ad4d6934e7d7df4595d9c2a130">+4/-4</a> </td> </tr> <tr> <td> <details> <summary><strong>upstream.go</strong><dd><code>Use GlobalRateLimit Disabled Flag in RateLimit Struct</code> </dd></summary> <hr> apidef/oas/upstream.go <li>Updated <code>RateLimit</code> struct methods to use <code>GlobalRateLimit.Disabled</code> for <br>enabling/disabling rate limits. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-7b0941c7f37fe5a2a23047e0822a65519ca11c371660f36555b59a60f000e3f4">+2/-2</a> </td> </tr> </table></td></tr><tr><td><strong>Tests</strong></td><td><table> <tr> <td> <details> <summary><strong>migration_test.go</strong><dd><code>Update Tests for GlobalRateLimit Migration</code> </dd></summary> <hr> apidef/migration_test.go <li>Updated tests to reflect new <code>Disabled</code> flag logic in global rate limit.<br> <li> Added test cases for various scenarios of <code>Per</code> and <code>Rate</code> values. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-d79d77f814074b9e483554e36687e22fda759045141c3b094b039428744ff94c">+26/-3</a> </td> </tr> <tr> <td> <details> <summary><strong>oas_test.go</strong><dd><code>Initialize GlobalRateLimit Disabled in Tests</code> </dd></summary> <hr> apidef/oas/oas_test.go - Initialized `GlobalRateLimit.Disabled` to false in test setup. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-74029ee88132d30d6478c96a35f8bb2200e0c8e6f42f2c9b147dc6bb7ce74644">+1/-0</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > ✨ **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions --------- Co-authored-by: Tit Petric <[email protected]>
|
@lghiur Succesfully merged PR |
|
Still working... |
## **Type**
bug_fix, enhancement
___
## **Description**
- Added a `Disabled` boolean field to the `GlobalRateLimit` struct to
explicitly enable or disable global rate limits.
- Modified migration logic to consider the new `Disabled` flag, setting
it to true if either `Per` or `Rate` is less or equal to 0.
- Updated existing tests and added new ones to cover the changes in
global rate limit logic.
- Adjusted OpenAPI Specification (OAS) related code to utilize the new
`Disabled` flag for rate limiting.
___
## **Changes walkthrough**
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>api_definitions.go</strong><dd><code>Add Disabled Flag
to GlobalRateLimit Struct</code>
</dd></summary>
<hr>
apidef/api_definitions.go
<li>Added <code>Disabled</code> field to <code>GlobalRateLimit</code>
struct.<br> <li> This change allows for explicit disabling of global
rate limits.
</details>
</td>
<td><a
href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-9961ccc89a48d32db5b47ba3006315ef52f6e5007fb4b09f8c5d6d299c669d67">+3/-2</a>
</td>
</tr>
<tr>
<td>
<details>
<summary><strong>migration.go</strong><dd><code>Enhance GlobalRateLimit
Migration Logic</code>
</dd></summary>
<hr>
apidef/migration.go
<li>Modified condition to disable global rate limit based on new
<code>Disabled</code> <br>flag.<br> <li> Adjusted logic to set
<code>GlobalRateLimit.Disabled</code> true if <code>Per</code> or
<code>Rate</code> is <br>less or equal to 0.
</details>
</td>
<td><a
href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-e1d9b55a26f9d6225d56d6f0161959217308e5ad4d6934e7d7df4595d9c2a130">+4/-4</a>
</td>
</tr>
<tr>
<td>
<details>
<summary><strong>upstream.go</strong><dd><code>Use GlobalRateLimit
Disabled Flag in RateLimit Struct</code>
</dd></summary>
<hr>
apidef/oas/upstream.go
<li>Updated <code>RateLimit</code> struct methods to use
<code>GlobalRateLimit.Disabled</code> for <br>enabling/disabling rate
limits.
</details>
</td>
<td><a
href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-7b0941c7f37fe5a2a23047e0822a65519ca11c371660f36555b59a60f000e3f4">+2/-2</a>
</td>
</tr>
</table></td></tr><tr><td><strong>Tests</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>migration_test.go</strong><dd><code>Update Tests for
GlobalRateLimit Migration</code>
</dd></summary>
<hr>
apidef/migration_test.go
<li>Updated tests to reflect new <code>Disabled</code> flag logic in
global rate limit.<br> <li> Added test cases for various scenarios of
<code>Per</code> and <code>Rate</code> values.
</details>
</td>
<td><a
href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-d79d77f814074b9e483554e36687e22fda759045141c3b094b039428744ff94c">+26/-3</a>
</td>
</tr>
<tr>
<td>
<details>
<summary><strong>oas_test.go</strong><dd><code>Initialize
GlobalRateLimit Disabled in Tests</code>
</dd></summary>
<hr>
apidef/oas/oas_test.go
- Initialized `GlobalRateLimit.Disabled` to false in test setup.
</details>
</td>
<td><a
href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-74029ee88132d30d6478c96a35f8bb2200e0c8e6f42f2c9b147dc6bb7ce74644">+1/-0</a>
</td>
</tr>
</table></td></tr></tr></tbody></table>
___
> ✨ **PR-Agent usage**:
>Comment `/help` on the PR to get a list of all available PR-Agent tools
and their descriptions
---------
Co-authored-by: Tit Petric <[email protected]>
(cherry picked from commit 5e0b679)
…ons (#6086) [TT-11413] Fix apidef GlobalRateLimit migrations (#6086) ## **Type** bug_fix, enhancement ___ ## **Description** - Added a `Disabled` boolean field to the `GlobalRateLimit` struct to explicitly enable or disable global rate limits. - Modified migration logic to consider the new `Disabled` flag, setting it to true if either `Per` or `Rate` is less or equal to 0. - Updated existing tests and added new ones to cover the changes in global rate limit logic. - Adjusted OpenAPI Specification (OAS) related code to utilize the new `Disabled` flag for rate limiting. ___ ## **Changes walkthrough** <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>api_definitions.go</strong><dd><code>Add Disabled Flag to GlobalRateLimit Struct</code> </dd></summary> <hr> apidef/api_definitions.go <li>Added <code>Disabled</code> field to <code>GlobalRateLimit</code> struct.<br> <li> This change allows for explicit disabling of global rate limits. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-9961ccc89a48d32db5b47ba3006315ef52f6e5007fb4b09f8c5d6d299c669d67">+3/-2</a> </td> </tr> <tr> <td> <details> <summary><strong>migration.go</strong><dd><code>Enhance GlobalRateLimit Migration Logic</code> </dd></summary> <hr> apidef/migration.go <li>Modified condition to disable global rate limit based on new <code>Disabled</code> <br>flag.<br> <li> Adjusted logic to set <code>GlobalRateLimit.Disabled</code> true if <code>Per</code> or <code>Rate</code> is <br>less or equal to 0. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-e1d9b55a26f9d6225d56d6f0161959217308e5ad4d6934e7d7df4595d9c2a130">+4/-4</a> </td> </tr> <tr> <td> <details> <summary><strong>upstream.go</strong><dd><code>Use GlobalRateLimit Disabled Flag in RateLimit Struct</code> </dd></summary> <hr> apidef/oas/upstream.go <li>Updated <code>RateLimit</code> struct methods to use <code>GlobalRateLimit.Disabled</code> for <br>enabling/disabling rate limits. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-7b0941c7f37fe5a2a23047e0822a65519ca11c371660f36555b59a60f000e3f4">+2/-2</a> </td> </tr> </table></td></tr><tr><td><strong>Tests</strong></td><td><table> <tr> <td> <details> <summary><strong>migration_test.go</strong><dd><code>Update Tests for GlobalRateLimit Migration</code> </dd></summary> <hr> apidef/migration_test.go <li>Updated tests to reflect new <code>Disabled</code> flag logic in global rate limit.<br> <li> Added test cases for various scenarios of <code>Per</code> and <code>Rate</code> values. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-d79d77f814074b9e483554e36687e22fda759045141c3b094b039428744ff94c">+26/-3</a> </td> </tr> <tr> <td> <details> <summary><strong>oas_test.go</strong><dd><code>Initialize GlobalRateLimit Disabled in Tests</code> </dd></summary> <hr> apidef/oas/oas_test.go - Initialized `GlobalRateLimit.Disabled` to false in test setup. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-74029ee88132d30d6478c96a35f8bb2200e0c8e6f42f2c9b147dc6bb7ce74644">+1/-0</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > ✨ **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions --------- Co-authored-by: Tit Petric <[email protected]>
|
@lghiur Succesfully merged PR |
|
API tests result - postgres15-murmur64 env: success ✅ Typebug_fix, enhancement Description
Changes walkthrough
Co-authored-by: Tit Petric [email protected] |
|
API tests result - mongo44-murmur64 env: success ✅ Typebug_fix, enhancement Description
Changes walkthrough
Co-authored-by: Tit Petric [email protected] |



Type
bug_fix, enhancement
Description
Disabledboolean field to theGlobalRateLimitstruct to explicitly enable or disable global rate limits.Disabledflag, setting it to true if eitherPerorRateis less or equal to 0.Disabledflag for rate limiting.Changes walkthrough
api_definitions.go
Add Disabled Flag to GlobalRateLimit Structapidef/api_definitions.go
Disabledfield toGlobalRateLimitstruct.migration.go
Enhance GlobalRateLimit Migration Logicapidef/migration.go
Disabledflag.
GlobalRateLimit.Disabledtrue ifPerorRateisless or equal to 0.
upstream.go
Use GlobalRateLimit Disabled Flag in RateLimit Structapidef/oas/upstream.go
RateLimitstruct methods to useGlobalRateLimit.Disabledforenabling/disabling rate limits.
migration_test.go
Update Tests for GlobalRateLimit Migrationapidef/migration_test.go
Disabledflag logic in global rate limit.PerandRatevalues.oas_test.go
Initialize GlobalRateLimit Disabled in Testsapidef/oas/oas_test.go
GlobalRateLimit.Disabledto false in test setup.