#NEWLINE# def test_handoff_replication_setting_warnings( self ) : #NEWLINE# #INDENT# conf_tests = [ ( { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , False ) , ( { #NEWLINE# #INDENT# 'handoff_delete' : 'auto' , #NEWLINE# #UNINDENT# } , False ) , ( { #NEWLINE# #INDENT# 'handoffs_first' : 'no' , #NEWLINE# #UNINDENT# } , False ) , ( { #NEWLINE# #INDENT# 'handoff_delete' : '2' , #NEWLINE# #UNINDENT# } , True ) , ( { #NEWLINE# #INDENT# 'handoffs_first' : 'yes' , #NEWLINE# #UNINDENT# } , True ) , ( { #NEWLINE# #INDENT# 'handoff_delete' : '1' , #NEWLINE# 'handoffs_first' : 'yes' , #NEWLINE# #UNINDENT# } , True ) ] #NEWLINE# log_message = 'Handoff only mode is not intended for normal operation, please disable handoffs_first and handoff_delete before the next normal rebalance' #NEWLINE# for ( config , expected_warning ) in conf_tests : #NEWLINE# #INDENT# self . logger . clear ( ) #NEWLINE# object_replicator . ObjectReplicator ( config , logger = self . logger ) #NEWLINE# warning_log_lines = self . logger . get_lines_for_level ( 'warning' ) #NEWLINE# if expected_warning : #NEWLINE# #INDENT# expected_log_lines = [ log_message ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# expected_log_lines = [ ] #NEWLINE# #UNINDENT# self . assertEqual ( expected_log_lines , warning_log_lines , ( 'expected %s != %s for config %r' % ( expected_log_lines , warning_log_lines , expected_warning ) ) )