def test_removed_host_deletes_bmc(self):
        bmc = self._create_power_outlet(
            host=self.host["resource_uri"], device=self.ipmi["resource_uri"], identifier="localhost"
        )
        self.assertDictEqual(bmc, self.api_get_list("/api/power_control_device_outlet/")[0])

        job = RemoveHostJob(host=self.host_obj)
        for step_klass, args in job.get_steps():
            step_klass(job, args, None, None, None).run(args)

        # The BMC should have been removed when the host was removed
        with self.assertRaises(IndexError):
            self.api_get_list("/api/power_control_device_outlet/")[0]
Example #2
0
    def test_removed_host_deletes_mount(self):
        mount = LustreClientMount.objects.create(host=self.host,
                                                 filesystem=self.fs,
                                                 mountpoint="/mnt/testfs")

        # Make sure it was created and that we can see it via API
        self.assertEqual(
            self.api_get("/api/client_mount/%s/" % mount.id)["id"], mount.id)

        job = RemoveHostJob(host=self.host)

        # March through the job steps
        for step_klass, args in job.get_steps():
            step_klass(job, args, None, None, None).run(args)

        # The mount should have been removed when the host was removed
        with self.assertRaises(AssertionError):
            self.api_get("/api/client_mount/%s/" % mount.id)