Skip to content
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

[DX-1780]Generate test for tyk gateway swagger #6760

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

yurisasuke
Copy link
Member

@yurisasuke yurisasuke commented Dec 10, 2024

User description

DX-1780
Summary Create contract tests for the tyk gateway
Type Story Story
Status In Progress
Points N/A
Labels -

DX-1780


PR Type

Tests, Enhancement


Description

  • Updated OpenAPI schema references in .redocly.lint-ignore.yaml and swagger.yml to use a local copy hosted in the Tyk repository.
  • Added comprehensive test cases for managing APIs and policies in tests/schema/api_operations.yaml, including create, delete, and update operations with HTTP assertions.
  • Introduced a package.json file to manage dependencies and scripts, including Portman for contract testing.
  • Added a Portman CLI options configuration file (portman-cli-options.json) to define local OpenAPI file, base URL, and output settings for Postman collections.
  • Added a detailed Portman configuration file (portmanconfig.json) to define contract tests, variable assignments, request overwrites, and global settings for API testing.

Changes walkthrough 📝

Relevant files
Enhancement
.redocly.lint-ignore.yaml
Update OpenAPI schema reference to local Tyk-hosted copy 

.redocly.lint-ignore.yaml

  • Updated external OpenAPI schema reference to a local copy hosted in
    the Tyk repository.
  • +1/-1     
    swagger.yml
    Replace OpenAPI schema references with Tyk-hosted schema 

    swagger.yml

  • Replaced external OpenAPI schema references with local Tyk-hosted
    schema references.
  • +6/-6     
    Tests
    api_operations.yaml
    Add test cases for API and policy management                         

    tests/schema/api_operations.yaml

  • Added test cases for managing APIs and policies, including create,
    delete, and update operations.
  • Included HTTP methods and assertions for status codes.
  • +121/-0 
    portmanconfig.json
    Add Portman configuration for contract testing                     

    tests/schema/portmanconfig.json

  • Added Portman configuration file for contract tests.
  • Defined test cases, variable assignments, and request overwrites for
    OpenAPI operations.
  • Included global settings and order of operations for API testing.
  • +668/-0 
    Configuration changes
    package.json
    Add package.json for Portman dependency and scripts           

    tests/schema/package.json

  • Added a new package.json file for managing dependencies and scripts.
  • Included Portman as a dependency for contract testing.
  • +16/-0   
    portman-cli-options.json
    Add Portman CLI options configuration                                       

    tests/schema/portman-cli-options.json

  • Added Portman CLI options configuration file.
  • Configured local OpenAPI file, base URL, and output settings for
    Postman collections.
  • +12/-0   

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    @buger
    Copy link
    Member

    buger commented Dec 10, 2024

    This PR is too huge for one to review 💔

    Additions 830 🙅‍♀️
    Expected ⬇️ 800

    Consider breaking it down into multiple small PRs.

    Check out this guide to learn more about PR best-practices.

    @buger
    Copy link
    Member

    buger commented Dec 10, 2024

    I'm a bot and I 👍 this PR title. 🤖

    Copy link
    Contributor

    Swagger Changes

    
    
      
      
      
      
      
      
      
      
      
      
        
        
        
        
        
        
        
        
         _        __  __
       _| |_   _ / _|/ _|  between swagger-prev.yml
      + one list entry added:
      + one list entry added:
      + one list entry added:
      + one list entry added:
      - one list entry removed:
      - one list entry removed:
      - one list entry removed:
      - one list entry removed:
      ± value change
      ± value change
     / _' | | | | |_| |_       and swagger-current.yml
     \__,_|\__, |_| |_|   returned six differences
    paths./tyk/apis/oas.get.responses.200.content.application/json.schema.items.allOf
    paths./tyk/apis/oas.post.requestBody.content.application/json.schema.allOf
    paths./tyk/apis/oas/import.post.requestBody.content.application/json.schema.$ref
    paths./tyk/apis/oas/{apiID}.get.responses.200.content.application/json.schema.allOf
    paths./tyk/apis/oas/{apiID}.patch.requestBody.content.application/json.schema.$ref
    paths./tyk/apis/oas/{apiID}.put.requestBody.content.application/json.schema.allOf
    | (_| | |_| |  _|  _|

    Copy link
    Contributor

    API Changes

    no api changes detected

    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Schema Reference Change
    The PR changes the schema references from the OpenAPI main schema to a Tyk-specific schema. Ensure that the new schema is compatible and all references are correctly updated without breaking existing functionalities.

    Test Coverage
    New tests have been added for API and Policy management. Verify that these tests cover all new functionalities and changes adequately, and check if the assertions are correctly validating the expected outcomes.

    Copy link
    Contributor

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    Copy link

    Quality Gate Failed Quality Gate failed

    Failed conditions
    0.0% Coverage on New Code (required ≥ 80%)

    See analysis details on SonarQube Cloud

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants