TykTechnologies / tyk

Tyk Open Source API Gateway written in Go, supporting REST, GraphQL, TCP and gRPC protocols
Other
9.76k stars 1.09k forks source link

Merging to release-5.3: [TT-12975] Fix flaky test caused by missed Close invocation (#6481) #6483

Closed buger closed 2 months ago

buger commented 2 months ago

TT-12975 Fix flaky test caused by missed Close invocation (#6481)

PR Type

Bug fix, Tests


Description


Changes walkthrough ๐Ÿ“

Relevant files
Bug fix
server_test.go
Add resource cleanup to fix flaky test                                     

gateway/server_test.go
  • Added a defer ts.Close() statement to ensure resources are properly
    closed after the test execution.
  • This change addresses a potential resource leak that could cause flaky
    tests.
  • +1/-0     

    ๐Ÿ’ก 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

    github-actions[bot] commented 2 months ago

    API Changes

    no api changes detected
    github-actions[bot] commented 2 months ago

    PR Reviewer Guide ๐Ÿ”

    โฑ๏ธ Estimated effort to review: 2 ๐Ÿ”ต๐Ÿ”ตโšชโšชโšช
    ๐Ÿงช PR contains tests
    ๐Ÿ”’ No security concerns identified
    โšก No key issues to review
    github-actions[bot] commented 2 months ago

    PR Code Suggestions โœจ

    CategorySuggestion                                                                                                                                    Score
    Performance
    Specify a more focused package path in testArgs for better performance ___ **Consider using a more specific package path in the testArgs to avoid unnecessary
    test coverage computation for unrelated packages, which can improve the performance
    of the test suite.** [.taskfiles/test.yml [21]](https://github.com/TykTechnologies/tyk/pull/6483/files#diff-f1fbe7f7f14888019b8845634ed008e1c43f6e5a5c0b2707336fc7f8e15a36fbR21-R21) ```diff -testArgs: -coverpkg=github.com/TykTechnologies/tyk/...,./... {{.buildArgs}} +testArgs: -coverpkg=github.com/TykTechnologies/tyk/gateway/... {{.buildArgs}} ```
    Suggestion importance[1-10]: 7 Why: The suggestion is valid as it proposes a more specific package path, which can improve test performance by reducing unnecessary coverage computation. However, it is not crucial and only offers a minor optimization.
    7
    sonarcloud[bot] commented 2 months ago

    Quality Gate Passed Quality Gate passed

    Issues
    0 New issues
    0 Accepted issues

    Measures
    0 Security Hotspots
    0.0% Coverage on New Code
    0.0% Duplication on New Code

    See analysis details on SonarCloud