diff options
author | Tomas Bzatek <tbzatek@redhat.com> | 2014-05-22 18:14:30 +0200 |
---|---|---|
committer | Tomas Bzatek <tbzatek@redhat.com> | 2014-05-26 16:46:30 +0200 |
commit | 7e3ea486714a6c709a9b103f48a496a3ea279e23 (patch) | |
tree | 019742376eada2d4b2da170f4eb07efb883302cd | |
parent | 6bc5b4a228468c898bfcec6e944a034eebfdd336 (diff) | |
download | openlmi-providers-7e3ea486714a6c709a9b103f48a496a3ea279e23.tar.gz openlmi-providers-7e3ea486714a6c709a9b103f48a496a3ea279e23.tar.xz openlmi-providers-7e3ea486714a6c709a9b103f48a496a3ea279e23.zip |
journald: Enhance indication tests for UID/GID/PID matching
-rw-r--r-- | src/journald/test/TestIndications.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/journald/test/TestIndications.py b/src/journald/test/TestIndications.py index 4b96ba1..c2edd22 100644 --- a/src/journald/test/TestIndications.py +++ b/src/journald/test/TestIndications.py @@ -65,16 +65,24 @@ class TestIndications(JournalBase): """ Journal: Test message logging and its retrieval from journal """ + process_name = "nosetests" filter_name = "test_message_send_%d" % (time.time() * 1000) - syslog_msg = "== LMI_Journald test message ==" - data_format = "nosetests[{0}]: {1}".format(os.getpid(), syslog_msg) + syslog_msg = "== LMI_Journald indication test message mark %d ==" % (time.time() * 1000) + data_format = "{0}[{1}]: {2}".format(process_name, os.getpid(), syslog_msg) sub = self.subscribe(filter_name, "select * from LMI_JournalLogRecordInstanceCreationIndication where SourceInstance isa LMI_JournalLogRecord and SourceInstance.LMI_JournalLogRecord::DataFormat = '%s'" % data_format) - syslog.syslog(syslog_msg) + syslog.syslog(syslog.LOG_DEBUG, syslog_msg) indication = self.get_indication(10) self.assertEqual(indication.classname, "LMI_JournalLogRecordInstanceCreationIndication") self.assertIn("SourceInstance", indication.keys()) self.assertTrue(indication["SourceInstance"] is not None) self.assertIn(syslog_msg, indication["SourceInstance"]["DataFormat"]) + self.assertEqual(os.getpid(), indication["SourceInstance"]["ProcessID"]) + self.assertEqual(os.geteuid(), indication["SourceInstance"]["UserID"]) + self.assertEqual(os.getegid(), indication["SourceInstance"]["GroupID"]) + self.assertEqual(syslog.LOG_DEBUG, indication["SourceInstance"]["SyslogSeverity"]) + self.assertEqual(2, indication["SourceInstance"]["PerceivedSeverity"]) + self.assertEqual(1, indication["SourceInstance"]["SyslogFacility"]) + self.assertEqual(process_name, indication["SourceInstance"]["SyslogIdentifier"]) self.unsubscribe(sub); if __name__ == '__main__': |