Krinkle has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/370875 )

Change subject: tests: Avoid production-like dc and host names
......................................................................

tests: Avoid production-like dc and host names

As a matter of principle, never use production-like names in test fixtures
and example values to avoid various bad things:
* Fragile dependence between tests and execution environment
  that might wrongly pass due to something being inherited.
* Docs looking outdated if/when we use a different DC.
  (Lots of docs looked outdated after pmtpa decom)
* Avoid false confidence in using examples verbatim during a switchover
  that will wrongly use eqiad instead of codfw (obvious examples don't
  look authoritative or current and will always encourage one to look at
  a better source).
* Avoid bad search results when looking for production host names and their
  "usage" across various WMF repos.

Change-Id: If55cd0e442e6a4b5b11c080fd564e04830d6585f
---
M CirrusSearch.php
M docs/settings.txt
M tests/unit/ClusterSettingsTest.php
M tests/unit/Maintenance/ReindexerTest.php
4 files changed, 40 insertions(+), 40 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch 
refs/changes/75/370875/1

diff --git a/CirrusSearch.php b/CirrusSearch.php
index bec54dd..ccf7d77 100644
--- a/CirrusSearch.php
+++ b/CirrusSearch.php
@@ -65,8 +65,8 @@
  * configured (see below).
  *
  * $wgCirrusSearchClusters = array(
- *     'eqiad' => array( 'es01.eqiad.wmnet', 'es02.eqiad.wmnet' ),
- *     'codfw' => array( 'es01.codfw.wmnet', 'es02.codfw.wmnet' ),
+ *     'dc-foo' => array( 'es01.foo.local', 'es02.foo.local' ),
+ *     'dc-bar' => array( 'es01.bar.local', 'es02.bar.local' ),
  * );
  */
 $wgCirrusSearchClusters = [
@@ -682,10 +682,10 @@
  * in $wgCirrusSearchClusters. Note that queries can use multiple features, in
  * the case multiple features have overrides the first match wins.
  *
- * Example sending more_like queries to codfw and completion to eqiad:
+ * Example sending more_like queries to dc-foo and completion to dc-bar:
  *   $wgCirrusSearchClusterOverrides = [
- *     'more_like' => 'codfw',
- *     'completion' => 'eqiad',
+ *     'more_like' => 'dc-foo',
+ *     'completion' => 'dc-bar',
  *   ];
  */
 $wgCirrusSearchClusterOverrides = [];
diff --git a/docs/settings.txt b/docs/settings.txt
index 7f92bde..cfabeed 100644
--- a/docs/settings.txt
+++ b/docs/settings.txt
@@ -41,8 +41,8 @@
 
 Example:
     $wgCirrusSearchClusters = array(
-        'eqiad' => array( 'es01.eqiad.wmnet', 'es02.eqiad.wmnet' ),
-        'codfw' => array( 'es01.codfw.wmnet', 'es02.codfw.wmnet' ),
+        'dc-foo' => array( 'es01.foo.local', 'es02.foo.local' )
+        'dc-bar' => array( 'es01.bar.local', 'es02.bar.local' )
     );
 
 ; $wgCirrusSearchWriteClusters
@@ -787,10 +787,10 @@
 in $wgCirrusSearchClusters. Note that queries can use multiple features, in
 the case multiple features have overrides the first match wins.
 
-Example sending more_like queries to codfw and completion to eqiad:
+Example sending more_like queries to dc-foo and completion to dc-bar:
     $wgCirrusSearchClusterOverrides = [
-        'more_like' => 'codfw',
-        'completion' => 'eqiad',
+        'more_like' => 'dc-foo',
+        'completion' => 'dc-bar',
     ];
 
 ; $wgCirrusSearchMoreLikeThisTTL
diff --git a/tests/unit/ClusterSettingsTest.php 
b/tests/unit/ClusterSettingsTest.php
index efd9cff..0d5fcbe 100644
--- a/tests/unit/ClusterSettingsTest.php
+++ b/tests/unit/ClusterSettingsTest.php
@@ -11,14 +11,14 @@
                return [
                        'Handles per-index shard counts' => [
                                [ 'general' => 7 ],
-                               'eqiad',
+                               'dc-foo',
                                'general',
                                7,
                        ],
 
                        'Handles per-cluster shard counts' => [
-                               [ 'content' => 6, 'eqiad' => [ 'content' => 9 ] 
],
-                               'eqiad',
+                               [ 'content' => 6, 'dc-foo' => [ 'content' => 9 
] ],
+                               'dc-foo',
                                'content',
                                9,
                        ],
@@ -45,21 +45,21 @@
                return [
                        'Simple replica config returns exact setting ' => [
                                '0-2',
-                               'eqiad',
+                               'dc-foo',
                                'content',
                                '0-2',
                        ],
 
                        'Accepts array for replica config' => [
                                [ 'content' => '1-2' ],
-                               'eqiad',
+                               'dc-foo',
                                'content',
                                '1-2',
                        ],
 
                        'Accepts per-cluster replica config' => [
-                               [ 'content' => '1-2', 'eqiad' => [ 'content' => 
'2-3' ] ],
-                               'eqiad',
+                               [ 'content' => '1-2', 'dc-foo' => [ 'content' 
=> '2-3' ] ],
+                               'dc-foo',
                                'content',
                                '2-3'
                        ],
@@ -85,10 +85,10 @@
        public static function provideDropDelayedJobsAfter() {
                return [
                        'Simple integer timeout is returned directly' => [
-                               60, 'eqiad', 60
+                               60, 'dc-foo', 60
                        ],
                        'Can set per-cluster timeout' => [
-                               [ 'eqiad' => 99, 'labsearch' => 42 ],
+                               [ 'dc-foo' => 99, 'labsearch' => 42 ],
                                'labsearch',
                                42
                        ],
diff --git a/tests/unit/Maintenance/ReindexerTest.php 
b/tests/unit/Maintenance/ReindexerTest.php
index 88f0019..6ba6018 100644
--- a/tests/unit/Maintenance/ReindexerTest.php
+++ b/tests/unit/Maintenance/ReindexerTest.php
@@ -11,59 +11,59 @@
                return [
                        'simple configuration' => [
                                // Expected remote info
-                               [ 'host' => 
'http://search.svc.eqiad.wmnet:9200/' ],
+                               [ 'host' => 'http://search.svc.foo.local:9200/' 
],
                                // wgCirrusSearchClusters configuration
                                [
-                                       'eqiad' => [ 'search.svc.eqiad.wmnet' ],
-                                       'codfw' => [ 'search.svc.codfw.wmnet' ],
+                                       'dc-foo' => [ 'search.svc.foo.local' ],
+                                       'dc-bar' => [ 'search.svc.bar.local' ],
                                ]
                        ],
                        'no remote info if both are same' => [
                                null,
                                [
-                                       'eqiad' => [ 'search.svc.eqiad.wmnet' ],
-                                       'codfw' => [ 'search.svc.codfw.wmnet' ],
+                                       'dc-foo' => [ 'search.svc.foo.local' ],
+                                       'dc-bar' => [ 'search.svc.bar.local' ],
                                ],
-                               'eqiad',
-                               'eqiad',
+                               'dc-foo',
+                               'dc-foo',
                        ],
                        'handles advanced cluster definitions' => [
-                               [ 'host' => 
'https://search.svc.eqiad.wmnet:9243/' ],
+                               [ 'host' => 
'https://search.svc.foo.local:9243/' ],
                                [
-                                       'eqiad' => [
+                                       'dc-foo' => [
                                                [
                                                        'transport' => 
'CirrusSearch\\Elastica\\PooledHttps',
                                                        'port' => '9243',
-                                                       'host' => 
'search.svc.eqiad.wmnet',
+                                                       'host' => 
'search.svc.foo.local',
                                                ],
                                        ],
-                                       'codfw' => [ 'search.svc.codfw.wmnet' ],
+                                       'dc-bar' => [ 'search.svc.bar.local' ],
                                ],
                        ],
                        'uses http when http transport is selected' => [
-                               [ 'host' => 
'http://search.svc.eqiad.wmnet:9200/' ],
+                               [ 'host' => 'http://search.svc.foo.local:9200/' 
],
                                [
-                                       'eqiad' => [
+                                       'dc-foo' => [
                                                [
                                                        'transport' => 'Http',
                                                        'port' => '9200',
-                                                       'host' => 
'search.svc.eqiad.wmnet',
+                                                       'host' => 
'search.svc.foo.local',
                                                ],
                                        ],
-                                       'codfw' => [ 'search.svc.codfw.wmnet' ],
+                                       'dc-bar' => [ 'search.svc.bar.local' ],
                                ]
                        ],
                        'uses http when pooled http transport is selected' => [
-                               [ 'host' => 
'http://search.svc.eqiad.wmnet:9200/' ],
+                               [ 'host' => 'http://search.svc.foo.local:9200/' 
],
                                [
-                                       'eqiad' => [
+                                       'dc-foo' => [
                                                [
                                                        'transport' => 
'CirrusSearch\\Elastica\\PooledHttp',
                                                        'port' => 9200,
-                                                       'host' => 
'search.svc.eqiad.wmnet',
+                                                       'host' => 
'search.svc.foo.local',
                                                ],
                                        ],
-                                       'codfw' => [ 'search.svc.codfw.wmnet' ],
+                                       'dc-bar' => [ 'search.svc.bar.local' ],
                                ]
                        ],
                ];
@@ -72,9 +72,9 @@
        /**
         * @dataProvider provideDetectRemoteSourceParams
         */
-       public function testDetectRemoteSourceParams( $expected, 
$clustersConfig, $sourceCluster = 'eqiad', $destCluster = 'codfw' ) {
+       public function testDetectRemoteSourceParams( $expected, 
$clustersConfig, $sourceCluster = 'dc-foo', $destCluster = 'dc-bar' ) {
                $config = new HashSearchConfig( [
-                       'CirrusSearchDefaultCluster' => 'eqiad',
+                       'CirrusSearchDefaultCluster' => 'dc-foo',
                        'CirrusSearchClusters' => $clustersConfig
                ] );
                $source = new Connection( $config, $sourceCluster );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If55cd0e442e6a4b5b11c080fd564e04830d6585f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Krinkle <krinklem...@gmail.com>

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

Reply via email to