コード例 #1
0
    def cleanup(self):
        resources = ["data_sources"]
        for swift_object in self.context["sahara"]["swift_objects"]:
            res_cleanup.SwiftObject(resource=swift_object[1])
        res_cleanup.SwiftContainer(
            resource=self.context["sahara"]["container_name"])

        # TODO(boris-42): Delete only resources created by this context
        resource_manager.cleanup(
            names=["sahara.%s" % res for res in resources],
            users=self.context.get("users", []))
コード例 #2
0
 def test_list(self, mock_swift_mixin__manager):
     containers = [mock.MagicMock(), mock.MagicMock()]
     objects = [mock.MagicMock(), mock.MagicMock(), mock.MagicMock()]
     mock_swift_mixin__manager().get_account.return_value = (
         "header", containers)
     mock_swift_mixin__manager().get_container.return_value = (
         "header", objects)
     self.assertEqual(len(containers),
                      len(resources.SwiftContainer().list()))
     self.assertEqual(len(containers) * len(objects),
                      len(resources.SwiftObject().list()))
コード例 #3
0
    def cleanup(self):
        resources = ["data_sources"]
        for swift_object in self.context["sahara"]["swift_objects"]:
            res_cleanup.SwiftObject(resource=swift_object[1])
        res_cleanup.SwiftContainer(
            resource=self.context["sahara"]["container_name"])

        resource_manager.cleanup(
            names=["sahara.%s" % res for res in resources],
            users=self.context.get("users", []),
            superclass=utils.SaharaScenario,
            task_id=self.context["task"]["uuid"])
コード例 #4
0
 def cleanup(self):
     for user, tenant_id in rutils.iterate_per_tenants(
             self.context["users"]):
         if self.context["tenants"][tenant_id].get("sahara", {}).get(
                 "container", {}).get("name") is not None:
             for swift_object in (
                     self.context["tenants"][tenant_id]["sahara"]
                 ["container"]["output_swift_objects"]):
                 res_cleanup.SwiftObject(swift_object[1])
         res_cleanup.SwiftContainer(self.context["tenants"][tenant_id].get(
             "sahara", {}).get("container", {}).get("name"))
     resources = ["data_sources"]
     resource_manager.cleanup(
         names=["sahara.%s" % res for res in resources],
         users=self.context.get("users", []))