-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merging to release-5.3: [TT-11806] Respect domain and listen path (#6289) #6290
Merging to release-5.3: [TT-11806] Respect domain and listen path (#6289) #6290
Conversation
### **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 <tit@tyk.io> (cherry picked from commit 55254bc)
API Changes --- prev.txt 2024-05-17 14:48:47.288352360 +0000
+++ current.txt 2024-05-17 14:48:44.456309062 +0000
@@ -11278,6 +11278,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 (335b36e) |
PR Review 🔍
Code feedback:
|
PR Code Suggestions ✨
|
💥 CI tests failed 🙈git-stateall ok Please look at the run or in the Checks tab. |
Quality Gate passedIssues Measures |
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:
https://tyktech.atlassian.net/browse/TT-11806
PR Type
enhancement, bug_fix, tests
Description
length.
routing.
routes.
Changes walkthrough 📝
api_loader.go
Enhance API loading with domain prioritization and minor fixes
gateway/api_loader.go
path length.
http.go
Support host header in HTTP tests
test/http.go
api_test.go
Remove redundant API loading order test
gateway/api_test.go
issue_11806_test.go
Add regression tests for domain routing
tests/regression/issue_11806_test.go
issue-11806-api-no-domain.json
Add test API spec without domain
tests/regression/testdata/issue-11806-api-no-domain.json
issue-11806-api-with-domain.json
Add test API spec with domain
tests/regression/testdata/issue-11806-api-with-domain.json
Co-authored-by: Tit Petric tit@tyk.io
PR Type
Enhancement, Bug fix, Tests
Description
Changes walkthrough 📝
api_loader.go
Enhance API loading with domain prioritization and minor fixes
gateway/api_loader.go
path length.
http.go
Support host header in HTTP tests
test/http.go
api_test.go
Remove outdated API loader path order test
gateway/api_test.go
ordering.
issue_11806_test.go
Comprehensive regression tests for domain routing
tests/regression/issue_11806_test.go
behavior.
issue-11806-api-no-domain.json
New test API spec without domain
tests/regression/testdata/issue-11806-api-no-domain.json
issue-11806-api-with-domain.json
New test API spec with domain
tests/regression/testdata/issue-11806-api-with-domain.json
ci-tests.yml
Update CI configuration for test exclusions
.github/workflows/ci-tests.yml