jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/367475 )

Change subject: config: Fix invalid EtcdConfig return value after JSON parse 
error
......................................................................


config: Fix invalid EtcdConfig return value after JSON parse error

Follows-up 1f2daa913244, 9b459d29e0, 110a21ea18.

Bug: T156924
Change-Id: I79b7e11b32e5be46c8ebdfb5c937e38e46301c0e
---
M includes/config/EtcdConfig.php
M tests/phpunit/includes/config/EtcdConfigTest.php
2 files changed, 5 insertions(+), 9 deletions(-)

Approvals:
  Tim Starling: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/config/EtcdConfig.php b/includes/config/EtcdConfig.php
index c57eba7..6605c38 100644
--- a/includes/config/EtcdConfig.php
+++ b/includes/config/EtcdConfig.php
@@ -243,7 +243,7 @@
 
                $info = json_decode( $rbody, true );
                if ( $info === null || !isset( $info['node']['nodes'] ) ) {
-                       return [ null, $rcode, "Unexpected JSON response; 
missing 'nodes' list.", false ];
+                       return [ null, "Unexpected JSON response; missing 
'nodes' list.", false ];
                }
 
                $config = [];
diff --git a/tests/phpunit/includes/config/EtcdConfigTest.php 
b/tests/phpunit/includes/config/EtcdConfigTest.php
index 8e57a01..e0694db 100644
--- a/tests/phpunit/includes/config/EtcdConfigTest.php
+++ b/tests/phpunit/includes/config/EtcdConfigTest.php
@@ -364,22 +364,18 @@
 
        public static function provideFetchFromServer() {
                return [
-                       [
+                       '200 OK - Empty' => [
                                'http' => [
                                        'code' => 200,
                                        'reason' => 'OK',
-                                       'headers' => [
-                                               'content-length' => 0,
-                                       ],
+                                       'headers' => [ 'content-length' => 0 ],
                                        'body' => '',
                                        'error' => '(curl error: no status 
set)',
                                ],
                                'expect' => [
-                                       // FIXME: Returning 4 values instead of 
3
-                                       null,
-                                       200,
+                                       null, // data
                                        "Unexpected JSON response; missing 
'nodes' list.",
-                                       false
+                                       false // retry
                                ],
                        ],
                ];

-- 
To view, visit https://gerrit.wikimedia.org/r/367475
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I79b7e11b32e5be46c8ebdfb5c937e38e46301c0e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Legoktm <lego...@member.fsf.org>
Gerrit-Reviewer: Tim Starling <tstarl...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to