@@ -21,6 +21,7 @@ namespace Tests.XPack.CrossClusterReplication
2121 [ SkipVersion ( "<6.5.0" , "" ) ]
2222 public class CrossClusterReplicationFollowTests : CoordinatedIntegrationTestBase < WritableCluster >
2323 {
24+ private readonly WritableCluster _cluster ;
2425 private const string CloseIndexStep = nameof ( CloseIndexStep ) ;
2526 private const string CountAfterStep = nameof ( CountAfterStep ) ;
2627 private const string CountBeforeStep = nameof ( CountBeforeStep ) ;
@@ -73,14 +74,37 @@ public CrossClusterReplicationFollowTests(WritableCluster cluster, EndpointUsage
7374 {
7475 FollowIndexStep , u =>
7576 u . Calls < CreateFollowIndexDescriptor , CreateFollowIndexRequest , ICreateFollowIndexRequest , ICreateFollowIndexResponse > (
76- v => new CreateFollowIndexRequest ( CopyIndex ( v ) )
77+ v =>
7778 {
78- RemoteCluster = DefaultSeeder . RemoteClusterName ,
79- LeaderIndex = v
79+ if ( cluster . ClusterConfiguration . Version < "6.7.0" )
80+ {
81+ return new CreateFollowIndexRequest ( CopyIndex ( v ) )
82+ {
83+ RemoteCluster = DefaultSeeder . RemoteClusterName ,
84+ LeaderIndex = v
85+ } ;
86+ }
87+ return new CreateFollowIndexRequest ( CopyIndex ( v ) )
88+ {
89+ RemoteCluster = DefaultSeeder . RemoteClusterName ,
90+ LeaderIndex = v ,
91+ WaitForActiveShards = "1"
92+ } ;
93+ } ,
94+ ( v , d ) =>
95+ {
96+ if ( cluster . ClusterConfiguration . Version < "6.7.0" )
97+ {
98+ return d
99+ . RemoteCluster ( DefaultSeeder . RemoteClusterName )
100+ . LeaderIndex ( v ) ;
101+ }
102+
103+ return d
104+ . RemoteCluster ( DefaultSeeder . RemoteClusterName )
105+ . LeaderIndex ( v )
106+ . WaitForActiveShards ( "1" ) ;
80107 } ,
81- ( v , d ) => d
82- . RemoteCluster ( DefaultSeeder . RemoteClusterName )
83- . LeaderIndex ( v ) ,
84108 ( v , c , f ) => c . CreateFollowIndex ( CopyIndex ( v ) , f ) ,
85109 ( v , c , f ) => c . CreateFollowIndexAsync ( CopyIndex ( v ) , f ) ,
86110 ( v , c , r ) => c . CreateFollowIndex ( r ) ,
@@ -197,7 +221,10 @@ public CrossClusterReplicationFollowTests(WritableCluster cluster, EndpointUsage
197221 ( v , c , r ) => c . UnfollowIndexAsync ( r )
198222 )
199223 } ,
200- } ) { }
224+ } )
225+ {
226+ _cluster = cluster ;
227+ }
201228
202229 protected static string Prefix { get ; } = $ "f{ Guid . NewGuid ( ) . ToString ( "N" ) . Substring ( 0 , 4 ) } ";
203230
@@ -318,6 +345,16 @@ [I] public async Task PauseBeforeCloseIsAcked() =>
318345 [ I ] public async Task CloseIsAcked ( ) => await Assert < CloseIndexResponse > ( CloseIndexStep , r => r . Acknowledged . Should ( ) . BeTrue ( ) ) ;
319346
320347 [ I ] public async Task UnfollowAfterCloseIsAcked ( ) =>
321- await Assert < UnfollowIndexResponse > ( UnfollowAgainStep , r => r . Acknowledged . Should ( ) . BeTrue ( ) ) ;
348+ await Assert < UnfollowIndexResponse > ( UnfollowAgainStep , r =>
349+ {
350+ // Unfollowing an index after closing on 6.7.0 throws an exception.
351+ if ( _cluster . ClusterConfiguration . Version < "6.7.0" )
352+ {
353+ r . Acknowledged . Should ( ) . BeTrue ( ) ;
354+ return ;
355+ }
356+ r . IsValid . Should ( ) . BeFalse ( ) ;
357+ r . ServerError . Should ( ) . NotBeNull ( ) ;
358+ } ) ;
322359 }
323360}
0 commit comments