Exemplo n.º 1
0
 def setUp(self):
     super(TestMissingLustreVersion, self).setUp()
     self.add_command(
         ("lctl", "get_param", "-n", "version"),
         rc=2,
         stderr=
         "error: get_param: param_path 'version': No such file or directory",
     )
     self.audit = LustreAudit()
Exemplo n.º 2
0
 def setUp(self):
     self.test_root = tempfile.mkdtemp()
     super(TestLustreAuditBadHealth, self).setUp()
     os.makedirs(os.path.join(self.test_root, "sys/fs/lustre"))
     f = open(os.path.join(self.test_root, "sys/fs/lustre/health_check"),
              "w+")
     f.write("NOT HEALTHY\n")
     f.close()
     self.audit = LustreAudit()
Exemplo n.º 3
0
class TestLustreAuditBadHealth(CommandCaptureTestCase):
    def setUp(self):
        super(TestLustreAuditBadHealth, self).setUp()
        self.add_command(("lctl", "get_param", "-n", "health_check"),
                         stdout="NOT HEALTHY\n")
        self.audit = LustreAudit()

    def test_health_check_not_healthy(self):
        self.assertEqual(self.audit.health_check(), "NOT HEALTHY")

    def test_healthy_false(self):
        assert not self.audit.is_healthy()
Exemplo n.º 4
0
class TestLustreAuditGoodHealth(CommandCaptureTestCase):
    def setUp(self):
        super(TestLustreAuditGoodHealth, self).setUp()
        self.add_command(("lctl", "get_param", "-n", "health_check"),
                         stdout="healthy\n")
        self.audit = LustreAudit()

    def test_health_check_healthy(self):
        self.assertEqual(self.audit.health_check(), "healthy")

    def test_healthy_true(self):
        assert self.audit.is_healthy()
Exemplo n.º 5
0
class TestLustreAuditBadHealth(PatchedContextTestCase):
    def setUp(self):
        self.test_root = tempfile.mkdtemp()
        super(TestLustreAuditBadHealth, self).setUp()
        os.makedirs(os.path.join(self.test_root, "sys/fs/lustre"))
        f = open(os.path.join(self.test_root, "sys/fs/lustre/health_check"),
                 "w+")
        f.write("NOT HEALTHY\n")
        f.close()
        self.audit = LustreAudit()

    def test_health_check_not_healthy(self):
        self.assertEqual(self.audit.health_check(), "NOT HEALTHY")

    def test_healthy_false(self):
        assert not self.audit.is_healthy()

    def tearDown(self):
        shutil.rmtree(self.test_root)
Exemplo n.º 6
0
class TestMisformedLustreVersion(PatchedContextTestCase):
    def setUp(self):
        tests = os.path.join(os.path.dirname(__file__), "..")
        self.test_root = os.path.join(tests,
                                      "data/lustre_versions/2.bad/mds_mgs")
        super(TestMisformedLustreVersion, self).setUp()
        self.audit = LustreAudit()

    def test_version(self):
        self.assertEqual(self.audit.version, "2.bad")

    def test_version_info(self):
        self.assertEqual(self.audit.version_info,
                         self.audit.LustreVersion(2, 0, 0))
Exemplo n.º 7
0
class TestGitLustreVersion(PatchedContextTestCase):
    def setUp(self):
        tests = os.path.join(os.path.dirname(__file__), "..")
        self.test_root = os.path.join(
            tests, "data/lustre_versions/2.9.58_86_g2383a62/mds_mgs")
        super(TestGitLustreVersion, self).setUp()
        self.audit = LustreAudit()

    def test_version(self):
        self.assertEqual(self.audit.version, "2.9.58_86_g2383a62")

    def test_version_info(self):
        self.assertEqual(self.audit.version_info,
                         self.audit.LustreVersion(2, 9, 58))
Exemplo n.º 8
0
class TestGitLustreVersion(PatchedContextTestCase):
    def setUp(self):
        tests = os.path.join(os.path.dirname(__file__), '..')
        self.test_root = os.path.join(
            tests, "data/lustre_versions/2.8.55_144_g75fa74c/mds_mgs")
        super(TestGitLustreVersion, self).setUp()
        self.audit = LustreAudit()

    def test_version(self):
        self.assertEqual(self.audit.version, "2.8.55_144_g75fa74c")

    def test_version_info(self):
        self.assertEqual(self.audit.version_info,
                         self.audit.LustreVersion(2, 8, 55))
Exemplo n.º 9
0
class TestMissingLustreVersion(PatchedContextTestCase):
    """No idea how this might happen, but it shouldn't crash the audit."""
    def setUp(self):
        self.test_root = tempfile.mkdtemp()
        super(TestMissingLustreVersion, self).setUp()
        os.makedirs(os.path.join(self.test_root, "sys/fs/lustre"))
        self.audit = LustreAudit()

    def test_version(self):
        self.assertEqual(self.audit.version, "0.0.0")

    def test_version_info(self):
        self.assertEqual(self.audit.version_info,
                         self.audit.LustreVersion(0, 0, 0))

    def tearDown(self):
        shutil.rmtree(self.test_root)
Exemplo n.º 10
0
class TestMissingLustreVersion(CommandCaptureTestCase):
    """No idea how this might happen, but it shouldn't crash the audit."""
    def setUp(self):
        super(TestMissingLustreVersion, self).setUp()
        self.add_command(
            ("lctl", "get_param", "-n", "version"),
            rc=2,
            stderr=
            "error: get_param: param_path 'version': No such file or directory",
        )
        self.audit = LustreAudit()

    def test_version(self):
        self.assertEqual(self.audit.version, "0.0.0")

    def test_version_info(self):
        self.assertEqual(self.audit.version_info,
                         self.audit.LustreVersion(0, 0, 0))
Exemplo n.º 11
0
 def setUp(self):
     tests = os.path.join(os.path.dirname(__file__), "..")
     self.test_root = os.path.join(tests,
                                   "data/lustre_versions/2.bad/mds_mgs")
     super(TestMisformedLustreVersion, self).setUp()
     self.audit = LustreAudit()
Exemplo n.º 12
0
 def setUp(self):
     tests = os.path.join(os.path.dirname(__file__), "..")
     self.test_root = os.path.join(
         tests, "data/lustre_versions/2.9.58_86_g2383a62/mds_mgs")
     super(TestGitLustreVersion, self).setUp()
     self.audit = LustreAudit()
Exemplo n.º 13
0
 def setUp(self):
     super(TestLustreAuditBadHealth, self).setUp()
     self.add_command(("lctl", "get_param", "-n", "health_check"),
                      stdout="NOT HEALTHY\n")
     self.audit = LustreAudit()
Exemplo n.º 14
0
 def setUp(self):
     self.test_root = tempfile.mkdtemp()
     super(TestMissingLustreVersion, self).setUp()
     os.makedirs(os.path.join(self.test_root, "sys/fs/lustre"))
     self.audit = LustreAudit()
Exemplo n.º 15
0
 def setUp(self):
     tests = os.path.join(os.path.dirname(__file__), '..')
     self.test_root = os.path.join(
         tests, "data/lustre_versions/2.8.55_144_g75fa74c/mds_mgs")
     super(TestGitLustreVersion, self).setUp()
     self.audit = LustreAudit()
Exemplo n.º 16
0
 def setUp(self):
     tests = os.path.join(os.path.dirname(__file__), '..')
     self.test_root = os.path.join(tests,
                                   "data/lustre_versions/2.0.66/mds_mgs")
     super(TestLustreAudit, self).setUp()
     self.audit = LustreAudit()