fix: PHPUnit でテスト後半が could not find MDB2 instance#1402
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
Changesテスト初期化でのMDB2プール状態クリア
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsStopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a 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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1402 +/- ##
==========================================
+ Coverage 55.88% 56.21% +0.32%
==========================================
Files 87 87
Lines 11090 11090
==========================================
+ Hits 6198 6234 +36
+ Misses 4892 4856 -36
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
根本原因の調査結果
真因PHPUnit 9 の 具体的な流れ:
検証ログ (修正前、フルテスト)
CI で顕在化していない理由
- name: Run to PHPUnit
run: docker compose exec -T ec-cube php data/vendor/bin/phpunit --exclude-group classloader,mysql_prepare
- name: Run to PHPUnit mysql_prepare
# XXX 連続してテストを実行すると、何故か MySQL の prepare statement に失敗するため個別に実行する
run: docker compose exec -T ec-cube php data/vendor/bin/phpunit --group mysql_prepare#1401 でエラーになる
ワークフローの「XXX 連続してテストを実行すると…」というコメントは、まさにこの症状の対症療法だったと思われます。 推奨される根本対処の diffPR #1402 の対症療法はそのままマージで問題ありませんが、追加で以下の annotation を入れると、根本原因側を解消できます ( diff --git a/tests/class/module/HTTP/HTTP_Request_CompatibilityTest.php b/tests/class/module/HTTP/HTTP_Request_CompatibilityTest.php
--- a/tests/class/module/HTTP/HTTP_Request_CompatibilityTest.php
+++ b/tests/class/module/HTTP/HTTP_Request_CompatibilityTest.php
@@ -9,6 +9,8 @@ require_once __DIR__.'/Request_Legacy.php';
*
* Compares the new Guzzle-based implementation with the legacy implementation
* to ensure backward compatibility of the API.
+ *
+ * @backupGlobals disabled
*/
class HTTP_Request_CompatibilityTest extends \PHPUnit\Framework\TestCase
diff --git a/tests/class/module/HTTP/HTTP_Request_GuzzleTest.php b/tests/class/module/HTTP/HTTP_Request_GuzzleTest.php
--- a/tests/class/module/HTTP/HTTP_Request_GuzzleTest.php
+++ b/tests/class/module/HTTP/HTTP_Request_GuzzleTest.php
@@ -7,6 +7,8 @@ require_once $HOME.'/data/module/HTTP/Request.php';
* HTTP_Request compatibility tests
*
* Tests to verify backward compatibility of the Guzzle-based HTTP_Request implementation.
+ *
+ * @backupGlobals disabled
*/
class HTTP_Request_GuzzleTest extends \PHPUnit\Framework\TestCase
diff --git a/tests/class/module/Net/Net_URLTest.php b/tests/class/module/Net/Net_URLTest.php
--- a/tests/class/module/Net/Net_URLTest.php
+++ b/tests/class/module/Net/Net_URLTest.php
@@ -7,6 +7,8 @@ require_once $HOME.'/data/module/Net/URL.php';
* Net_URL compatibility tests
*
* Tests to verify backward compatibility of the Guzzle-based Net_URL implementation.
+ *
+ * @backupGlobals disabled
*/
class Net_URLTest extends \PHPUnit\Framework\TestCase
diff --git a/tests/class/module/Net/Net_URL_CompatibilityTest.php b/tests/class/module/Net/Net_URL_CompatibilityTest.php
--- a/tests/class/module/Net/Net_URL_CompatibilityTest.php
+++ b/tests/class/module/Net/Net_URL_CompatibilityTest.php
@@ -9,6 +9,8 @@ require_once __DIR__.'/URL_Legacy.php';
*
* Compares the new Guzzle-based implementation with the legacy implementation
* to ensure backward compatibility.
+ *
+ * @backupGlobals disabled
*/
class Net_URL_CompatibilityTest extends \PHPUnit\Framework\TestCase検証結果
提案
🤖 Generated with Claude Code |
|
fix #1401
Summary by CodeRabbit