#NEWLINE# def testTimestampsArePreservedAfterCompaction( self ) : #NEWLINE# #INDENT# with aff4 . FACTORY . Create ( self . collection_urn , 'PackedVersionedCollection' , mode = 'w' , token = self . token ) as fd : #NEWLINE# #INDENT# for i in range ( 5 ) : #NEWLINE# #INDENT# with test_lib . FakeTime ( ( index * 1000 ) ) : #NEWLINE# #INDENT# fd . Add ( rdf_flows . GrrMessage ( request_id = i ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# fd = aff4 . FACTORY . Open ( self . collection_urn , token = self . token ) #NEWLINE# for ( index , item ) in enumerate ( fd ) : #NEWLINE# #INDENT# self . assertEqual ( int ( item . age . AsSecondsFromEpoch ( ) ) , ( 1000 * index ) ) #NEWLINE# #UNINDENT# with aff4 . FACTORY . OpenWithLock ( self . collection_urn , 'PackedVersionedCollection' , token = self . token ) as fd : #NEWLINE# #INDENT# num_compacted = fd . Compact ( ) #NEWLINE# self . assertEqual ( num_compacted , 5 ) #NEWLINE# #UNINDENT# fd = aff4 . FACTORY . Open ( self . collection_urn , token = self . token ) #NEWLINE# for ( index , item ) in enumerate ( fd ) : #NEWLINE# #INDENT# self . assertEqual ( int ( item . age . AsSecondsFromEpoch ( ) ) , ( 1000 * index ) )