[TT-11806] Respect domain and listen path#6289
Conversation
|
API Changes --- prev.txt 2024-05-17 13:23:45.317943174 +0000
+++ current.txt 2024-05-17 13:23:42.333943951 +0000
@@ -11542,6 +11542,7 @@
func (r TCPTestRunner) Run(t testing.TB, testCases ...TCPTestCase) error
type TestCase struct {
+ Host string `json:",omitempty"`
Method string `json:",omitempty"`
Path string `json:",omitempty"`
BaseURL string `json:",omitempty"` |
|
PR Description updated to latest commit (dcc6257) |
PR Review 🔍
Code feedback:
|
PR Code Suggestions ✨
|
|
|
/release to release-5.3 |
|
Working on it! Note that it can take a few minutes. |
### **User description** PR reorders api specs with domains to be registered before fallback (no-domain) specs. Adds: - Ability to set the host header for tests, - Regression test testing gorilla mux expectations - Moves a domain based api test out of gateway scope - Tests loading apis with/without domain in different order https://tyktech.atlassian.net/browse/TT-11806 ___ ### **PR Type** enhancement, bug_fix, tests ___ ### **Description** - Enhanced domain handling in API spec loading by prioritizing domain length. - Fixed minor issues and typos in API loading logic. - Added support for setting the host header in HTTP tests. - Introduced comprehensive regression tests to ensure correct domain routing. - Added new test API specifications for testing domain and non-domain routes. ___ ### **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_loader.go</strong><dd><code>Enhance API loading with domain prioritization and minor fixes</code></dd></summary> <hr> gateway/api_loader.go <li>Improved domain handling in API spec counting.<br> <li> Fixed a typo in a comment.<br> <li> Modified the sorting logic to prioritize domain length before listen <br>path length.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6289/files#diff-cdf0b7f176c9d18e1a314b78ddefc2cb3a94b3de66f1f360174692c915734c68">+7/-5</a> </td> </tr> <tr> <td> <details> <summary><strong>http.go</strong><dd><code>Support host header in HTTP tests</code> </dd></summary> <hr> test/http.go - Added support for setting the host header in HTTP test cases. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6289/files#diff-a5530e34c740ce6fe2efe8dda5a356463c450696b39b97b91228f1be2491e05e">+5/-0</a> </td> </tr> </table></td></tr><tr><td><strong>Tests </strong></td><td><table> <tr> <td> <details> <summary><strong>api_test.go</strong><dd><code>Remove redundant API loading order test</code> </dd></summary> <hr> gateway/api_test.go - Removed a redundant test case for API loading order. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6289/files#diff-10b4a3d7bdd8d98e48b288d27fd46d9ee436617806c46913fdf7942c0e4a992e">+0/-50</a> </td> </tr> <tr> <td> <details> <summary><strong>issue_11806_test.go</strong><dd><code>Add regression tests for domain routing</code> </dd></summary> <hr> tests/regression/issue_11806_test.go <li>Added comprehensive regression tests for domain routing issues.<br> <li> Included tests for mux router and gateway router behaviors.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6289/files#diff-6414917e8c31f924c3a423765e285a34d988e923bd0f10d5cc56bacad99195d8">+165/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>issue-11806-api-no-domain.json</strong><dd><code>Add test API spec without domain</code> </dd></summary> <hr> tests/regression/testdata/issue-11806-api-no-domain.json - Added a new test API spec without a domain. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6289/files#diff-e8d8e335343405ef0e02562a51b4f8966cc03fe429e2c4b987504c6147bc00a7">+24/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>issue-11806-api-with-domain.json</strong><dd><code>Add test API spec with domain</code> </dd></summary> <hr> tests/regression/testdata/issue-11806-api-with-domain.json - Added a new test API spec with a domain. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6289/files#diff-f2b780fe118cacccbfe27e8784d7d2bae3cdc20f37c7bdccb4cf8146c9e6187b">+24/-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 55254bc)
|
@titpetric Succesfully merged PR |
) (#6290) ### **User description** [TT-11806] Respect domain and listen path (#6289) ### **User description** PR reorders api specs with domains to be registered before fallback (no-domain) specs. Adds: - Ability to set the host header for tests, - Regression test testing gorilla mux expectations - Moves a domain based api test out of gateway scope - Tests loading apis with/without domain in different order https://tyktech.atlassian.net/browse/TT-11806 ___ ### **PR Type** enhancement, bug_fix, tests ___ ### **Description** - Enhanced domain handling in API spec loading by prioritizing domain length. - Fixed minor issues and typos in API loading logic. - Added support for setting the host header in HTTP tests. - Introduced comprehensive regression tests to ensure correct domain routing. - Added new test API specifications for testing domain and non-domain routes. ___ ### **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_loader.go</strong><dd><code>Enhance API loading with domain prioritization and minor fixes</code></dd></summary> <hr> gateway/api_loader.go <li>Improved domain handling in API spec counting.<br> <li> Fixed a typo in a comment.<br> <li> Modified the sorting logic to prioritize domain length before listen <br>path length.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6289/files#diff-cdf0b7f176c9d18e1a314b78ddefc2cb3a94b3de66f1f360174692c915734c68">+7/-5</a> </td> </tr> <tr> <td> <details> <summary><strong>http.go</strong><dd><code>Support host header in HTTP tests</code> </dd></summary> <hr> test/http.go - Added support for setting the host header in HTTP test cases. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6289/files#diff-a5530e34c740ce6fe2efe8dda5a356463c450696b39b97b91228f1be2491e05e">+5/-0</a> </td> </tr> </table></td></tr><tr><td><strong>Tests </strong></td><td><table> <tr> <td> <details> <summary><strong>api_test.go</strong><dd><code>Remove redundant API loading order test</code> </dd></summary> <hr> gateway/api_test.go - Removed a redundant test case for API loading order. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6289/files#diff-10b4a3d7bdd8d98e48b288d27fd46d9ee436617806c46913fdf7942c0e4a992e">+0/-50</a> </td> </tr> <tr> <td> <details> <summary><strong>issue_11806_test.go</strong><dd><code>Add regression tests for domain routing</code> </dd></summary> <hr> tests/regression/issue_11806_test.go <li>Added comprehensive regression tests for domain routing issues.<br> <li> Included tests for mux router and gateway router behaviors.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6289/files#diff-6414917e8c31f924c3a423765e285a34d988e923bd0f10d5cc56bacad99195d8">+165/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>issue-11806-api-no-domain.json</strong><dd><code>Add test API spec without domain</code> </dd></summary> <hr> tests/regression/testdata/issue-11806-api-no-domain.json - Added a new test API spec without a domain. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6289/files#diff-e8d8e335343405ef0e02562a51b4f8966cc03fe429e2c4b987504c6147bc00a7">+24/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>issue-11806-api-with-domain.json</strong><dd><code>Add test API spec with domain</code> </dd></summary> <hr> tests/regression/testdata/issue-11806-api-with-domain.json - Added a new test API spec with a domain. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6289/files#diff-f2b780fe118cacccbfe27e8784d7d2bae3cdc20f37c7bdccb4cf8146c9e6187b">+24/-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]> [TT-11806]: https://tyktech.atlassian.net/browse/TT-11806?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ ___ ### **PR Type** Enhancement, Bug fix, Tests ___ ### **Description** - Enhanced domain handling in API spec loading by prioritizing domain length. - Fixed minor issues and typos in API loading logic. - Added support for setting the host header in HTTP tests. - Introduced comprehensive regression tests to ensure correct domain routing. - Added new test API specifications for testing domain and non-domain routes. ___ ### **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_loader.go</strong><dd><code>Enhance API loading with domain prioritization and minor fixes</code></dd></summary> <hr> gateway/api_loader.go <li>Improved domain handling in API spec counting.<br> <li> Fixed a typo in a comment.<br> <li> Modified the sorting logic to prioritize domain length before listen <br>path length.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6290/files#diff-cdf0b7f176c9d18e1a314b78ddefc2cb3a94b3de66f1f360174692c915734c68">+7/-5</a> </td> </tr> <tr> <td> <details> <summary><strong>http.go</strong><dd><code>Support host header in HTTP tests</code> </dd></summary> <hr> test/http.go - Added support for setting the host header in HTTP tests. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6290/files#diff-a5530e34c740ce6fe2efe8dda5a356463c450696b39b97b91228f1be2491e05e">+5/-0</a> </td> </tr> </table></td></tr><tr><td><strong>Tests </strong></td><td><table> <tr> <td> <details> <summary><strong>api_test.go</strong><dd><code>Remove outdated API loader path order test</code> </dd></summary> <hr> gateway/api_test.go <li>Removed a large block of test code related to API loader path <br>ordering.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6290/files#diff-10b4a3d7bdd8d98e48b288d27fd46d9ee436617806c46913fdf7942c0e4a992e">+0/-50</a> </td> </tr> <tr> <td> <details> <summary><strong>issue_11806_test.go</strong><dd><code>Comprehensive regression tests for domain routing</code> </dd></summary> <hr> tests/regression/issue_11806_test.go <li>Added a comprehensive regression test suite for domain routing issues.<br> <li> Tests both loading orders of APIs with and without domains.<br> <li> Includes direct testing with gorilla/mux to ensure correct subrouter <br>behavior.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6290/files#diff-6414917e8c31f924c3a423765e285a34d988e923bd0f10d5cc56bacad99195d8">+176/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>issue-11806-api-no-domain.json</strong><dd><code>New test API spec without domain</code> </dd></summary> <hr> tests/regression/testdata/issue-11806-api-no-domain.json - Added a new test API specification without a domain. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6290/files#diff-e8d8e335343405ef0e02562a51b4f8966cc03fe429e2c4b987504c6147bc00a7">+24/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>issue-11806-api-with-domain.json</strong><dd><code>New test API spec with domain</code> </dd></summary> <hr> tests/regression/testdata/issue-11806-api-with-domain.json - Added a new test API specification with a domain. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6290/files#diff-f2b780fe118cacccbfe27e8784d7d2bae3cdc20f37c7bdccb4cf8146c9e6187b">+24/-0</a> </td> </tr> </table></td></tr><tr><td><strong>Configuration changes </strong></td><td><table> <tr> <td> <details> <summary><strong>ci-tests.yml</strong><dd><code>Update CI configuration for test exclusions</code> </dd></summary> <hr> .github/workflows/ci-tests.yml - Updated SonarQube test exclusions to include the 'test' directory. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6290/files#diff-03609cb60b0c6e92fb771eb8787d6722b8c31ca4c03eabc788e147acd8c6fb43">+1/-1</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]>
### **User description** PR reorders api specs with domains to be registered before fallback (no-domain) specs. Adds: - Ability to set the host header for tests, - Regression test testing gorilla mux expectations - Moves a domain based api test out of gateway scope - Tests loading apis with/without domain in different order https://tyktech.atlassian.net/browse/TT-11806 ___ ### **PR Type** enhancement, bug_fix, tests ___ ### **Description** - Enhanced domain handling in API spec loading by prioritizing domain length. - Fixed minor issues and typos in API loading logic. - Added support for setting the host header in HTTP tests. - Introduced comprehensive regression tests to ensure correct domain routing. - Added new test API specifications for testing domain and non-domain routes. ___ ### **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_loader.go</strong><dd><code>Enhance API loading with domain prioritization and minor fixes</code></dd></summary> <hr> gateway/api_loader.go <li>Improved domain handling in API spec counting.<br> <li> Fixed a typo in a comment.<br> <li> Modified the sorting logic to prioritize domain length before listen <br>path length.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6289/files#diff-cdf0b7f176c9d18e1a314b78ddefc2cb3a94b3de66f1f360174692c915734c68">+7/-5</a> </td> </tr> <tr> <td> <details> <summary><strong>http.go</strong><dd><code>Support host header in HTTP tests</code> </dd></summary> <hr> test/http.go - Added support for setting the host header in HTTP test cases. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6289/files#diff-a5530e34c740ce6fe2efe8dda5a356463c450696b39b97b91228f1be2491e05e">+5/-0</a> </td> </tr> </table></td></tr><tr><td><strong>Tests </strong></td><td><table> <tr> <td> <details> <summary><strong>api_test.go</strong><dd><code>Remove redundant API loading order test</code> </dd></summary> <hr> gateway/api_test.go - Removed a redundant test case for API loading order. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6289/files#diff-10b4a3d7bdd8d98e48b288d27fd46d9ee436617806c46913fdf7942c0e4a992e">+0/-50</a> </td> </tr> <tr> <td> <details> <summary><strong>issue_11806_test.go</strong><dd><code>Add regression tests for domain routing</code> </dd></summary> <hr> tests/regression/issue_11806_test.go <li>Added comprehensive regression tests for domain routing issues.<br> <li> Included tests for mux router and gateway router behaviors.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6289/files#diff-6414917e8c31f924c3a423765e285a34d988e923bd0f10d5cc56bacad99195d8">+165/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>issue-11806-api-no-domain.json</strong><dd><code>Add test API spec without domain</code> </dd></summary> <hr> tests/regression/testdata/issue-11806-api-no-domain.json - Added a new test API spec without a domain. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6289/files#diff-e8d8e335343405ef0e02562a51b4f8966cc03fe429e2c4b987504c6147bc00a7">+24/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>issue-11806-api-with-domain.json</strong><dd><code>Add test API spec with domain</code> </dd></summary> <hr> tests/regression/testdata/issue-11806-api-with-domain.json - Added a new test API spec with a domain. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6289/files#diff-f2b780fe118cacccbfe27e8784d7d2bae3cdc20f37c7bdccb4cf8146c9e6187b">+24/-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]>



User description
PR reorders api specs with domains to be registered before fallback (no-domain) specs.
Adds:
https://tyktech.atlassian.net/browse/TT-11806
PR Type
enhancement, bug_fix, tests
Description
Changes walkthrough 📝
api_loader.go
Enhance API loading with domain prioritization and minor fixesgateway/api_loader.go
path length.
http.go
Support host header in HTTP teststest/http.go
api_test.go
Remove redundant API loading order testgateway/api_test.go
issue_11806_test.go
Add regression tests for domain routingtests/regression/issue_11806_test.go
issue-11806-api-no-domain.json
Add test API spec without domaintests/regression/testdata/issue-11806-api-no-domain.json
issue-11806-api-with-domain.json
Add test API spec with domaintests/regression/testdata/issue-11806-api-with-domain.json