8000 Add tests for empty output directory by vermakhushboo · Pull Request #9566 · appwrite/appwrite · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add tests for empty output directory #9566

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

Merged
merged 6 commits into from
Apr 14, 2025

Conversation

vermakhushboo
Copy link
Member
@vermakhushboo vermakhushboo commented Mar 24, 2025

What does this PR do?

Need to release OPR version for this to pass

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Screenshots may also be helpful.)

Related PRs and Issues

  • (Related PR or issue)

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

Summary by CodeRabbit

  • Tests
    • Enhanced test coverage to ensure deployments fail gracefully with clear error notifications when the build output directory is empty or missing.
    • Added tests for scenarios where the output directory exists but is empty, and where the output directory does not exist at all.
    • Updated existing tests to validate more specific error messages in deployment logs.

@vermakhushboo vermakhushboo requested a review from Meldiron March 24, 2025 08:01
Copy link
coderabbitai bot commented Mar 24, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update introduces three new test methods in the SitesCustomServerTest class. The methods simulate deployment scenarios by configuring a site with specific output directory conditions: one method checks for an empty output directory, while another checks for a missing output directory. Each test verifies that the deployment fails with the expected error messages and status codes. Additionally, an existing test method has been modified to improve the specificity of its assertions.

Changes

File Change Summary
tests/e2e/.../SitesCustomServerTest.php Added testOutputDirectoryEmpty() and testOutputDirectoryMissing() to check error handling for empty and missing output directories. Modified testEmptySiteSource() to refine error message assertion.

Possibly related PRs

  • Add tests for empty output directory #9566: The changes in the main PR are directly related to those in the retrieved PR, as both introduce the same new test methods and modifications to the SitesCustomServerTest class in the same file.

Poem

I'm a hopping rabbit full of glee,
Skipping through tests in code land free,
When directories are empty, a warning you'll see,
And missing paths cause errors to decree,
With each test added, our code sings happily! 🐇

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ed95ac7 and 0b6a8ec.

📒 Files selected for processing (1)
  • tests/e2e/Services/Sites/SitesCustomServerTest.php (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • 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 testing code 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
github-actions bot commented Mar 24, 2025

Security Scan Results for PR

Docker Image Scan Results

Package Version Vulnerability Severity
binutils 2.42-r0 CVE-2025-0840 HIGH
libexpat 2.6.4-r0 CVE-2024-8176 HIGH
libxml2 2.12.7-r0 CVE-2024-56171 HIGH
libxml2 2.12.7-r0 CVE-2025-24928 HIGH
libxml2 2.12.7-r0 CVE-2025-27113 HIGH
xz 5.6.2-r0 CVE-2025-31115 HIGH
xz-libs 5.6.2-r0 CVE-2025-31115 HIGH

Source Code Scan Results

🎉 No vulnerabilities found!

Copy link
github-actions bot commented Mar 24, 2025

✨ Benchmark results

  • Requests per second: 913
  • Requests with 200 status code: 164,468
  • P99 latency: 0.202195368

⚡ Benchmark Comparison

Metric This PR Latest version
RPS 913 1,190
200 164,468 214,267
P99 0.202195368 0.155674474

Copy link
@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.

Actionable comments posted: 0

🧹 Nitpick comments (2)
tests/e2e/Services/Sites/SitesCustomServerTest.php (2)

2264-2300: Good test for the empty output directory case.

The test correctly verifies that deployments fail when the output directory exists but is empty. You've set up the test to create the empty directory with mkdir random and then start the build process.

To make this test more robust, consider adding an assertion to verify the specific error message in the build logs, confirming that the failure is due to an empty output directory rather than some other unrelated error.

 $this->assertEventually(function () use ($siteId, $deploymentId) {
     $deployment = $this->getDeployment($siteId, $deploymentId);
     $this->assertEquals('failed', $deployment['body']['status'], 'Deployment status is failed, deployment: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT));
+    $this->assertStringContainsString('Build output directory is empty', $deployment['body']['buildLogs']);
 }, 100000, 500);

2302-2338: Good test for the non-existent output directory case.

The test correctly verifies that deployments fail when the specified output directory doesn't exist. This test complements the previous one by covering another empty output directory scenario.

Similar to the previous test, consider adding an assertion to verify the specific error message in the build logs to ensure the failure is occurring for the expected reason.

 $this->assertEventually(function () use ($siteId, $deploymentId) {
     $deployment = $this->getDeployment($siteId, $deploymentId);
     $this->assertEquals('failed', $deployment['body']['status'], 'Deployment status is failed, deployment: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT));
+    $this->assertStringContainsString('Build output directory is not set or does not exist', $deployment['body']['buildLogs']);
 }, 100000, 500);
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1580bac and 5582c69.

📒 Files selected for processing (1)
  • tests/e2e/Services/Sites/SitesCustomServerTest.php (1 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
tests/e2e/Services/Sites/SitesCustomServerTest.php (1)
tests/e2e/Services/Sites/SitesBase.php (6)
  • setupSite (20-33)
  • getSite (161-169)
  • setupSiteDomain (329-347)
  • createDeployment (237-245)
  • getDeployment (171-179)
  • cleanupSite (69-78)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Setup & Build Appwrite Image

@Meldiron Meldiron merged commit d1d36a2 into feat-sites Apr 14, 2025
6 of 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.

2 participants
0