Exemple #1
0
 def test_3_4(self):
     ''' MongoDB 3.4 log file should be redacted '''
     tool = FruitSaladTool(arg_logfile='test/sample.3.4.log', arg_seed=0)
     tool.run()
     output = self.stdout.getvalue().split('\n')
     for sample in zip([line.strip() for line in open('test/sample_redacted.3.4.log', 'r')], output):
         self.assertEqual(sample[0], sample[1])
Exemple #2
0
 def test_ip_2(self):
     ''' IP addresses 127.0.0.1 should not be redacted '''
     tool = FruitSaladTool(arg_logfile='test/sample.ts.log', arg_seed=0)
     tool.run()
     output = self.stdout.getvalue().split('\n')
     self.assertEqual(output[9], '2017-09-04T16:12:47.997+1000 I NETWORK  [thread1] connection accepted from 127.0.0.1:57139 #6 (1 connection now open)')
     self.assertEqual(output[10], '2017-09-04T16:12:48.001+1000 I -        [conn6] end connection 127.0.0.1:57139 (2 connections now open)')
Exemple #3
0
 def test_milliseconds(self):
     ''' Timestamps should be printed unmodified '''
     tool = FruitSaladTool(arg_logfile='test/sample.ts.log', arg_seed=0)
     tool.run()
     output = self.stdout.getvalue().split('\n')
     self.assertEqual(output[0], '2017-08-25T22:23:49.097+0000 I COMMAND [conn0]')
     self.assertEqual(output[1], '2017-08-25T22:23:49.007+1000 I COMMAND [conn0]')
Exemple #4
0
 def test_namespace(self):
     ''' Namespaces should be redacted '''
     tool = FruitSaladTool(arg_logfile='test/sample.ts.log', arg_seed=0)
     tool.run()
     output = self.stdout.getvalue().split('\n')
     self.assertEqual(
         output[2],
         '2017-09-04T12:07:36.596+1000 D COMMAND  [conn6] run command mistyrose.$cmd { find: "303b5c8988601647873b4ffd247d83cb", filter: { key: 1.0 } }'
     )
 def test_namespace(self):
     ''' Namespaces should be redacted '''
     tool = FruitSaladTool(arg_logfile='test/sample.ts.log', arg_seed=0)
     tool.run()
     output = self.stdout.getvalue().split('\n')
     self.assertEqual(output[2], '2017-09-04T12:07:36.596+1000 D COMMAND  [conn6] run command sandybrown.$cmd { find: "303b5c8988601647873b4ffd247d83cb", filter: { key: 1.0 } }')