Skip to content

fix: testListSites 2 not matching expected 1#10726

Merged
loks0n merged 3 commits into1.8.xfrom
fix-testListSites
Oct 29, 2025
Merged

fix: testListSites 2 not matching expected 1#10726
loks0n merged 3 commits into1.8.xfrom
fix-testListSites

Conversation

@ChiragAgg5k
Copy link
Member

@ChiragAgg5k ChiragAgg5k commented Oct 29, 2025

fixes -
Screenshot 2025-10-29 at 3 27 38 PM

this can happen due to parallel executions of sites tests, that can lead to more sites being there than expected. so we narrow the scope of the lists function to only check for sites in that scope by using custom names and search

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 29, 2025

📝 Walkthrough

Walkthrough

The test file tests/e2e/Services/Sites/SitesCustomServerTest.php was updated. In testListSites the created site names were changed from "Test Site" / "Test Site 2" to "Test List Sites" / "Test List Sites 2". The test now calls listSites with a search parameter matching the new names instead of listing without filters, and related assertions were updated to expect the new names and search-driven results. No public APIs or helper methods were modified.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Single test file with localized, repetitive changes (name updates and adding search parameters)
  • Verify search parameter usage and that assertions match the new names
  • Confirm no production API or helper behavior was inadvertently altered (only test expectations changed)

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description Check ❓ Inconclusive No pull request description was provided by the author. The check criteria require that a description either be related to the changeset (to pass) or be completely off-topic/vague (to fail or be inconclusive). Since there is no description content to evaluate against these criteria, it is impossible to determine whether the description meets the requirements for passing or failing based on the provided instructions. The author should add a pull request description that explains the purpose of the changes, the issue being fixed, and the approach taken. Even a brief description—such as explaining that the test was failing due to naming mismatches and how the fix addresses this—would help reviewers understand the context and intent of the changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title "fix: testListSites 2 not matching expected 1" is directly related to the changeset, which involves updating test expectations and search filtering logic in the testListSites test method. While the title is somewhat cryptic—using shorthand references like "2" and "1" that may require context to fully understand—it is specific enough that it clearly identifies the test being fixed and the nature of the issue being addressed. The title accurately summarizes the primary change from a developer's perspective.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-testListSites

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Oct 29, 2025

Security Scan Results for PR

Docker Image Scan Results

Package Version Vulnerability Severity
binutils 2.44-r2 CVE-2025-5244 HIGH
binutils 2.44-r2 CVE-2025-5245 HIGH
libxml2 2.13.8-r0 CVE-2025-49794 CRITICAL
libxml2 2.13.8-r0 CVE-2025-49796 CRITICAL
libxml2 2.13.8-r0 CVE-2025-49795 HIGH
libxml2 2.13.8-r0 CVE-2025-6021 HIGH
pcre2 10.43-r1 CVE-2025-58050 CRITICAL
golang.org/x/crypto v0.31.0 CVE-2025-22869 HIGH
golang.org/x/oauth2 v0.24.0 CVE-2025-22868 HIGH
stdlib 1.22.10 CVE-2025-47907 HIGH

Source Code Scan Results

🎉 No vulnerabilities found!

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.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
tests/e2e/Services/Sites/SitesCustomServerTest.php (2)

653-690: Consider adding search filtering for better test isolation.

These pagination and filter tests don't include the search parameter, which means they could still be affected by sites created by other concurrent tests. For example:

  • Line 670 expects 0 results with offset(1), assuming only 1 site exists
  • Line 680 expects exactly 1 enabled site
  • Line 690 expects 0 disabled sites

Adding the search parameter to these test cases would make them more reliable in parallel test execution.

Apply this diff to add search filtering to pagination tests:

 // Test pagination offset
 $sites = $this->listSites([
+    'search' => 'Test List Sites',
     'queries' => [
         Query::offset(1)->toString(),
     ],
 ]);

Similar changes should be applied to the filter tests at lines 673-690.


702-708: Framework search may match sites from other tests.

The search for framework 'other' could match sites created by other concurrent tests, as many tests in this file use framework => 'other' (e.g., testCreateSite, testGetSite, testUpdateSite). Consider combining this with the site name search for better isolation.

Apply this diff:

 // Test search framework
 $sites = $this->listSites([
-    'search' => 'other'
+    'search' => 'Test List Sites',
+    'queries' => [
+        Query::equal('framework', ['other'])->toString(),
+    ],
 ]);
🧹 Nitpick comments (1)
tests/e2e/Services/Sites/SitesCustomServerTest.php (1)

735-753: Cursor pagination should include search parameter for consistency.

The cursor values are derived from the search-filtered results at line 724, but the subsequent listSites calls at lines 735 and 745 don't include the same search filter. This creates an inconsistency where the cursor is from a filtered result set, but the pagination query operates on an unfiltered set.

Apply this diff to add search filtering:

 $sites1 = $this->listSites([
+    'search' => 'Test List Sites',
     'queries' => [
         Query::cursorAfter(new Document(['$id' => $sites['body']['sites'][0]['$id']]))->toString(),
     ],
 ]);
 $sites2 = $this->listSites([
+    'search' => 'Test List Sites',
     'queries' => [
         Query::cursorBefore(new Document(['$id' => $sites['body']['sites'][1]['$id']]))->toString(),
     ],
 ]);
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1180dc0 and d995dbb.

📒 Files selected for processing (1)
  • tests/e2e/Services/Sites/SitesCustomServerTest.php (5 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
tests/e2e/Services/Sites/SitesCustomServerTest.php (1)
tests/e2e/Services/Sites/SitesBase.php (1)
  • listSites (207-215)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: E2E Service Test (Webhooks)
  • GitHub Check: E2E Service Test (Tokens)
  • GitHub Check: E2E Service Test (Functions)
  • GitHub Check: E2E Service Test (Users)
  • GitHub Check: E2E Service Test (Realtime)
  • GitHub Check: E2E Service Test (Storage)
  • GitHub Check: E2E Service Test (Sites)
  • GitHub Check: E2E Service Test (Console)
  • GitHub Check: E2E Service Test (GraphQL)
  • GitHub Check: E2E Service Test (FunctionsSchedule)
  • GitHub Check: E2E Service Test (Locale)
  • GitHub Check: E2E Service Test (Projects)
  • GitHub Check: E2E Service Test (Avatars)
  • GitHub Check: E2E Service Test (Account)
  • GitHub Check: E2E Service Test (Site Screenshots)
  • GitHub Check: Unit Test
  • GitHub Check: E2E Service Test (Dev Keys)
  • GitHub Check: E2E General Test
  • GitHub Check: Benchmark
  • GitHub Check: scan
🔇 Additional comments (2)
tests/e2e/Services/Sites/SitesCustomServerTest.php (2)

637-650: Good test isolation improvement.

The addition of the search parameter and more specific site name properly isolates this test from other concurrent tests.


717-733: LGTM!

The search correctly leverages partial string matching to return both sites. The assertions properly verify both site names are present in the results.

@github-actions
Copy link

✨ Benchmark results

  • Requests per second: 1,185
  • Requests with 200 status code: 213,330
  • P99 latency: 0.164184801

⚡ Benchmark Comparison

Metric This PR Latest version
RPS 1,185 1,208
200 213,330 217,428
P99 0.164184801 0.172313244

@loks0n loks0n merged commit 6072675 into 1.8.x Oct 29, 2025
41 checks passed
@ChiragAgg5k ChiragAgg5k deleted the fix-testListSites branch October 29, 2025 13:04
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