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

Update tests and remove DESCRIPTION.md #38

Merged
merged 1 commit into from
Jan 7, 2024
Merged

Update tests and remove DESCRIPTION.md #38

merged 1 commit into from
Jan 7, 2024

Conversation

rabestro
Copy link
Owner

@rabestro rabestro commented Jan 7, 2024

Tests in 'ijhttp-test' folder were updated to better validate responses. 'DESCRIPTION.md' file was removed. New test cases under 'bruno-test/openapi-docs' were added to validate OpenAPI documentation pages by performing GET requests and ensuring the responses are successful. The README file was updated with new test report link. A minor change was made in 'karate-config.js'.

Summary by CodeRabbit

  • Documentation

    • Updated README with a link to the failed test report.
  • New Features

    • Introduced new API documentation retrieval from Confluence.
    • Added functionality to fetch OpenAPI specifications in YAML format.
    • Configured access to Rapidoc and Redoc OpenAPI documentation UIs.
    • Enhanced Swagger UI accessibility and verification.
  • Bug Fixes

    • Corrected the assertion for "Swagger UI" in the test script.
    • Updated the bad request test to check for HTTP status code 400 and the presence of an "error" message.
  • Refactor

    • Streamlined configuration logic in test setup.

Tests in 'ijhttp-test' folder were updated to better validate responses. 'DESCRIPTION.md' file was removed. New test cases under 'bruno-test/openapi-docs' were added to validate OpenAPI documentation pages by performing GET requests and ensuring the responses are successful. The README file was updated with new test report link. A minor change was made in 'karate-config.js'.
@rabestro rabestro self-assigned this Jan 7, 2024
Copy link
Contributor

coderabbitai bot commented Jan 7, 2024

Walkthrough

The updates encompass enhancements to testing scripts and documentation links. Specifically, they involve the addition of a new Confluence API documentation retrieval feature, updates to OpenAPI documentation retrieval and assertions, an updated test case for bad requests, and a streamlined configuration file for test environments. A failed test report link has been added to the README for better transparency.

Changes

File Path Change Summary
README.md Added failed test report URL.
bruno-test/openapi-docs/... Added functionality for retrieving API documentation from various sources (Confluence, OpenAPI, Rapidoc, Redoc, Swagger UI) with assertions.
ijhttp-test/api-docs.http Updated assertions for "Swagger UI" and added Confluence API documentation section.
ijhttp-test/bad-request.http Modified assertions to check for status code 400 and "error" option.
src/test/java/karate-config.js Streamlined the config object setup.

Poem

🐇 "In the realm of code, changes abound,
🌟 With tests and docs, improvements found.
📝 README links, assertions refined,
🚀 To better quality, these changes are signed."

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

sonarcloud bot commented Jan 7, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 3

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 2a3cbd4 and d842aa1.
Files selected for processing (9)
  • README.md (1 hunks)
  • bruno-test/openapi-docs/Confluence.bru (1 hunks)
  • bruno-test/openapi-docs/OpenAPI Specification.bru (1 hunks)
  • bruno-test/openapi-docs/Rapidoc OpenAPI.bru (1 hunks)
  • bruno-test/openapi-docs/Redoc OpenAPI.bru (1 hunks)
  • bruno-test/openapi-docs/Swagger UI.bru (1 hunks)
  • ijhttp-test/api-docs.http (1 hunks)
  • ijhttp-test/bad-request.http (1 hunks)
  • src/test/java/karate-config.js (1 hunks)
Files skipped from review due to trivial changes (2)
  • ijhttp-test/api-docs.http
  • src/test/java/karate-config.js
Additional comments: 15
bruno-test/openapi-docs/OpenAPI Specification.bru (2)
  • 1-5: The metadata block is well-defined and follows the expected structure for a test specification.

  • 7-11: The GET request is correctly structured to fetch the OpenAPI specification from the given host.

bruno-test/openapi-docs/Swagger UI.bru (3)
  • 1-5: The metadata block is well-defined and follows the expected structure for a test specification.

  • 7-11: The GET request is correctly structured to fetch the Swagger UI page from the given host.

  • 13-16: The assertions check for a 200 status code and the presence of "Swagger UI" in the response body, which is a good practice to validate the content of the page.

bruno-test/openapi-docs/Redoc OpenAPI.bru (3)
  • 1-5: The metadata block is well-defined and follows the expected structure for a test specification.

  • 7-11: The GET request is correctly structured to fetch the Redoc OpenAPI page from the given host.

  • 13-16: The assertions check for a 200 status code and the presence of "Pig Latin Translator API" in the response body, which is a good practice to validate the content of the page.

bruno-test/openapi-docs/Confluence.bru (2)
  • 1-5: The metadata block is well-defined and follows the expected structure for a test specification.

  • 7-11: The GET request is correctly structured to fetch the Confluence page from the given URL.

bruno-test/openapi-docs/Rapidoc OpenAPI.bru (2)
  • 1-5: The metadata block is well-defined and follows the expected structure for a test specification.

  • 13-18: The assertions check for a 200 status code and the presence of "Pig Latin Translator API" in the response body. Additionally, it checks for the absence of certain elements, which is a good practice to ensure the page is rendered correctly.

ijhttp-test/bad-request.http (2)
  • 7-17: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-10]

The POST request is correctly structured to send a null payload, which should trigger a bad request error from the server.

  • 11-15: The client tests are well-structured to check for a 400 status code and the presence of an "error" option in the response. This aligns with the PR objectives to improve validation of responses.
README.md (1)
  • 66-67: The addition of the failed test report URL is a good practice to provide transparency on the test outcomes. Ensure that the URL is accessible and points to the correct report.
Verification successful

The failed test report URL added to the README.md file is accessible, as indicated by the HTTP 200 status code returned by the curl command.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify the accessibility of the failed test report URL.
curl -o /dev/null -s -w "%{http_code}\n" https://github.com/rabestro/pig-latin-rest/runs/20241724987

Length of output: 106

Comment on lines +13 to +15
assert {
res.status: eq 200
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assertion checks for a 200 status code, which is appropriate for a successful response. However, it might be beneficial to also check the content type of the response to ensure it's a YAML file.

  assert {
    res.status: eq 200
+   res.headers['Content-Type']: contains 'application/yaml'
  }

Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
assert {
res.status: eq 200
}
assert {
res.status: eq 200
res.headers['Content-Type']: contains 'application/yaml'
}

Comment on lines +13 to +16
assert {
res.status: eq 200
res.body: contains Atlassian
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assertions check for a 200 status code and the presence of "Atlassian" in the response body. This is a good practice to validate the content of the page, but it might be too broad. Consider checking for more specific content related to the API documentation.

  assert {
    res.status: eq 200
    res.body: contains Atlassian
+   res.body: contains 'API Documentation'
  }

Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
assert {
res.status: eq 200
res.body: contains Atlassian
}
assert {
res.status: eq 200
res.body: contains Atlassian
res.body: contains 'API Documentation'
}

Comment on lines +7 to +11
get {
url: {{host}}/ui/redoc.html
body: none
auth: none
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GET request is correctly structured to fetch the Redoc OpenAPI page from the given host. However, the URL seems to be incorrect as it points to 'redoc.html' which is the same as in the 'Redoc OpenAPI.bru' file. This should be corrected to point to the Rapidoc page.

  get {
-   url: {{host}}/ui/redoc.html
+   url: {{host}}/ui/rapidoc.html
  }

Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
get {
url: {{host}}/ui/redoc.html
body: none
auth: none
}
get {
url: {{host}}/ui/rapidoc.html
body: none
auth: none
}

Copy link

github-actions bot commented Jan 7, 2024

Qodana Community for JVM

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at qodana-support@jetbrains.com

@rabestro rabestro merged commit aca0376 into main Jan 7, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant