@@ -332,55 +332,5 @@ public void FailOverTests_GetNoDynamicClient()
332332 // Only contains the client that passed while constructing the ConfigurationClientManager
333333 Assert . Single ( clients ) ;
334334 }
335-
336- [ Fact ]
337- public void FailOverTests_FailOverOnKeyVaultReferenceException ( )
338- {
339- // Arrange
340- IConfigurationRefresher refresher = null ;
341- var mockResponse = new Mock < Response > ( ) ;
342-
343- var mockClient1 = new Mock < ConfigurationClient > ( ) ;
344- mockClient1 . Setup ( c => c . GetConfigurationSettingsAsync ( It . IsAny < SettingSelector > ( ) , It . IsAny < CancellationToken > ( ) ) )
345- . Throws ( new KeyVaultReferenceException ( "Key vault reference failed." , new RequestFailedException ( 503 , "Request failed." ) ) ) ;
346- mockClient1 . Setup ( c => c . GetConfigurationSettingAsync ( It . IsAny < string > ( ) , It . IsAny < string > ( ) , It . IsAny < CancellationToken > ( ) ) )
347- . Throws ( new KeyVaultReferenceException ( "Key vault reference failed." , new RequestFailedException ( 503 , "Request failed." ) ) ) ;
348- mockClient1 . Setup ( c => c . GetConfigurationSettingAsync ( It . IsAny < ConfigurationSetting > ( ) , It . IsAny < bool > ( ) , It . IsAny < CancellationToken > ( ) ) )
349- . Throws ( new KeyVaultReferenceException ( "Key vault reference failed." , new RequestFailedException ( 503 , "Request failed." ) ) ) ;
350- mockClient1 . Setup ( c => c . Equals ( mockClient1 ) ) . Returns ( true ) ;
351-
352- var mockClient2 = new Mock < ConfigurationClient > ( ) ;
353- mockClient2 . Setup ( c => c . GetConfigurationSettingsAsync ( It . IsAny < SettingSelector > ( ) , It . IsAny < CancellationToken > ( ) ) )
354- . Returns ( new MockAsyncPageable ( Enumerable . Empty < ConfigurationSetting > ( ) . ToList ( ) ) ) ;
355- mockClient2 . Setup ( c => c . GetConfigurationSettingAsync ( It . IsAny < string > ( ) , It . IsAny < string > ( ) , It . IsAny < CancellationToken > ( ) ) )
356- . Returns ( Task . FromResult ( Response . FromValue < ConfigurationSetting > ( kv , mockResponse . Object ) ) ) ;
357- mockClient2 . Setup ( c => c . GetConfigurationSettingAsync ( It . IsAny < ConfigurationSetting > ( ) , It . IsAny < bool > ( ) , It . IsAny < CancellationToken > ( ) ) )
358- . Returns ( Task . FromResult ( Response . FromValue < ConfigurationSetting > ( kv , mockResponse . Object ) ) ) ;
359- mockClient2 . Setup ( c => c . Equals ( mockClient2 ) ) . Returns ( true ) ;
360-
361- ConfigurationClientWrapper cw1 = new ConfigurationClientWrapper ( TestHelpers . PrimaryConfigStoreEndpoint , mockClient1 . Object ) ;
362- ConfigurationClientWrapper cw2 = new ConfigurationClientWrapper ( TestHelpers . SecondaryConfigStoreEndpoint , mockClient2 . Object ) ;
363-
364- var clientList = new List < ConfigurationClientWrapper > ( ) { cw1 , cw2 } ;
365- var configClientManager = new ConfigurationClientManager ( clientList ) ;
366-
367- var config = new ConfigurationBuilder ( )
368- . AddAzureAppConfiguration ( options =>
369- {
370- options . ClientManager = configClientManager ;
371- options . Select ( "TestKey*" ) ;
372- options . ConfigureRefresh ( refreshOptions =>
373- {
374- refreshOptions . Register ( "TestKey1" , "label" )
375- . SetCacheExpiration ( TimeSpan . FromSeconds ( 1 ) ) ;
376- } ) ;
377-
378- refresher = options . GetRefresher ( ) ;
379- } )
380- . Build ( ) ;
381-
382- // The build should be successful since one client was backed off and it failed over to the second client.
383- Assert . Equal ( "TestValue1" , config [ "TestKey1" ] ) ;
384- }
385335 }
386336}
0 commit comments