Beispiel #1
0
        def create_n_logs_undecorated(n):
            LogMessage.objects.all().delete()

            for i in range(0, n):
                # Ensure log messages have some NID-like and target-like strings
                # to exercise annotation
                fake_log_message("fake %s bogus bar baz" % i)
Beispiel #2
0
    def setUp(self):
        super(TestLogResource, self).setUp()

        # create users for filesystem_users test
        filesystem_user = User.objects.create_user('test_filesystem_user', '',
                                                   'password')
        filesystem_user.groups.add(Group.objects.get(name='filesystem_users'))

        self.clients = {
            'superuser': self.api_client,
            'filesystem_user': TestApiClient(),
            'filesystem_administrator': TestApiClient(),
            'unauthenticated': TestApiClient()
        }

        # authenticate clients
        self.assertTrue(self.clients['filesystem_user'].client.login(
            username='******', password='******'))
        self.assertTrue(self.clients['filesystem_administrator'].client.login(
            username='******', password='******'))

        # some basic log entries
        # all Lustre log entries have a leading space.
        self.messages = [
            'Plain old log message', 'Lustre: Normal Lustre Message',
            'LustreError: Lustre Error Message'
        ]
        self.lustre_messages = [
            message for message in self.messages
            if message.startswith('Lustre')
        ]
        for message in self.messages:
            fake_log_message(message)
    def setUp(self):
        super(TestLogResource, self).setUp()

        # create users for filesystem_users test
        filesystem_user = User.objects.create_user("test_filesystem_user", "",
                                                   "password")
        filesystem_user.groups.add(Group.objects.get(name="filesystem_users"))

        self.clients = {
            "superuser": self.api_client,
            "filesystem_user": TestApiClient(),
            "filesystem_administrator": TestApiClient(),
            "unauthenticated": TestApiClient(),
        }

        # authenticate clients
        self.assertTrue(self.clients["filesystem_user"].client.login(
            username="******", password="******"))
        self.assertTrue(self.clients["filesystem_administrator"].client.login(
            username="******", password="******"))

        # some basic log entries
        # all Lustre log entries have a leading space.
        self.messages = [
            "Plain old log message", "Lustre: Normal Lustre Message",
            "LustreError: Lustre Error Message"
        ]
        self.lustre_messages = [
            message for message in self.messages
            if message.startswith("Lustre")
        ]
        for message in self.messages:
            fake_log_message(message)
Beispiel #4
0
 def test_log_links(self):
     """Test that log viewer only displays valid links."""
     self.host = synthetic_host("myserver-with-nids",
                                [Nid.Nid("192.168.0.1", "tcp", 0)])
     self.create_simple_filesystem(self.host)
     fake_log_message("192.168.0.1@tcp testfs-MDT0000")
     response = self.api_client.get("/api/log/")
     event, = self.deserialize(response)["objects"]
     self.assertEqual(len(event["substitutions"]), 2)
     self.host.state = "removed"
     self.host.save()
     self.mdt.not_deleted = False
     self.mdt.save()
     response = self.api_client.get("/api/log/")
     event, = self.deserialize(response)["objects"]
     self.assertEqual(len(event["substitutions"]), 0)