def test_strf_index(ea):
 ea.rules[0]['index'] = 'logstash-%Y.%m.%d'
 ea.rules[0]['use_strftime_index'] = True
 start = ts_to_dt('2015-01-02T12:34:45Z')
 end = ts_to_dt('2015-01-02T16:15:14Z')
 assert (ea.get_index(ea.rules[0], start, end) == 'logstash-2015.01.02')
 end = ts_to_dt('2015-01-03T01:02:03Z')
 assert (ea.get_index(ea.rules[0], start, end) == 'logstash-2015.01.02,logstash-2015.01.03')
 assert (ea.get_index(ea.rules[0]) == 'logstash-*')
 ea.rules[0]['index'] = 'logstash-%Y.%m'
 assert (ea.get_index(ea.rules[0]) == 'logstash-*')
 ea.rules[0]['index'] = 'logstash-%Y.%m-stuff'
 assert (ea.get_index(ea.rules[0]) == 'logstash-*-stuff')

def test_strf_index ( ea ) : ea . rules [ 0 ] [ 'index' ] = 'logstash-%Y.%m.%d' ea . rules [ 0 ] [ 'use_strftime_index' ] = True start = ts_to_dt ( '2015-01-02T12:34:45Z' ) end = ts_to_dt ( '2015-01-02T16:15:14Z' ) assert ( ea . get_index ( ea . rules [ 0 ] , start , end ) == 'logstash-2015.01.02' ) end = ts_to_dt ( '2015-01-03T01:02:03Z' ) assert ( ea . get_index ( ea . rules [ 0 ] , start , end ) == 'logstash-2015.01.02,logstash-2015.01.03' ) assert ( ea . get_index ( ea . rules [ 0 ] ) == 'logstash-*' ) ea . rules [ 0 ] [ 'index' ] = 'logstash-%Y.%m' assert ( ea . get_index ( ea . rules [ 0 ] ) == 'logstash-*' ) ea . rules [ 0 ] [ 'index' ] = 'logstash-%Y.%m-stuff' assert ( ea . get_index ( ea . rules [ 0 ] ) == 'logstash-*-stuff' )
test that the get_index function properly generates indexes spanning days .