Пример #1
0
 def test_handler(*unused):
     # publish
     self.populate(constants.MIRROR_STRATEGY, ssl=True)
     pulp_conf.set('server', 'storage_dir', self.parentfs)
     dist = NodesHttpDistributor()
     repo = Repository(self.REPO_ID)
     conduit = RepoPublishConduit(self.REPO_ID, constants.HTTP_DISTRIBUTOR)
     dist.publish_repo(repo, conduit, self.dist_conf())
     units = []
     handler = NodeHandler(self)
     pulp_conf.set('server', 'storage_dir', self.childfs)
     report = handler.update(Conduit(), units, {})
     _report.append(report)
Пример #2
0
 def test_handler(*unused):
     # publish
     self.populate(constants.ADDITIVE_STRATEGY)
     pulp_conf.set('server', 'storage_dir', self.parentfs)
     dist = NodesHttpDistributor()
     repo = Repository(self.REPO_ID)
     conduit = RepoPublishConduit(self.REPO_ID, constants.HTTP_DISTRIBUTOR)
     dist.publish_repo(repo, conduit, self.dist_conf())
     units = []
     options = dict(strategy=constants.MIRROR_STRATEGY)
     handler = NodeHandler(self)
     pulp_conf.set('server', 'storage_dir', self.childfs)
     os.makedirs(os.path.join(self.childfs, 'content'))
     report = handler.update(Conduit(), units, options)
     _report.append(report)
Пример #3
0
 def test_node_handler_get_bindings_failed(self, mock_fetch):
     # Setup
     handler = NodeHandler({})
     mock_fetch.side_effect = error.GetBindingsError(500)
     # Test
     options = {
         constants.PARENT_SETTINGS: self.PARENT_SETTINGS,
         constants.STRATEGY_KEYWORD: constants.MIRROR_STRATEGY,
     }
     conduit = AgentConduit()
     report = handler.update(conduit, [], options)
     # Verify
     details = report.details
     errors = details['errors']
     self.assertFalse(report.succeeded)
     self.assertEqual(len(errors), 1)
     self.assertEqual(errors[0]['error_id'], error.GetBindingsError.ERROR_ID)
     self.assertTrue(errors[0]['details']['http_code'], 500)
Пример #4
0
 def test_node_handler_get_bindings_failed(self, mock_fetch):
     # Setup
     handler = NodeHandler({})
     mock_fetch.side_effect = error.GetBindingsError(500)
     # Test
     options = {
         constants.PARENT_SETTINGS: self.PARENT_SETTINGS,
         constants.STRATEGY_KEYWORD: constants.MIRROR_STRATEGY,
     }
     conduit = AgentConduit()
     report = handler.update(conduit, [], options)
     # Verify
     details = report.details
     errors = details['errors']
     self.assertFalse(report.succeeded)
     self.assertEqual(len(errors), 1)
     self.assertEqual(errors[0]['error_id'], error.GetBindingsError.ERROR_ID)
     self.assertTrue(errors[0]['details']['http_code'], 500)
Пример #5
0
 def test_handler(*unused):
     # publish
     self.populate(constants.MIRROR_STRATEGY)
     pulp_conf.set('server', 'storage_dir', self.parentfs)
     dist = NodesHttpDistributor()
     repo = Repository(self.REPO_ID)
     cfg = {
         'protocol':'file',
         'http':{'alias':self.alias},
         'https':{'alias':self.alias},
         'file':{'alias':self.alias},
     }
     conduit = RepoPublishConduit(self.REPO_ID, constants.HTTP_DISTRIBUTOR)
     dist.publish_repo(repo, conduit, cfg)
     units = []
     handler = NodeHandler(self)
     pulp_conf.set('server', 'storage_dir', self.childfs)
     os.makedirs(os.path.join(self.childfs, 'content'))
     report = handler.update(Conduit(), units, {})
     _report.append(report)